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 license given in the file "LICENSE"
7 * distributed in the NASM archive.
26 #if defined OF_AOUT || defined OF_AOUTB
28 #define RELTYPE_ABSOLUTE 0x00
29 #define RELTYPE_RELATIVE 0x01
30 #define RELTYPE_GOTPC 0x01 /* no explicit GOTPC in a.out */
31 #define RELTYPE_GOTOFF 0x10
32 #define RELTYPE_GOT 0x10 /* distinct from GOTOFF bcos sym not sect */
33 #define RELTYPE_PLT 0x21
34 #define RELTYPE_SYMFLAG 0x08
38 int32_t address
; /* relative to _start_ of section */
39 int32_t symbol
; /* symbol number or -ve section id */
40 int bytes
; /* 2 or 4 */
41 int reltype
; /* see above */
45 int32_t strpos
; /* string table position of name */
46 int type
; /* symbol type - see flags below */
47 int32_t value
; /* address, or COMMON variable size */
48 int32_t size
; /* size for data or function exports */
49 int32_t segment
; /* back-reference used by gsym_reloc */
50 struct Symbol
*next
; /* list of globals in each section */
51 struct Symbol
*nextfwd
; /* list of unresolved-size symbols */
52 char *name
; /* for unresolved-size symbols */
53 int32_t symnum
; /* index into symbol table */
57 * Section IDs - used in Reloc.symbol when negative, and in
58 * Symbol.type when positive.
60 #define SECT_ABS 2 /* absolute value */
61 #define SECT_TEXT 4 /* text section */
62 #define SECT_DATA 6 /* data section */
63 #define SECT_BSS 8 /* bss section */
64 #define SECT_MASK 0xE /* mask out any of the above */
67 * More flags used in Symbol.type.
69 #define SYM_GLOBAL 1 /* it's a global symbol */
70 #define SYM_DATA 0x100 /* used for shared libs */
71 #define SYM_FUNCTION 0x200 /* used for shared libs */
72 #define SYM_WITH_SIZE 0x4000 /* not output; internal only */
75 * Bit more explanation of symbol types: SECT_xxx denotes a local
76 * symbol. SECT_xxx|SYM_GLOBAL denotes a global symbol, defined in
77 * this module. Just SYM_GLOBAL, with zero value, denotes an
78 * external symbol referenced in this module. And just SYM_GLOBAL,
79 * but with a non-zero value, declares a C `common' variable, of
85 uint32_t len
, size
, nrelocs
;
87 struct Reloc
*head
, **tail
;
88 struct Symbol
*gsyms
, *asym
;
91 static struct Section stext
, sdata
, sbss
;
93 static struct SAA
*syms
;
94 static uint32_t nsyms
;
96 static struct RAA
*bsym
;
98 static struct SAA
*strs
;
99 static uint32_t strslen
;
101 static struct Symbol
*fwds
;
105 static evalfunc evaluate
;
110 static void aout_write(void);
111 static void aout_write_relocs(struct Reloc
*);
112 static void aout_write_syms(void);
113 static void aout_sect_write(struct Section
*, const uint8_t *,
115 static void aout_pad_sections(void);
116 static void aout_fixup_relocs(struct Section
*);
119 * Special section numbers which are used to define special
120 * symbols, which can be used with WRT to provide PIC relocation
123 static int32_t aout_gotpc_sect
, aout_gotoff_sect
;
124 static int32_t aout_got_sect
, aout_plt_sect
;
125 static int32_t aout_sym_sect
;
127 static void aoutg_init(FILE * fp
, efunc errfunc
, ldfunc ldef
,
133 (void)ldef
; /* placate optimisers */
134 stext
.data
= saa_init(1L);
136 stext
.tail
= &stext
.head
;
137 sdata
.data
= saa_init(1L);
139 sdata
.tail
= &sdata
.head
;
140 stext
.len
= stext
.size
= sdata
.len
= sdata
.size
= sbss
.len
= 0;
141 stext
.nrelocs
= sdata
.nrelocs
= 0;
142 stext
.gsyms
= sdata
.gsyms
= sbss
.gsyms
= NULL
;
143 stext
.index
= seg_alloc();
144 sdata
.index
= seg_alloc();
145 sbss
.index
= seg_alloc();
146 stext
.asym
= sdata
.asym
= sbss
.asym
= NULL
;
147 syms
= saa_init((int32_t)sizeof(struct Symbol
));
157 static void aout_init(FILE * fp
, efunc errfunc
, ldfunc ldef
, evalfunc eval
)
160 aoutg_init(fp
, errfunc
, ldef
, eval
);
162 aout_gotpc_sect
= aout_gotoff_sect
= aout_got_sect
=
163 aout_plt_sect
= aout_sym_sect
= NO_SEG
;
170 extern struct ofmt of_aoutb
;
172 static void aoutb_init(FILE * fp
, efunc errfunc
, ldfunc ldef
,
176 aoutg_init(fp
, errfunc
, ldef
, eval
);
178 is_pic
= 0x00; /* may become 0x40 */
180 aout_gotpc_sect
= seg_alloc();
181 ldef("..gotpc", aout_gotpc_sect
+ 1, 0L, NULL
, false, false, &of_aoutb
,
183 aout_gotoff_sect
= seg_alloc();
184 ldef("..gotoff", aout_gotoff_sect
+ 1, 0L, NULL
, false, false,
186 aout_got_sect
= seg_alloc();
187 ldef("..got", aout_got_sect
+ 1, 0L, NULL
, false, false, &of_aoutb
,
189 aout_plt_sect
= seg_alloc();
190 ldef("..plt", aout_plt_sect
+ 1, 0L, NULL
, false, false, &of_aoutb
,
192 aout_sym_sect
= seg_alloc();
193 ldef("..sym", aout_sym_sect
+ 1, 0L, NULL
, false, false, &of_aoutb
,
199 static void aout_cleanup(int debuginfo
)
206 aout_fixup_relocs(&stext
);
207 aout_fixup_relocs(&sdata
);
210 saa_free(stext
.data
);
213 stext
.head
= stext
.head
->next
;
216 saa_free(sdata
.data
);
219 sdata
.head
= sdata
.head
->next
;
227 static int32_t aout_section_names(char *name
, int pass
, int *bits
)
233 * Default to 32 bits.
241 if (!strcmp(name
, ".text"))
243 else if (!strcmp(name
, ".data"))
245 else if (!strcmp(name
, ".bss"))
251 static void aout_deflabel(char *name
, int32_t segment
, int64_t offset
,
252 int is_global
, char *special
)
254 int pos
= strslen
+ 4;
256 int special_used
= false;
258 if (name
[0] == '.' && name
[1] == '.' && name
[2] != '@') {
260 * This is a NASM special symbol. We never allow it into
261 * the a.out symbol table, even if it's a valid one. If it
262 * _isn't_ a valid one, we should barf immediately.
264 if (strcmp(name
, "..gotpc") && strcmp(name
, "..gotoff") &&
265 strcmp(name
, "..got") && strcmp(name
, "..plt") &&
266 strcmp(name
, "..sym"))
267 error(ERR_NONFATAL
, "unrecognised special symbol `%s'", name
);
271 if (is_global
== 3) {
274 * Fix up a forward-reference symbol size from the first
277 for (s
= &fwds
; *s
; s
= &(*s
)->nextfwd
)
278 if (!strcmp((*s
)->name
, name
)) {
279 struct tokenval tokval
;
283 while (*p
&& !nasm_isspace(*p
))
285 while (*p
&& nasm_isspace(*p
))
289 tokval
.t_type
= TOKEN_INVALID
;
290 e
= evaluate(stdscan
, NULL
, &tokval
, NULL
, 1, error
, NULL
);
293 error(ERR_NONFATAL
, "cannot use relocatable"
294 " expression as symbol size");
296 (*s
)->size
= reloc_value(e
);
300 * Remove it from the list of unresolved sizes.
302 nasm_free((*s
)->name
);
306 return; /* it wasn't an important one */
309 saa_wbytes(strs
, name
, (int32_t)(1 + strlen(name
)));
310 strslen
+= 1 + strlen(name
);
312 sym
= saa_wstruct(syms
);
315 sym
->type
= is_global
? SYM_GLOBAL
: 0;
316 sym
->segment
= segment
;
317 if (segment
== NO_SEG
)
318 sym
->type
|= SECT_ABS
;
319 else if (segment
== stext
.index
) {
320 sym
->type
|= SECT_TEXT
;
322 sym
->next
= stext
.gsyms
;
324 } else if (!stext
.asym
)
326 } else if (segment
== sdata
.index
) {
327 sym
->type
|= SECT_DATA
;
329 sym
->next
= sdata
.gsyms
;
331 } else if (!sdata
.asym
)
333 } else if (segment
== sbss
.index
) {
334 sym
->type
|= SECT_BSS
;
336 sym
->next
= sbss
.gsyms
;
338 } else if (!sbss
.asym
)
341 sym
->type
= SYM_GLOBAL
;
345 sym
->value
= (sym
->type
== SYM_GLOBAL
? 0 : offset
);
347 if (is_global
&& sym
->type
!= SYM_GLOBAL
) {
349 * Global symbol exported _from_ this module. We must check
350 * the special text for type information.
354 int n
= strcspn(special
, " ");
356 if (!nasm_strnicmp(special
, "function", n
))
357 sym
->type
|= SYM_FUNCTION
;
358 else if (!nasm_strnicmp(special
, "data", n
) ||
359 !nasm_strnicmp(special
, "object", n
))
360 sym
->type
|= SYM_DATA
;
362 error(ERR_NONFATAL
, "unrecognised symbol type `%.*s'",
365 struct tokenval tokval
;
368 char *saveme
= stdscan_bufptr
; /* bugfix? fbk 8/10/00 */
371 error(ERR_NONFATAL
, "Linux a.out does not support"
372 " symbol size information");
374 while (special
[n
] && nasm_isspace(special
[n
]))
377 * We have a size expression; attempt to
380 sym
->type
|= SYM_WITH_SIZE
;
382 stdscan_bufptr
= special
+ n
;
383 tokval
.t_type
= TOKEN_INVALID
;
384 e
= evaluate(stdscan
, NULL
, &tokval
, &fwd
, 0, error
,
389 sym
->name
= nasm_strdup(name
);
392 error(ERR_NONFATAL
, "cannot use relocatable"
393 " expression as symbol size");
395 sym
->size
= reloc_value(e
);
398 stdscan_bufptr
= saveme
; /* bugfix? fbk 8/10/00 */
405 * define the references from external-symbol segment numbers
406 * to these symbol records.
408 if (segment
!= NO_SEG
&& segment
!= stext
.index
&&
409 segment
!= sdata
.index
&& segment
!= sbss
.index
)
410 bsym
= raa_write(bsym
, segment
, nsyms
);
414 if (sym
->type
& SYM_WITH_SIZE
)
415 nsyms
++; /* and another for the size */
417 if (special
&& !special_used
)
418 error(ERR_NONFATAL
, "no special symbol features supported here");
421 static void aout_add_reloc(struct Section
*sect
, int32_t segment
,
422 int reltype
, int bytes
)
426 r
= *sect
->tail
= nasm_malloc(sizeof(struct Reloc
));
427 sect
->tail
= &r
->next
;
430 r
->address
= sect
->len
;
431 r
->symbol
= (segment
== NO_SEG
? -SECT_ABS
:
432 segment
== stext
.index
? -SECT_TEXT
:
433 segment
== sdata
.index
? -SECT_DATA
:
434 segment
== sbss
.index
? -SECT_BSS
:
435 raa_read(bsym
, segment
));
436 r
->reltype
= reltype
;
438 r
->reltype
|= RELTYPE_SYMFLAG
;
445 * This routine deals with ..got and ..sym relocations: the more
446 * complicated kinds. In shared-library writing, some relocations
447 * with respect to global symbols must refer to the precise symbol
448 * rather than referring to an offset from the base of the section
449 * _containing_ the symbol. Such relocations call to this routine,
450 * which searches the symbol list for the symbol in question.
452 * RELTYPE_GOT references require the _exact_ symbol address to be
453 * used; RELTYPE_ABSOLUTE references can be at an offset from the
454 * symbol. The boolean argument `exact' tells us this.
456 * Return value is the adjusted value of `addr', having become an
457 * offset from the symbol rather than the section. Should always be
458 * zero when returning from an exact call.
460 * Limitation: if you define two symbols at the same place,
461 * confusion will occur.
463 * Inefficiency: we search, currently, using a linked list which
464 * isn't even necessarily sorted.
466 static int32_t aout_add_gsym_reloc(struct Section
*sect
,
467 int32_t segment
, int32_t offset
,
468 int type
, int bytes
, int exact
)
470 struct Symbol
*sym
, *sm
, *shead
;
474 * First look up the segment to find whether it's text, data,
475 * bss or an external symbol.
478 if (segment
== stext
.index
)
480 else if (segment
== sdata
.index
)
482 else if (segment
== sbss
.index
)
485 if (exact
&& offset
!= 0)
486 error(ERR_NONFATAL
, "unable to find a suitable global symbol"
487 " for this reference");
489 aout_add_reloc(sect
, segment
, type
, bytes
);
495 * Find a symbol pointing _exactly_ at this one.
497 for (sym
= shead
; sym
; sym
= sym
->next
)
498 if (sym
->value
== offset
)
502 * Find the nearest symbol below this one.
505 for (sm
= shead
; sm
; sm
= sm
->next
)
506 if (sm
->value
<= offset
&& (!sym
|| sm
->value
> sym
->value
))
510 error(ERR_NONFATAL
, "unable to find a suitable global symbol"
511 " for this reference");
515 r
= *sect
->tail
= nasm_malloc(sizeof(struct Reloc
));
516 sect
->tail
= &r
->next
;
519 r
->address
= sect
->len
;
520 r
->symbol
= sym
->symnum
;
521 r
->reltype
= type
| RELTYPE_SYMFLAG
;
526 return offset
- sym
->value
;
530 * This routine deals with ..gotoff relocations. These _must_ refer
531 * to a symbol, due to a perversity of *BSD's PIC implementation,
532 * and it must be a non-global one as well; so we store `asym', the
533 * first nonglobal symbol defined in each section, and always work
534 * from that. Relocation type is always RELTYPE_GOTOFF.
536 * Return value is the adjusted value of `addr', having become an
537 * offset from the `asym' symbol rather than the section.
539 static int32_t aout_add_gotoff_reloc(struct Section
*sect
, int32_t segment
,
540 int32_t offset
, int bytes
)
546 * First look up the segment to find whether it's text, data,
547 * bss or an external symbol.
550 if (segment
== stext
.index
)
552 else if (segment
== sdata
.index
)
554 else if (segment
== sbss
.index
)
557 error(ERR_NONFATAL
, "`..gotoff' relocations require a non-global"
558 " symbol in the section");
560 r
= *sect
->tail
= nasm_malloc(sizeof(struct Reloc
));
561 sect
->tail
= &r
->next
;
564 r
->address
= sect
->len
;
565 r
->symbol
= asym
->symnum
;
566 r
->reltype
= RELTYPE_GOTOFF
;
571 return offset
- asym
->value
;
574 static void aout_out(int32_t segto
, const void *data
,
575 enum out_type type
, uint64_t size
,
576 int32_t segment
, int32_t wrt
)
580 uint8_t mydata
[4], *p
;
583 * handle absolute-assembly (structure definitions)
585 if (segto
== NO_SEG
) {
586 if (type
!= OUT_RESERVE
)
587 error(ERR_NONFATAL
, "attempt to assemble code in [ABSOLUTE]"
592 if (segto
== stext
.index
)
594 else if (segto
== sdata
.index
)
596 else if (segto
== sbss
.index
)
599 error(ERR_WARNING
, "attempt to assemble code in"
600 " segment %d: defaulting to `.text'", segto
);
604 if (!s
&& type
!= OUT_RESERVE
) {
605 error(ERR_WARNING
, "attempt to initialize memory in the"
606 " BSS section: ignored");
607 sbss
.len
+= realsize(type
, size
);
611 if (type
== OUT_RESERVE
) {
613 error(ERR_WARNING
, "uninitialized space declared in"
614 " %s section: zeroing",
615 (segto
== stext
.index
? "code" : "data"));
616 aout_sect_write(s
, NULL
, size
);
619 } else if (type
== OUT_RAWDATA
) {
620 if (segment
!= NO_SEG
)
621 error(ERR_PANIC
, "OUT_RAWDATA with other than NO_SEG");
622 aout_sect_write(s
, data
, size
);
623 } else if (type
== OUT_ADDRESS
) {
624 addr
= *(int64_t *)data
;
625 if (segment
!= NO_SEG
) {
627 error(ERR_NONFATAL
, "a.out format does not support"
628 " segment base references");
631 aout_add_reloc(s
, segment
, RELTYPE_ABSOLUTE
,
635 "Linux a.out format does not support"
637 wrt
= NO_SEG
; /* we can at least _try_ to continue */
638 } else if (wrt
== aout_gotpc_sect
+ 1) {
640 aout_add_reloc(s
, segment
, RELTYPE_GOTPC
, size
);
641 } else if (wrt
== aout_gotoff_sect
+ 1) {
643 addr
= aout_add_gotoff_reloc(s
, segment
,
645 } else if (wrt
== aout_got_sect
+ 1) {
648 aout_add_gsym_reloc(s
, segment
, addr
, RELTYPE_GOT
,
650 } else if (wrt
== aout_sym_sect
+ 1) {
651 addr
= aout_add_gsym_reloc(s
, segment
, addr
,
652 RELTYPE_ABSOLUTE
, size
,
654 } else if (wrt
== aout_plt_sect
+ 1) {
657 "a.out format cannot produce non-PC-"
658 "relative PLT references");
661 "a.out format does not support this"
663 wrt
= NO_SEG
; /* we can at least _try_ to continue */
672 aout_sect_write(s
, mydata
, size
);
673 } else if (type
== OUT_REL2ADR
) {
674 if (segment
== segto
)
675 error(ERR_PANIC
, "intra-segment OUT_REL2ADR");
676 if (segment
!= NO_SEG
&& segment
% 2) {
677 error(ERR_NONFATAL
, "a.out format does not support"
678 " segment base references");
681 aout_add_reloc(s
, segment
, RELTYPE_RELATIVE
, 2);
683 error(ERR_NONFATAL
, "Linux a.out format does not support"
685 wrt
= NO_SEG
; /* we can at least _try_ to continue */
686 } else if (wrt
== aout_plt_sect
+ 1) {
688 aout_add_reloc(s
, segment
, RELTYPE_PLT
, 2);
689 } else if (wrt
== aout_gotpc_sect
+ 1 ||
690 wrt
== aout_gotoff_sect
+ 1 ||
691 wrt
== aout_got_sect
+ 1) {
692 error(ERR_NONFATAL
, "a.out format cannot produce PC-"
693 "relative GOT references");
695 error(ERR_NONFATAL
, "a.out format does not support this"
697 wrt
= NO_SEG
; /* we can at least _try_ to continue */
701 WRITESHORT(p
, *(int64_t *)data
- (size
+ s
->len
));
702 aout_sect_write(s
, mydata
, 2L);
703 } else if (type
== OUT_REL4ADR
) {
704 if (segment
== segto
)
705 error(ERR_PANIC
, "intra-segment OUT_REL4ADR");
706 if (segment
!= NO_SEG
&& segment
% 2) {
707 error(ERR_NONFATAL
, "a.out format does not support"
708 " segment base references");
711 aout_add_reloc(s
, segment
, RELTYPE_RELATIVE
, 4);
713 error(ERR_NONFATAL
, "Linux a.out format does not support"
715 wrt
= NO_SEG
; /* we can at least _try_ to continue */
716 } else if (wrt
== aout_plt_sect
+ 1) {
718 aout_add_reloc(s
, segment
, RELTYPE_PLT
, 4);
719 } else if (wrt
== aout_gotpc_sect
+ 1 ||
720 wrt
== aout_gotoff_sect
+ 1 ||
721 wrt
== aout_got_sect
+ 1) {
722 error(ERR_NONFATAL
, "a.out format cannot produce PC-"
723 "relative GOT references");
725 error(ERR_NONFATAL
, "a.out format does not support this"
727 wrt
= NO_SEG
; /* we can at least _try_ to continue */
731 WRITELONG(p
, *(int64_t *)data
- (size
+ s
->len
));
732 aout_sect_write(s
, mydata
, 4L);
736 static void aout_pad_sections(void)
738 static uint8_t pad
[] = { 0x90, 0x90, 0x90, 0x90 };
740 * Pad each of the text and data sections with NOPs until their
741 * length is a multiple of four. (NOP == 0x90.) Also increase
742 * the length of the BSS section similarly.
744 aout_sect_write(&stext
, pad
, (-(int32_t)stext
.len
) & 3);
745 aout_sect_write(&sdata
, pad
, (-(int32_t)sdata
.len
) & 3);
746 sbss
.len
= (sbss
.len
+ 3) & ~3;
750 * a.out files have the curious property that all references to
751 * things in the data or bss sections are done by addresses which
752 * are actually relative to the start of the _text_ section, in the
753 * _file_. (No relation to what happens after linking. No idea why
754 * this should be so. It's very strange.) So we have to go through
755 * the relocation table, _after_ the final size of each section is
756 * known, and fix up the relocations pointed to.
758 static void aout_fixup_relocs(struct Section
*sect
)
762 saa_rewind(sect
->data
);
763 for (r
= sect
->head
; r
; r
= r
->next
) {
764 uint8_t *p
, *q
, blk
[4];
767 saa_fread(sect
->data
, r
->address
, blk
, (int32_t)r
->bytes
);
771 l
+= ((int32_t)*p
++) << 8;
773 l
+= ((int32_t)*p
++) << 16;
774 l
+= ((int32_t)*p
++) << 24;
777 if (r
->symbol
== -SECT_DATA
)
779 else if (r
->symbol
== -SECT_BSS
)
780 l
+= stext
.len
+ sdata
.len
;
783 else if (r
->bytes
== 2)
787 saa_fwrite(sect
->data
, r
->address
, blk
, (int32_t)r
->bytes
);
791 static void aout_write(void)
794 * Emit the a.out header.
796 /* OMAGIC, M_386 or MID_I386, no flags */
797 fwriteint32_t(bsd
? 0x07018600 | is_pic
: 0x640107L
, aoutfp
);
798 fwriteint32_t(stext
.len
, aoutfp
);
799 fwriteint32_t(sdata
.len
, aoutfp
);
800 fwriteint32_t(sbss
.len
, aoutfp
);
801 fwriteint32_t(nsyms
* 12, aoutfp
); /* length of symbol table */
802 fwriteint32_t(0L, aoutfp
); /* object files have no entry point */
803 fwriteint32_t(stext
.nrelocs
* 8, aoutfp
); /* size of text relocs */
804 fwriteint32_t(sdata
.nrelocs
* 8, aoutfp
); /* size of data relocs */
807 * Write out the code section and the data section.
809 saa_fpwrite(stext
.data
, aoutfp
);
810 saa_fpwrite(sdata
.data
, aoutfp
);
813 * Write out the relocations.
815 aout_write_relocs(stext
.head
);
816 aout_write_relocs(sdata
.head
);
819 * Write the symbol table.
824 * And the string table.
826 fwriteint32_t(strslen
+ 4, aoutfp
); /* length includes length count */
827 saa_fpwrite(strs
, aoutfp
);
830 static void aout_write_relocs(struct Reloc
*r
)
835 fwriteint32_t(r
->address
, aoutfp
);
841 word2
|= r
->reltype
<< 24;
842 word2
|= (r
->bytes
== 1 ? 0 :
843 r
->bytes
== 2 ? 0x2000000L
: 0x4000000L
);
844 fwriteint32_t(word2
, aoutfp
);
850 static void aout_write_syms(void)
855 for (i
= 0; i
< nsyms
; i
++) {
856 struct Symbol
*sym
= saa_rstruct(syms
);
857 fwriteint32_t(sym
->strpos
, aoutfp
);
858 fwriteint32_t((int32_t)sym
->type
& ~SYM_WITH_SIZE
, aoutfp
);
860 * Fix up the symbol value now we know the final section
863 if ((sym
->type
& SECT_MASK
) == SECT_DATA
)
864 sym
->value
+= stext
.len
;
865 if ((sym
->type
& SECT_MASK
) == SECT_BSS
)
866 sym
->value
+= stext
.len
+ sdata
.len
;
867 fwriteint32_t(sym
->value
, aoutfp
);
869 * Output a size record if necessary.
871 if (sym
->type
& SYM_WITH_SIZE
) {
872 fwriteint32_t(sym
->strpos
, aoutfp
);
873 fwriteint32_t(0x0DL
, aoutfp
); /* special value: means size */
874 fwriteint32_t(sym
->size
, aoutfp
);
875 i
++; /* use up another of `nsyms' */
880 static void aout_sect_write(struct Section
*sect
,
881 const uint8_t *data
, uint32_t len
)
883 saa_wbytes(sect
->data
, data
, len
);
887 static int32_t aout_segbase(int32_t segment
)
892 static int aout_directive(char *directive
, char *value
, int pass
)
900 static void aout_filename(char *inname
, char *outname
, efunc error
)
902 standard_extension(inname
, outname
, ".o", error
);
905 extern macros_t aout_stdmac
[];
907 static int aout_set_info(enum geninfo type
, char **val
)
913 #endif /* OF_AOUT || OF_AOUTB */
917 struct ofmt of_aout
= {
918 "Linux a.out object files",
939 struct ofmt of_aoutb
= {
940 "NetBSD/FreeBSD a.out object files",