1 /* outaout.c output routines for the Netwide Assembler to produce
2 * Linux a.out object files
4 * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
5 * Julian Hall. All rights reserved. The software is
6 * redistributable under the licence given in the file "Licence"
7 * distributed in the NASM archive.
19 #if defined OF_AOUT || defined OF_AOUTB
21 #define RELTYPE_ABSOLUTE 0x00
22 #define RELTYPE_RELATIVE 0x01
23 #define RELTYPE_GOTPC 0x01 /* no explicit GOTPC in a.out */
24 #define RELTYPE_GOTOFF 0x10
25 #define RELTYPE_GOT 0x10 /* distinct from GOTOFF bcos sym not sect */
26 #define RELTYPE_PLT 0x21
27 #define RELTYPE_SYMFLAG 0x08
31 long address
; /* relative to _start_ of section */
32 long symbol
; /* symbol number or -ve section id */
33 int bytes
; /* 2 or 4 */
34 int reltype
; /* see above */
38 long strpos
; /* string table position of name */
39 int type
; /* symbol type - see flags below */
40 long value
; /* address, or COMMON variable size */
41 long size
; /* size for data or function exports */
42 long segment
; /* back-reference used by gsym_reloc */
43 struct Symbol
*next
; /* list of globals in each section */
44 struct Symbol
*nextfwd
; /* list of unresolved-size symbols */
45 char *name
; /* for unresolved-size symbols */
46 long symnum
; /* index into symbol table */
50 * Section IDs - used in Reloc.symbol when negative, and in
51 * Symbol.type when positive.
53 #define SECT_ABS 2 /* absolute value */
54 #define SECT_TEXT 4 /* text section */
55 #define SECT_DATA 6 /* data section */
56 #define SECT_BSS 8 /* bss section */
57 #define SECT_MASK 0xE /* mask out any of the above */
60 * More flags used in Symbol.type.
62 #define SYM_GLOBAL 1 /* it's a global symbol */
63 #define SYM_DATA 0x100 /* used for shared libs */
64 #define SYM_FUNCTION 0x200 /* used for shared libs */
65 #define SYM_WITH_SIZE 0x4000 /* not output; internal only */
68 * Bit more explanation of symbol types: SECT_xxx denotes a local
69 * symbol. SECT_xxx|SYM_GLOBAL denotes a global symbol, defined in
70 * this module. Just SYM_GLOBAL, with zero value, denotes an
71 * external symbol referenced in this module. And just SYM_GLOBAL,
72 * but with a non-zero value, declares a C `common' variable, of
78 unsigned long len
, size
, nrelocs
;
80 struct Reloc
*head
, **tail
;
81 struct Symbol
*gsyms
, *asym
;
84 static struct Section stext
, sdata
, sbss
;
86 static struct SAA
*syms
;
87 static unsigned long nsyms
;
89 static struct RAA
*bsym
;
91 static struct SAA
*strs
;
92 static unsigned long strslen
;
94 static struct Symbol
*fwds
;
98 static evalfunc evaluate
;
103 static void aout_write(void);
104 static void aout_write_relocs(struct Reloc
*);
105 static void aout_write_syms(void);
106 static void aout_sect_write(struct Section
*, unsigned char *, unsigned long);
107 static void aout_pad_sections(void);
108 static void aout_fixup_relocs(struct Section
*);
111 * Special section numbers which are used to define special
112 * symbols, which can be used with WRT to provide PIC relocation
115 static long aout_gotpc_sect
, aout_gotoff_sect
;
116 static long aout_got_sect
, aout_plt_sect
;
117 static long aout_sym_sect
;
119 static void aoutg_init(FILE *fp
, efunc errfunc
, ldfunc ldef
, evalfunc eval
) {
123 (void) ldef
; /* placate optimisers */
124 stext
.data
= saa_init(1L); stext
.head
= NULL
; stext
.tail
= &stext
.head
;
125 sdata
.data
= saa_init(1L); sdata
.head
= NULL
; sdata
.tail
= &sdata
.head
;
126 stext
.len
= stext
.size
= sdata
.len
= sdata
.size
= sbss
.len
= 0;
127 stext
.nrelocs
= sdata
.nrelocs
= 0;
128 stext
.gsyms
= sdata
.gsyms
= sbss
.gsyms
= NULL
;
129 stext
.index
= seg_alloc();
130 sdata
.index
= seg_alloc();
131 sbss
.index
= seg_alloc();
132 stext
.asym
= sdata
.asym
= sbss
.asym
= NULL
;
133 syms
= saa_init((long)sizeof(struct Symbol
));
143 static void aout_init(FILE *fp
, efunc errfunc
, ldfunc ldef
, evalfunc eval
) {
145 aoutg_init (fp
, errfunc
, ldef
, eval
);
147 aout_gotpc_sect
= aout_gotoff_sect
= aout_got_sect
=
148 aout_plt_sect
= aout_sym_sect
= NO_SEG
;
155 extern struct ofmt of_aoutb
;
157 static void aoutb_init(FILE *fp
, efunc errfunc
, ldfunc ldef
, evalfunc eval
) {
159 aoutg_init (fp
, errfunc
, ldef
, eval
);
161 is_pic
= 0x00; /* may become 0x40 */
163 aout_gotpc_sect
= seg_alloc();
164 ldef("..gotpc", aout_gotpc_sect
+1, 0L, NULL
, FALSE
,FALSE
,&of_aoutb
,error
);
165 aout_gotoff_sect
= seg_alloc();
166 ldef("..gotoff", aout_gotoff_sect
+1, 0L,NULL
,FALSE
,FALSE
,&of_aoutb
,error
);
167 aout_got_sect
= seg_alloc();
168 ldef("..got", aout_got_sect
+1, 0L, NULL
, FALSE
,FALSE
,&of_aoutb
,error
);
169 aout_plt_sect
= seg_alloc();
170 ldef("..plt", aout_plt_sect
+1, 0L, NULL
, FALSE
,FALSE
,&of_aoutb
,error
);
171 aout_sym_sect
= seg_alloc();
172 ldef("..sym", aout_sym_sect
+1, 0L, NULL
, FALSE
,FALSE
,&of_aoutb
,error
);
177 static void aout_cleanup(void) {
181 aout_fixup_relocs(&stext
);
182 aout_fixup_relocs(&sdata
);
185 saa_free (stext
.data
);
188 stext
.head
= stext
.head
->next
;
191 saa_free (sdata
.data
);
194 sdata
.head
= sdata
.head
->next
;
202 static long aout_section_names (char *name
, int pass
, int *bits
) {
204 * Default to 32 bits.
212 if (!strcmp(name
, ".text"))
214 else if (!strcmp(name
, ".data"))
216 else if (!strcmp(name
, ".bss"))
222 static void aout_deflabel (char *name
, long segment
, long offset
,
223 int is_global
, char *special
) {
226 int special_used
= FALSE
;
228 if (name
[0] == '.' && name
[1] == '.' && name
[2] != '@') {
230 * This is a NASM special symbol. We never allow it into
231 * the a.out symbol table, even if it's a valid one. If it
232 * _isn't_ a valid one, we should barf immediately.
234 if (strcmp(name
, "..gotpc") && strcmp(name
, "..gotoff") &&
235 strcmp(name
, "..got") && strcmp(name
, "..plt") &&
236 strcmp(name
, "..sym"))
237 error (ERR_NONFATAL
, "unrecognised special symbol `%s'", name
);
241 if (is_global
== 3) {
244 * Fix up a forward-reference symbol size from the first
247 for (s
= &fwds
; *s
; s
= &(*s
)->nextfwd
)
248 if (!strcmp((*s
)->name
, name
)) {
249 struct tokenval tokval
;
253 while (*p
&& !isspace(*p
)) p
++;
254 while (*p
&& isspace(*p
)) p
++;
257 tokval
.t_type
= TOKEN_INVALID
;
258 e
= evaluate(stdscan
, NULL
, &tokval
, NULL
, 1, error
, NULL
);
261 error (ERR_NONFATAL
, "cannot use relocatable"
262 " expression as symbol size");
264 (*s
)->size
= reloc_value(e
);
268 * Remove it from the list of unresolved sizes.
270 nasm_free ((*s
)->name
);
274 return; /* it wasn't an important one */
277 saa_wbytes (strs
, name
, (long)(1+strlen(name
)));
278 strslen
+= 1+strlen(name
);
280 sym
= saa_wstruct (syms
);
283 sym
->type
= is_global
? SYM_GLOBAL
: 0;
284 sym
->segment
= segment
;
285 if (segment
== NO_SEG
)
286 sym
->type
|= SECT_ABS
;
287 else if (segment
== stext
.index
) {
288 sym
->type
|= SECT_TEXT
;
290 sym
->next
= stext
.gsyms
;
292 } else if (!stext
.asym
)
294 } else if (segment
== sdata
.index
) {
295 sym
->type
|= SECT_DATA
;
297 sym
->next
= sdata
.gsyms
;
299 } else if (!sdata
.asym
)
301 } else if (segment
== sbss
.index
) {
302 sym
->type
|= SECT_BSS
;
304 sym
->next
= sbss
.gsyms
;
306 } else if (!sbss
.asym
)
309 sym
->type
= SYM_GLOBAL
;
313 sym
->value
= (sym
->type
== SYM_GLOBAL
? 0 : offset
);
315 if (is_global
&& sym
->type
!= SYM_GLOBAL
) {
317 * Global symbol exported _from_ this module. We must check
318 * the special text for type information.
322 int n
= strcspn(special
, " ");
324 if (!nasm_strnicmp(special
, "function", n
))
325 sym
->type
|= SYM_FUNCTION
;
326 else if (!nasm_strnicmp(special
, "data", n
) ||
327 !nasm_strnicmp(special
, "object", n
))
328 sym
->type
|= SYM_DATA
;
330 error(ERR_NONFATAL
, "unrecognised symbol type `%.*s'",
333 struct tokenval tokval
;
338 error(ERR_NONFATAL
, "Linux a.out does not support"
339 " symbol size information");
341 while (special
[n
] && isspace(special
[n
]))
344 * We have a size expression; attempt to
347 sym
->type
|= SYM_WITH_SIZE
;
349 stdscan_bufptr
= special
+n
;
350 tokval
.t_type
= TOKEN_INVALID
;
351 e
= evaluate(stdscan
, NULL
, &tokval
, &fwd
, 0, error
, NULL
);
355 sym
->name
= nasm_strdup(name
);
358 error (ERR_NONFATAL
, "cannot use relocatable"
359 " expression as symbol size");
361 sym
->size
= reloc_value(e
);
370 * define the references from external-symbol segment numbers
371 * to these symbol records.
373 if (segment
!= NO_SEG
&& segment
!= stext
.index
&&
374 segment
!= sdata
.index
&& segment
!= sbss
.index
)
375 bsym
= raa_write (bsym
, segment
, nsyms
);
379 if (sym
->type
& SYM_WITH_SIZE
)
380 nsyms
++; /* and another for the size */
382 if (special
&& !special_used
)
383 error(ERR_NONFATAL
, "no special symbol features supported here");
386 static void aout_add_reloc (struct Section
*sect
, long segment
,
387 int reltype
, int bytes
) {
390 r
= *sect
->tail
= nasm_malloc(sizeof(struct Reloc
));
391 sect
->tail
= &r
->next
;
394 r
->address
= sect
->len
;
395 r
->symbol
= (segment
== NO_SEG
? -SECT_ABS
:
396 segment
== stext
.index
? -SECT_TEXT
:
397 segment
== sdata
.index
? -SECT_DATA
:
398 segment
== sbss
.index
? -SECT_BSS
:
399 raa_read(bsym
, segment
));
400 r
->reltype
= reltype
;
402 r
->reltype
|= RELTYPE_SYMFLAG
;
409 * This routine deals with ..got and ..sym relocations: the more
410 * complicated kinds. In shared-library writing, some relocations
411 * with respect to global symbols must refer to the precise symbol
412 * rather than referring to an offset from the base of the section
413 * _containing_ the symbol. Such relocations call to this routine,
414 * which searches the symbol list for the symbol in question.
416 * RELTYPE_GOT references require the _exact_ symbol address to be
417 * used; RELTYPE_ABSOLUTE references can be at an offset from the
418 * symbol. The boolean argument `exact' tells us this.
420 * Return value is the adjusted value of `addr', having become an
421 * offset from the symbol rather than the section. Should always be
422 * zero when returning from an exact call.
424 * Limitation: if you define two symbols at the same place,
425 * confusion will occur.
427 * Inefficiency: we search, currently, using a linked list which
428 * isn't even necessarily sorted.
430 static long aout_add_gsym_reloc (struct Section
*sect
,
431 long segment
, long offset
,
432 int type
, int bytes
, int exact
) {
433 struct Symbol
*sym
, *sm
, *shead
;
437 * First look up the segment to find whether it's text, data,
438 * bss or an external symbol.
441 if (segment
== stext
.index
)
443 else if (segment
== sdata
.index
)
445 else if (segment
== sbss
.index
)
448 if (exact
&& offset
!= 0)
449 error (ERR_NONFATAL
, "unable to find a suitable global symbol"
450 " for this reference");
452 aout_add_reloc (sect
, segment
, type
, bytes
);
458 * Find a symbol pointing _exactly_ at this one.
460 for (sym
= shead
; sym
; sym
= sym
->next
)
461 if (sym
->value
== offset
)
465 * Find the nearest symbol below this one.
468 for (sm
= shead
; sm
; sm
= sm
->next
)
469 if (sm
->value
<= offset
&& (!sym
|| sm
->value
> sym
->value
))
473 error (ERR_NONFATAL
, "unable to find a suitable global symbol"
474 " for this reference");
478 r
= *sect
->tail
= nasm_malloc(sizeof(struct Reloc
));
479 sect
->tail
= &r
->next
;
482 r
->address
= sect
->len
;
483 r
->symbol
= sym
->symnum
;
484 r
->reltype
= type
| RELTYPE_SYMFLAG
;
489 return offset
- sym
->value
;
493 * This routine deals with ..gotoff relocations. These _must_ refer
494 * to a symbol, due to a perversity of *BSD's PIC implementation,
495 * and it must be a non-global one as well; so we store `asym', the
496 * first nonglobal symbol defined in each section, and always work
497 * from that. Relocation type is always RELTYPE_GOTOFF.
499 * Return value is the adjusted value of `addr', having become an
500 * offset from the `asym' symbol rather than the section.
502 static long aout_add_gotoff_reloc (struct Section
*sect
, long segment
,
503 long offset
, int bytes
) {
508 * First look up the segment to find whether it's text, data,
509 * bss or an external symbol.
512 if (segment
== stext
.index
)
514 else if (segment
== sdata
.index
)
516 else if (segment
== sbss
.index
)
519 error (ERR_NONFATAL
, "`..gotoff' relocations require a non-global"
520 " symbol in the section");
522 r
= *sect
->tail
= nasm_malloc(sizeof(struct Reloc
));
523 sect
->tail
= &r
->next
;
526 r
->address
= sect
->len
;
527 r
->symbol
= asym
->symnum
;
528 r
->reltype
= RELTYPE_GOTOFF
;
533 return offset
- asym
->value
;
536 static void aout_out (long segto
, void *data
, unsigned long type
,
537 long segment
, long wrt
) {
539 long realbytes
= type
& OUT_SIZMASK
;
541 unsigned char mydata
[4], *p
;
546 * handle absolute-assembly (structure definitions)
548 if (segto
== NO_SEG
) {
549 if (type
!= OUT_RESERVE
)
550 error (ERR_NONFATAL
, "attempt to assemble code in [ABSOLUTE]"
555 if (segto
== stext
.index
)
557 else if (segto
== sdata
.index
)
559 else if (segto
== sbss
.index
)
562 error(ERR_WARNING
, "attempt to assemble code in"
563 " segment %d: defaulting to `.text'", segto
);
567 if (!s
&& type
!= OUT_RESERVE
) {
568 error(ERR_WARNING
, "attempt to initialise memory in the"
569 " BSS section: ignored");
570 if (type
== OUT_REL2ADR
)
572 else if (type
== OUT_REL4ADR
)
574 sbss
.len
+= realbytes
;
578 if (type
== OUT_RESERVE
) {
580 error(ERR_WARNING
, "uninitialised space declared in"
581 " %s section: zeroing",
582 (segto
== stext
.index
? "code" : "data"));
583 aout_sect_write (s
, NULL
, realbytes
);
585 sbss
.len
+= realbytes
;
586 } else if (type
== OUT_RAWDATA
) {
587 if (segment
!= NO_SEG
)
588 error(ERR_PANIC
, "OUT_RAWDATA with other than NO_SEG");
589 aout_sect_write (s
, data
, realbytes
);
590 } else if (type
== OUT_ADDRESS
) {
591 addr
= *(long *)data
;
592 if (segment
!= NO_SEG
) {
594 error(ERR_NONFATAL
, "a.out format does not support"
595 " segment base references");
598 aout_add_reloc (s
, segment
, RELTYPE_ABSOLUTE
, realbytes
);
600 error (ERR_NONFATAL
, "Linux a.out format does not support"
602 wrt
= NO_SEG
; /* we can at least _try_ to continue */
603 } else if (wrt
== aout_gotpc_sect
+1) {
605 aout_add_reloc (s
, segment
, RELTYPE_GOTPC
, realbytes
);
606 } else if (wrt
== aout_gotoff_sect
+1) {
608 addr
= aout_add_gotoff_reloc (s
, segment
,
610 } else if (wrt
== aout_got_sect
+1) {
612 addr
= aout_add_gsym_reloc (s
, segment
, addr
, RELTYPE_GOT
,
614 } else if (wrt
== aout_sym_sect
+1) {
615 addr
= aout_add_gsym_reloc (s
, segment
, addr
,
616 RELTYPE_ABSOLUTE
, realbytes
,
618 } else if (wrt
== aout_plt_sect
+1) {
620 error(ERR_NONFATAL
, "a.out format cannot produce non-PC-"
621 "relative PLT references");
623 error (ERR_NONFATAL
, "a.out format does not support this"
625 wrt
= NO_SEG
; /* we can at least _try_ to continue */
631 WRITESHORT (p
, addr
);
634 aout_sect_write (s
, mydata
, realbytes
);
635 } else if (type
== OUT_REL2ADR
) {
636 if (segment
== segto
)
637 error(ERR_PANIC
, "intra-segment OUT_REL2ADR");
638 if (segment
!= NO_SEG
&& segment
% 2) {
639 error(ERR_NONFATAL
, "a.out format does not support"
640 " segment base references");
643 aout_add_reloc (s
, segment
, RELTYPE_RELATIVE
, 2);
645 error (ERR_NONFATAL
, "Linux a.out format does not support"
647 wrt
= NO_SEG
; /* we can at least _try_ to continue */
648 } else if (wrt
== aout_plt_sect
+1) {
650 aout_add_reloc (s
, segment
, RELTYPE_PLT
, 2);
651 } else if (wrt
== aout_gotpc_sect
+1 ||
652 wrt
== aout_gotoff_sect
+1 ||
653 wrt
== aout_got_sect
+1) {
654 error(ERR_NONFATAL
, "a.out format cannot produce PC-"
655 "relative GOT references");
657 error (ERR_NONFATAL
, "a.out format does not support this"
659 wrt
= NO_SEG
; /* we can at least _try_ to continue */
663 WRITESHORT (p
, *(long*)data
-(realbytes
+ s
->len
));
664 aout_sect_write (s
, mydata
, 2L);
665 } else if (type
== OUT_REL4ADR
) {
666 if (segment
== segto
)
667 error(ERR_PANIC
, "intra-segment OUT_REL4ADR");
668 if (segment
!= NO_SEG
&& segment
% 2) {
669 error(ERR_NONFATAL
, "a.out format does not support"
670 " segment base references");
673 aout_add_reloc (s
, segment
, RELTYPE_RELATIVE
, 4);
675 error (ERR_NONFATAL
, "Linux a.out format does not support"
677 wrt
= NO_SEG
; /* we can at least _try_ to continue */
678 } else if (wrt
== aout_plt_sect
+1) {
680 aout_add_reloc (s
, segment
, RELTYPE_PLT
, 4);
681 } else if (wrt
== aout_gotpc_sect
+1 ||
682 wrt
== aout_gotoff_sect
+1 ||
683 wrt
== aout_got_sect
+1) {
684 error(ERR_NONFATAL
, "a.out format cannot produce PC-"
685 "relative GOT references");
687 error (ERR_NONFATAL
, "a.out format does not support this"
689 wrt
= NO_SEG
; /* we can at least _try_ to continue */
693 WRITELONG (p
, *(long*)data
-(realbytes
+ s
->len
));
694 aout_sect_write (s
, mydata
, 4L);
698 static void aout_pad_sections(void) {
699 static unsigned char pad
[] = { 0x90, 0x90, 0x90, 0x90 };
701 * Pad each of the text and data sections with NOPs until their
702 * length is a multiple of four. (NOP == 0x90.) Also increase
703 * the length of the BSS section similarly.
705 aout_sect_write (&stext
, pad
, (-(long)stext
.len
) & 3);
706 aout_sect_write (&sdata
, pad
, (-(long)sdata
.len
) & 3);
707 sbss
.len
= (sbss
.len
+ 3) & ~3;
711 * a.out files have the curious property that all references to
712 * things in the data or bss sections are done by addresses which
713 * are actually relative to the start of the _text_ section, in the
714 * _file_. (No relation to what happens after linking. No idea why
715 * this should be so. It's very strange.) So we have to go through
716 * the relocation table, _after_ the final size of each section is
717 * known, and fix up the relocations pointed to.
719 static void aout_fixup_relocs(struct Section
*sect
) {
722 saa_rewind (sect
->data
);
723 for (r
= sect
->head
; r
; r
= r
->next
) {
724 unsigned char *p
, *q
, blk
[4];
727 saa_fread (sect
->data
, r
->address
, blk
, (long)r
->bytes
);
731 l
+= ((long)*p
++) << 8;
733 l
+= ((long)*p
++) << 16;
734 l
+= ((long)*p
++) << 24;
737 if (r
->symbol
== -SECT_DATA
)
739 else if (r
->symbol
== -SECT_BSS
)
740 l
+= stext
.len
+ sdata
.len
;
743 else if (r
->bytes
== 2)
747 saa_fwrite (sect
->data
, r
->address
, blk
, (long)r
->bytes
);
751 static void aout_write(void) {
753 * Emit the a.out header.
755 /* OMAGIC, M_386 or MID_I386, no flags */
756 fwritelong (bsd
? 0x07018600 | is_pic
: 0x640107L
, aoutfp
);
757 fwritelong (stext
.len
, aoutfp
);
758 fwritelong (sdata
.len
, aoutfp
);
759 fwritelong (sbss
.len
, aoutfp
);
760 fwritelong (nsyms
* 12, aoutfp
); /* length of symbol table */
761 fwritelong (0L, aoutfp
); /* object files have no entry point */
762 fwritelong (stext
.nrelocs
* 8, aoutfp
); /* size of text relocs */
763 fwritelong (sdata
.nrelocs
* 8, aoutfp
); /* size of data relocs */
766 * Write out the code section and the data section.
768 saa_fpwrite (stext
.data
, aoutfp
);
769 saa_fpwrite (sdata
.data
, aoutfp
);
772 * Write out the relocations.
774 aout_write_relocs (stext
.head
);
775 aout_write_relocs (sdata
.head
);
778 * Write the symbol table.
783 * And the string table.
785 fwritelong (strslen
+4, aoutfp
); /* length includes length count */
786 saa_fpwrite (strs
, aoutfp
);
789 static void aout_write_relocs (struct Reloc
*r
) {
793 fwritelong (r
->address
, aoutfp
);
799 word2
|= r
->reltype
<< 24;
800 word2
|= (r
->bytes
== 1 ? 0 :
801 r
->bytes
== 2 ? 0x2000000L
: 0x4000000L
);
802 fwritelong (word2
, aoutfp
);
808 static void aout_write_syms (void) {
812 for (i
=0; i
<nsyms
; i
++) {
813 struct Symbol
*sym
= saa_rstruct(syms
);
814 fwritelong (sym
->strpos
, aoutfp
);
815 fwritelong ((long)sym
->type
& ~SYM_WITH_SIZE
, aoutfp
);
817 * Fix up the symbol value now we know the final section
820 if ((sym
->type
& SECT_MASK
) == SECT_DATA
)
821 sym
->value
+= stext
.len
;
822 if ((sym
->type
& SECT_MASK
) == SECT_BSS
)
823 sym
->value
+= stext
.len
+ sdata
.len
;
824 fwritelong (sym
->value
, aoutfp
);
826 * Output a size record if necessary.
828 if (sym
->type
& SYM_WITH_SIZE
) {
829 fwritelong(sym
->strpos
, aoutfp
);
830 fwritelong(0x0DL
, aoutfp
); /* special value: means size */
831 fwritelong(sym
->size
, aoutfp
);
832 i
++; /* use up another of `nsyms' */
837 static void aout_sect_write (struct Section
*sect
,
838 unsigned char *data
, unsigned long len
) {
839 saa_wbytes (sect
->data
, data
, len
);
843 static long aout_segbase (long segment
) {
847 static int aout_directive (char *directive
, char *value
, int pass
) {
851 static void aout_filename (char *inname
, char *outname
, efunc error
) {
852 standard_extension (inname
, outname
, ".o", error
);
855 static char *aout_stdmac
[] = {
856 "%define __SECT__ [section .text]",
860 #endif /* OF_AOUT || OF_AOUTB */
864 struct ofmt of_aout
= {
865 "Linux a.out object files",
882 struct ofmt of_aoutb
= {
883 "NetBSD/FreeBSD a.out object files",