6 * © 1994-1998 Straylight
9 /*----- Licensing note ----------------------------------------------------*
11 * This file is part of Straylight's AOF library (aoflib).
13 * Aoflib is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
18 * Aoflib is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with Aoflib. If not, write to the Free Software Foundation,
25 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 extern void aof_error(void);
37 int aof_fillBlock(void *p,size_t offset,size_t l,aof_chunkinfo *i)
42 i->size=(offset+l+255)&~255;
43 xp=realloc(i->p,i->size);
48 memcpy(i->p+offset,p,l);
52 int aof_addBlock(void *p,size_t l,aof_chunkinfo *i)
54 aof_fillBlock(p,i->next,l,i);
59 int aof_branch(int from,int to)
61 return (0xEA000000 | (((to-from-8) & 0x03FFFFFC) >> 2));
64 void aof_reloc(char *name,int offset,int weak,aof_file *f)
68 sym.name=aof_string(name,f->strt);
73 r.t.type_1.symbol=aof_add(sym,f->symt)/sizeof(aof_symbol);
74 r.t.type_1.field=aof_FULLWORD;
75 r.t.type_1.type=aof_ADDITIVE;
76 r.t.type_1.symreloc=1;
81 void aof_reloc_b(char *name,int offset,aof_file *f)
85 sym.name=aof_string(name,f->strt);
89 r.t.type_1.symbol=aof_add(sym,f->symt)/sizeof(aof_symbol);
90 r.t.type_1.field=aof_FULLWORD;
91 r.t.type_1.type=aof_PCRELATIVE;
92 r.t.type_1.symreloc=1;
96 void aof_roff(int offset,aof_file *f)
100 r.t.type_1.field=aof_FULLWORD;
101 r.t.type_1.type=aof_ADDITIVE;
102 r.t.type_1.symreloc=0;
106 void aof_addsym(char *name,int offset,int local,int area,aof_file *f)
109 sym.name=aof_string(name,f->strt);
114 aof_add(sym,f->symt);