1 /* ELF object file format
2 Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2,
9 or (at your option) any later version.
11 GAS is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
14 the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 #define OBJ_HEADER "obj-elf.h"
26 #ifndef ECOFF_DEBUGGING
27 #define ECOFF_DEBUGGING 0
29 #define NEED_ECOFF_DEBUG
32 #ifdef NEED_ECOFF_DEBUG
37 #include "elf/alpha.h"
48 static bfd_vma elf_s_get_size
PARAMS ((symbolS
*));
49 static void elf_s_set_size
PARAMS ((symbolS
*, bfd_vma
));
50 static bfd_vma elf_s_get_align
PARAMS ((symbolS
*));
51 static void elf_s_set_align
PARAMS ((symbolS
*, bfd_vma
));
52 static void elf_copy_symbol_attributes
PARAMS ((symbolS
*, symbolS
*));
53 static int elf_sec_sym_ok_for_reloc
PARAMS ((asection
*));
54 static void adjust_stab_sections
PARAMS ((bfd
*, asection
*, PTR
));
56 #ifdef NEED_ECOFF_DEBUG
57 static boolean elf_get_extr
PARAMS ((asymbol
*, EXTR
*));
58 static void elf_set_index
PARAMS ((asymbol
*, bfd_size_type
));
61 static void obj_elf_line
PARAMS ((int));
62 void obj_elf_version
PARAMS ((int));
63 static void obj_elf_size
PARAMS ((int));
64 static void obj_elf_type
PARAMS ((int));
65 static void obj_elf_ident
PARAMS ((int));
66 static void obj_elf_weak
PARAMS ((int));
67 static void obj_elf_local
PARAMS ((int));
68 static void obj_elf_visibility
PARAMS ((int));
69 static void obj_elf_symver
PARAMS ((int));
70 static void obj_elf_vtable_inherit
PARAMS ((int));
71 static void obj_elf_vtable_entry
PARAMS ((int));
72 static void obj_elf_subsection
PARAMS ((int));
73 static void obj_elf_popsection
PARAMS ((int));
75 static const pseudo_typeS elf_pseudo_table
[] =
77 {"comm", obj_elf_common
, 0},
78 {"common", obj_elf_common
, 1},
79 {"ident", obj_elf_ident
, 0},
80 {"local", obj_elf_local
, 0},
81 {"previous", obj_elf_previous
, 0},
82 {"section", obj_elf_section
, 0},
83 {"section.s", obj_elf_section
, 0},
84 {"sect", obj_elf_section
, 0},
85 {"sect.s", obj_elf_section
, 0},
86 {"pushsection", obj_elf_section
, 1},
87 {"popsection", obj_elf_popsection
, 0},
88 {"size", obj_elf_size
, 0},
89 {"type", obj_elf_type
, 0},
90 {"version", obj_elf_version
, 0},
91 {"weak", obj_elf_weak
, 0},
93 /* These define symbol visibility. */
94 {"internal", obj_elf_visibility
, STV_INTERNAL
},
95 {"hidden", obj_elf_visibility
, STV_HIDDEN
},
96 {"protected", obj_elf_visibility
, STV_PROTECTED
},
98 /* These are used for stabs-in-elf configurations. */
99 {"line", obj_elf_line
, 0},
101 /* This is a GNU extension to handle symbol versions. */
102 {"symver", obj_elf_symver
, 0},
104 /* A GNU extension to change subsection only. */
105 {"subsection", obj_elf_subsection
, 0},
107 /* These are GNU extensions to aid in garbage collecting C++ vtables. */
108 {"vtable_inherit", obj_elf_vtable_inherit
, 0},
109 {"vtable_entry", obj_elf_vtable_entry
, 0},
111 /* These are used for dwarf. */
116 /* We need to trap the section changing calls to handle .previous. */
117 {"data", obj_elf_data
, 0},
118 {"text", obj_elf_text
, 0},
124 static const pseudo_typeS ecoff_debug_pseudo_table
[] =
126 #ifdef NEED_ECOFF_DEBUG
127 /* COFF style debugging information for ECOFF. .ln is not used; .loc
129 { "def", ecoff_directive_def
, 0 },
130 { "dim", ecoff_directive_dim
, 0 },
131 { "endef", ecoff_directive_endef
, 0 },
132 { "file", ecoff_directive_file
, 0 },
133 { "scl", ecoff_directive_scl
, 0 },
134 { "tag", ecoff_directive_tag
, 0 },
135 { "val", ecoff_directive_val
, 0 },
137 /* COFF debugging requires pseudo-ops .size and .type, but ELF
138 already has meanings for those. We use .esize and .etype
139 instead. These are only generated by gcc anyhow. */
140 { "esize", ecoff_directive_size
, 0 },
141 { "etype", ecoff_directive_type
, 0 },
143 /* ECOFF specific debugging information. */
144 { "begin", ecoff_directive_begin
, 0 },
145 { "bend", ecoff_directive_bend
, 0 },
146 { "end", ecoff_directive_end
, 0 },
147 { "ent", ecoff_directive_ent
, 0 },
148 { "fmask", ecoff_directive_fmask
, 0 },
149 { "frame", ecoff_directive_frame
, 0 },
150 { "loc", ecoff_directive_loc
, 0 },
151 { "mask", ecoff_directive_mask
, 0 },
153 /* Other ECOFF directives. */
154 { "extern", ecoff_directive_extern
, 0 },
156 /* These are used on Irix. I don't know how to implement them. */
157 { "alias", s_ignore
, 0 },
158 { "bgnb", s_ignore
, 0 },
159 { "endb", s_ignore
, 0 },
160 { "lab", s_ignore
, 0 },
161 { "noalias", s_ignore
, 0 },
162 { "verstamp", s_ignore
, 0 },
163 { "vreg", s_ignore
, 0 },
166 {NULL
, NULL
, 0} /* end sentinel */
170 #include "aout/aout64.h"
172 /* This is called when the assembler starts. */
177 /* Add symbols for the known sections to the symbol table. */
178 symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput
,
179 TEXT_SECTION_NAME
)));
180 symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput
,
181 DATA_SECTION_NAME
)));
182 symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput
,
189 pop_insert (elf_pseudo_table
);
191 pop_insert (ecoff_debug_pseudo_table
);
198 return S_GET_SIZE (sym
);
202 elf_s_set_size (sym
, sz
)
206 S_SET_SIZE (sym
, sz
);
210 elf_s_get_align (sym
)
213 return S_GET_ALIGN (sym
);
217 elf_s_set_align (sym
, align
)
221 S_SET_ALIGN (sym
, align
);
225 elf_copy_symbol_attributes (dest
, src
)
228 OBJ_COPY_SYMBOL_ATTRIBUTES (dest
, src
);
232 elf_sec_sym_ok_for_reloc (sec
)
235 return obj_sec_sym_ok_for_reloc (sec
);
244 sym
= symbol_new (s
, absolute_section
, (valueT
) 0, (struct frag
*) 0);
245 symbol_set_frag (sym
, &zero_address_frag
);
246 symbol_get_bfdsym (sym
)->flags
|= BSF_FILE
;
248 if (symbol_rootP
!= sym
)
250 symbol_remove (sym
, &symbol_rootP
, &symbol_lastP
);
251 symbol_insert (sym
, symbol_rootP
, &symbol_rootP
, &symbol_lastP
);
253 verify_symbol_chain (symbol_rootP
, symbol_lastP
);
257 #ifdef NEED_ECOFF_DEBUG
263 obj_elf_common (is_common
)
273 if (flag_mri
&& is_common
)
279 name
= input_line_pointer
;
280 c
= get_symbol_end ();
281 /* just after name is now '\0' */
282 p
= input_line_pointer
;
285 if (*input_line_pointer
!= ',')
287 as_bad (_("Expected comma after symbol-name"));
288 ignore_rest_of_line ();
291 input_line_pointer
++; /* skip ',' */
292 if ((temp
= get_absolute_expression ()) < 0)
294 as_bad (_(".COMMon length (%d.) <0! Ignored."), temp
);
295 ignore_rest_of_line ();
300 symbolP
= symbol_find_or_make (name
);
302 if (S_IS_DEFINED (symbolP
) && ! S_IS_COMMON (symbolP
))
304 as_bad (_("Ignoring attempt to re-define symbol"));
305 ignore_rest_of_line ();
308 if (S_GET_VALUE (symbolP
) != 0)
310 if (S_GET_VALUE (symbolP
) != (valueT
) size
)
312 as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."),
313 S_GET_NAME (symbolP
), (long) S_GET_VALUE (symbolP
), size
);
316 know (symbolP
->sy_frag
== &zero_address_frag
);
317 if (*input_line_pointer
!= ',')
322 input_line_pointer
++;
325 if (! have_align
|| *input_line_pointer
!= '"')
331 temp
= get_absolute_expression ();
335 as_warn (_("Common alignment negative; 0 assumed"));
338 if (symbol_get_obj (symbolP
)->local
)
347 old_subsec
= now_subseg
;
350 /* convert to a power of 2 alignment */
351 for (align
= 0; (temp
& 1) == 0; temp
>>= 1, ++align
);
354 as_bad (_("Common alignment not a power of 2"));
355 ignore_rest_of_line ();
361 record_alignment (bss_section
, align
);
362 subseg_set (bss_section
, 0);
364 frag_align (align
, 0, 0);
365 if (S_GET_SEGMENT (symbolP
) == bss_section
)
366 symbol_get_frag (symbolP
)->fr_symbol
= 0;
367 symbol_set_frag (symbolP
, frag_now
);
368 pfrag
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, symbolP
,
369 (offsetT
) size
, (char *) 0);
371 S_SET_SIZE (symbolP
, size
);
372 S_SET_SEGMENT (symbolP
, bss_section
);
373 S_CLEAR_EXTERNAL (symbolP
);
374 subseg_set (old_sec
, old_subsec
);
379 S_SET_VALUE (symbolP
, (valueT
) size
);
380 S_SET_ALIGN (symbolP
, temp
);
381 S_SET_EXTERNAL (symbolP
);
382 S_SET_SEGMENT (symbolP
, bfd_com_section_ptr
);
387 input_line_pointer
++;
388 /* @@ Some use the dot, some don't. Can we get some consistency?? */
389 if (*input_line_pointer
== '.')
390 input_line_pointer
++;
391 /* @@ Some say data, some say bss. */
392 if (strncmp (input_line_pointer
, "bss\"", 4)
393 && strncmp (input_line_pointer
, "data\"", 5))
395 while (*--input_line_pointer
!= '"')
397 input_line_pointer
--;
398 goto bad_common_segment
;
400 while (*input_line_pointer
++ != '"')
402 goto allocate_common
;
405 symbol_get_bfdsym (symbolP
)->flags
|= BSF_OBJECT
;
407 demand_empty_rest_of_line ();
412 p
= input_line_pointer
;
413 while (*p
&& *p
!= '\n')
417 as_bad (_("bad .common segment %s"), input_line_pointer
+ 1);
419 input_line_pointer
= p
;
420 ignore_rest_of_line ();
426 obj_elf_local (ignore
)
427 int ignore ATTRIBUTE_UNUSED
;
435 name
= input_line_pointer
;
436 c
= get_symbol_end ();
437 symbolP
= symbol_find_or_make (name
);
438 *input_line_pointer
= c
;
440 S_CLEAR_EXTERNAL (symbolP
);
441 symbol_get_obj (symbolP
)->local
= 1;
444 input_line_pointer
++;
446 if (*input_line_pointer
== '\n')
451 demand_empty_rest_of_line ();
455 obj_elf_weak (ignore
)
456 int ignore ATTRIBUTE_UNUSED
;
464 name
= input_line_pointer
;
465 c
= get_symbol_end ();
466 symbolP
= symbol_find_or_make (name
);
467 *input_line_pointer
= c
;
469 S_SET_WEAK (symbolP
);
470 symbol_get_obj (symbolP
)->local
= 1;
473 input_line_pointer
++;
475 if (*input_line_pointer
== '\n')
480 demand_empty_rest_of_line ();
484 obj_elf_visibility (visibility
)
491 elf_symbol_type
*elfsym
;
495 name
= input_line_pointer
;
496 c
= get_symbol_end ();
497 symbolP
= symbol_find_or_make (name
);
498 *input_line_pointer
= c
;
502 bfdsym
= symbol_get_bfdsym (symbolP
);
503 elfsym
= elf_symbol_from (bfd_asymbol_bfd (bfdsym
), bfdsym
);
507 elfsym
->internal_elf_sym
.st_other
= visibility
;
511 input_line_pointer
++;
515 if (*input_line_pointer
== '\n')
521 demand_empty_rest_of_line ();
525 static segT previous_section
;
526 static int previous_subsection
;
530 struct section_stack
*next
;
532 int subseg
, prev_subseg
;
535 static struct section_stack
*section_stack
;
538 /* Handle the .section pseudo-op. This code supports two different
541 The first is found on Solaris, and looks like
542 .section ".sec1",#alloc,#execinstr,#write
543 Here the names after '#' are the SHF_* flags to turn on for the
544 section. I'm not sure how it determines the SHT_* type (BFD
545 doesn't really give us control over the type, anyhow).
547 The second format is found on UnixWare, and probably most SVR4
548 machines, and looks like
549 .section .sec1,"a",@progbits
550 The quoted string may contain any combination of a, w, x, and
551 represents the SHF_* flags to turn on for the section. The string
552 beginning with '@' can be progbits or nobits. There should be
553 other possibilities, but I don't know what they are. In any case,
554 BFD doesn't really let us set the section type. */
556 /* Certain named sections have particular defined types, listed on p.
558 struct special_section
565 static struct special_section
const special_sections
[] =
567 { ".bss", SHT_NOBITS
, SHF_ALLOC
+ SHF_WRITE
},
568 { ".comment", SHT_PROGBITS
, 0 },
569 { ".data", SHT_PROGBITS
, SHF_ALLOC
+ SHF_WRITE
},
570 { ".data1", SHT_PROGBITS
, SHF_ALLOC
+ SHF_WRITE
},
571 { ".debug", SHT_PROGBITS
, 0 },
572 { ".fini", SHT_PROGBITS
, SHF_ALLOC
+ SHF_EXECINSTR
},
573 { ".init", SHT_PROGBITS
, SHF_ALLOC
+ SHF_EXECINSTR
},
574 { ".line", SHT_PROGBITS
, 0 },
575 { ".note", SHT_NOTE
, 0 },
576 { ".rodata", SHT_PROGBITS
, SHF_ALLOC
},
577 { ".rodata1", SHT_PROGBITS
, SHF_ALLOC
},
578 { ".text", SHT_PROGBITS
, SHF_ALLOC
+ SHF_EXECINSTR
},
580 #ifdef ELF_TC_SPECIAL_SECTIONS
581 ELF_TC_SPECIAL_SECTIONS
585 /* The following section names are special, but they can not
586 reasonably appear in assembler code. Some of the attributes are
587 processor dependent. */
588 { ".dynamic", SHT_DYNAMIC
, SHF_ALLOC
/* + SHF_WRITE */ },
589 { ".dynstr", SHT_STRTAB
, SHF_ALLOC
},
590 { ".dynsym", SHT_DYNSYM
, SHF_ALLOC
},
591 { ".got", SHT_PROGBITS
, 0 },
592 { ".hash", SHT_HASH
, SHF_ALLOC
},
593 { ".interp", SHT_PROGBITS
, /* SHF_ALLOC */ },
594 { ".plt", SHT_PROGBITS
, 0 },
595 { ".shstrtab",SHT_STRTAB
, 0 },
596 { ".strtab", SHT_STRTAB
, /* SHF_ALLOC */ },
597 { ".symtab", SHT_SYMTAB
, /* SHF_ALLOC */ },
604 obj_elf_change_section (name
, type
, attr
, push
)
606 int type
, attr
, push
;
611 #ifdef md_flush_pending_output
612 md_flush_pending_output ();
615 /* Switch to the section, creating it if necessary. */
618 struct section_stack
*elt
;
619 elt
= xmalloc (sizeof (struct section_stack
));
620 elt
->next
= section_stack
;
622 elt
->prev_seg
= previous_section
;
623 elt
->subseg
= now_subseg
;
624 elt
->prev_subseg
= previous_subsection
;
627 previous_section
= now_seg
;
628 previous_subsection
= now_subseg
;
630 new_sec
= bfd_get_section_by_name (stdoutput
, name
) == NULL
;
631 sec
= subseg_new (name
, 0);
639 /* See if this is one of the special sections. */
640 for (i
= 0; special_sections
[i
].name
!= NULL
; i
++)
641 if (strcmp (name
, special_sections
[i
].name
) == 0)
643 if (type
== SHT_NULL
)
644 type
= special_sections
[i
].type
;
645 else if (type
!= special_sections
[i
].type
)
646 as_warn (_("Setting incorrect section type for %s"), name
);
648 if ((attr
&~ special_sections
[i
].attributes
) != 0)
650 /* As a GNU extension, we permit a .note section to be
651 allocatable. If the linker sees an allocateable .note
652 section, it will create a PT_NOTE segment in the output
654 if (strcmp (name
, ".note") != 0
655 || attr
!= SHF_ALLOC
)
656 as_warn (_("Setting incorrect section attributes for %s"),
659 attr
|= special_sections
[i
].attributes
;
663 /* Convert ELF type and flags to BFD flags. */
665 | ((attr
& SHF_WRITE
) ? 0 : SEC_READONLY
)
666 | ((attr
& SHF_ALLOC
) ? SEC_ALLOC
: 0)
667 | (((attr
& SHF_ALLOC
) && type
!= SHT_NOBITS
) ? SEC_LOAD
: 0)
668 | ((attr
& SHF_EXECINSTR
) ? SEC_CODE
: 0));
669 #ifdef md_elf_section_flags
670 flags
= md_elf_section_flags (flags
, attr
, type
);
673 /* Prevent SEC_HAS_CONTENTS from being inadvertently set. */
674 if (type
== SHT_NOBITS
)
675 seg_info (sec
)->bss
= 1;
677 bfd_set_section_flags (stdoutput
, sec
, flags
);
679 /* Add a symbol for this section to the symbol table. */
680 secsym
= symbol_find (name
);
682 symbol_set_bfdsym (secsym
, sec
->symbol
);
684 symbol_table_insert (section_symbol (sec
));
687 #ifdef md_elf_section_change_hook
688 md_elf_section_change_hook ();
693 obj_elf_parse_section_letters (str
, len
)
710 attr
|= SHF_EXECINSTR
;
714 char *bad_msg
= _("Unrecognized .section attribute: want a,w,x");
715 #ifdef md_elf_section_letter
716 int md_attr
= md_elf_section_letter (*str
, &bad_msg
);
735 obj_elf_section_word (str
, len
)
739 if (len
== 5 && strncmp (str
, "write", 5) == 0)
741 if (len
== 5 && strncmp (str
, "alloc", 5) == 0)
743 if (len
== 9 && strncmp (str
, "execinstr", 9) == 0)
744 return SHF_EXECINSTR
;
746 #ifdef md_elf_section_word
748 int md_attr
= md_elf_section_word (str
, len
);
754 as_warn (_("Unrecognized section attribute"));
759 obj_elf_section_type (str
, len
)
763 if (len
== 8 && strncmp (str
, "progbits", 8) == 0)
765 if (len
== 6 && strncmp (str
, "nobits", 6) == 0)
768 #ifdef md_elf_section_type
770 int md_type
= md_elf_section_type (str
, len
);
776 as_warn (_("Unrecognized section type"));
781 obj_elf_section (push
)
784 char *name
, *beg
, *end
;
785 int type
, attr
, dummy
;
791 #ifdef md_flush_pending_output
792 md_flush_pending_output ();
795 previous_section
= now_seg
;
796 previous_subsection
= now_subseg
;
798 s_mri_sect (&mri_type
);
800 #ifdef md_elf_section_change_hook
801 md_elf_section_change_hook ();
807 /* Get name of section. */
809 if (*input_line_pointer
== '"')
811 name
= demand_copy_C_string (&dummy
);
814 ignore_rest_of_line ();
820 end
= input_line_pointer
;
821 while (0 == strchr ("\n\t,; ", *end
))
823 if (end
== input_line_pointer
)
825 as_warn (_("Missing section name"));
826 ignore_rest_of_line ();
830 name
= xmalloc (end
- input_line_pointer
+ 1);
831 memcpy (name
, input_line_pointer
, end
- input_line_pointer
);
832 name
[end
- input_line_pointer
] = '\0';
833 input_line_pointer
= end
;
840 if (*input_line_pointer
== ',')
842 /* Skip the comma. */
843 ++input_line_pointer
;
846 if (*input_line_pointer
== '"')
848 beg
= demand_copy_C_string (&dummy
);
851 ignore_rest_of_line ();
854 attr
|= obj_elf_parse_section_letters (beg
, strlen (beg
));
857 if (*input_line_pointer
== ',')
860 ++input_line_pointer
;
862 c
= *input_line_pointer
;
865 beg
= demand_copy_C_string (&dummy
);
868 ignore_rest_of_line ();
871 type
= obj_elf_section_type (beg
, strlen (beg
));
873 else if (c
== '@' || c
== '%')
875 beg
= ++input_line_pointer
;
876 c
= get_symbol_end ();
877 *input_line_pointer
= c
;
878 type
= obj_elf_section_type (beg
, input_line_pointer
- beg
);
889 if (*input_line_pointer
!= '#')
891 as_warn (_("Bad .section directive - character following name is not '#'"));
892 ignore_rest_of_line ();
895 beg
= ++input_line_pointer
;
896 c
= get_symbol_end ();
897 *input_line_pointer
= c
;
899 attr
|= obj_elf_section_word (beg
, input_line_pointer
- beg
);
903 while (*input_line_pointer
++ == ',');
904 --input_line_pointer
;
908 demand_empty_rest_of_line ();
910 obj_elf_change_section (name
, type
, attr
, push
);
913 /* Change to the .data section. */
919 #ifdef md_flush_pending_output
920 md_flush_pending_output ();
923 previous_section
= now_seg
;
924 previous_subsection
= now_subseg
;
927 #ifdef md_elf_section_change_hook
928 md_elf_section_change_hook ();
932 /* Change to the .text section. */
938 #ifdef md_flush_pending_output
939 md_flush_pending_output ();
942 previous_section
= now_seg
;
943 previous_subsection
= now_subseg
;
946 #ifdef md_elf_section_change_hook
947 md_elf_section_change_hook ();
952 obj_elf_subsection (ignore
)
953 int ignore ATTRIBUTE_UNUSED
;
957 #ifdef md_flush_pending_output
958 md_flush_pending_output ();
961 previous_section
= now_seg
;
962 previous_subsection
= now_subseg
;
964 temp
= get_absolute_expression ();
965 subseg_set (now_seg
, (subsegT
) temp
);
966 demand_empty_rest_of_line ();
968 #ifdef md_elf_section_change_hook
969 md_elf_section_change_hook ();
973 /* This can be called from the processor backends if they change
977 obj_elf_section_change_hook ()
979 previous_section
= now_seg
;
980 previous_subsection
= now_subseg
;
984 obj_elf_previous (ignore
)
985 int ignore ATTRIBUTE_UNUSED
;
990 if (previous_section
== 0)
992 as_bad (_(".previous without corresponding .section; ignored"));
996 #ifdef md_flush_pending_output
997 md_flush_pending_output ();
1000 new_section
= previous_section
;
1001 new_subsection
= previous_subsection
;
1002 previous_section
= now_seg
;
1003 previous_subsection
= now_subseg
;
1004 subseg_set (new_section
, new_subsection
);
1006 #ifdef md_elf_section_change_hook
1007 md_elf_section_change_hook ();
1012 obj_elf_popsection (xxx
)
1013 int xxx ATTRIBUTE_UNUSED
;
1015 struct section_stack
*top
= section_stack
;
1019 as_bad (_(".popsection without corresponding .pushsection; ignored"));
1023 #ifdef md_flush_pending_output
1024 md_flush_pending_output ();
1027 section_stack
= top
->next
;
1028 previous_section
= top
->prev_seg
;
1029 previous_subsection
= top
->prev_subseg
;
1030 subseg_set (top
->seg
, top
->subseg
);
1033 #ifdef md_elf_section_change_hook
1034 md_elf_section_change_hook ();
1039 obj_elf_line (ignore
)
1040 int ignore ATTRIBUTE_UNUSED
;
1042 /* Assume delimiter is part of expression. BSD4.2 as fails with
1043 delightful bug, so we are not being incompatible here. */
1044 new_logical_line ((char *) NULL
, (int) (get_absolute_expression ()));
1045 demand_empty_rest_of_line ();
1048 /* This handles the .symver pseudo-op, which is used to specify a
1049 symbol version. The syntax is ``.symver NAME,SYMVERNAME''.
1050 SYMVERNAME may contain ELF_VER_CHR ('@') characters. This
1051 pseudo-op causes the assembler to emit a symbol named SYMVERNAME
1052 with the same value as the symbol NAME. */
1055 obj_elf_symver (ignore
)
1056 int ignore ATTRIBUTE_UNUSED
;
1062 name
= input_line_pointer
;
1063 c
= get_symbol_end ();
1065 sym
= symbol_find_or_make (name
);
1067 *input_line_pointer
= c
;
1069 if (symbol_get_obj (sym
)->versioned_name
!= NULL
)
1071 as_bad (_("multiple .symver directives for symbol `%s'"),
1073 ignore_rest_of_line ();
1078 if (*input_line_pointer
!= ',')
1080 as_bad (_("expected comma after name in .symver"));
1081 ignore_rest_of_line ();
1085 ++input_line_pointer
;
1086 name
= input_line_pointer
;
1089 c
= get_symbol_end ();
1090 if (c
!= ELF_VER_CHR
)
1092 *input_line_pointer
++ = c
;
1095 symbol_get_obj (sym
)->versioned_name
= xstrdup (name
);
1097 *input_line_pointer
= c
;
1099 if (strchr (symbol_get_obj (sym
)->versioned_name
, ELF_VER_CHR
) == NULL
)
1101 as_bad (_("missing version name in `%s' for symbol `%s'"),
1102 symbol_get_obj (sym
)->versioned_name
, S_GET_NAME (sym
));
1103 ignore_rest_of_line ();
1107 demand_empty_rest_of_line ();
1110 /* This handles the .vtable_inherit pseudo-op, which is used to indicate
1111 to the linker the hierarchy in which a particular table resides. The
1112 syntax is ".vtable_inherit CHILDNAME, PARENTNAME". */
1115 obj_elf_vtable_inherit (ignore
)
1116 int ignore ATTRIBUTE_UNUSED
;
1118 char *cname
, *pname
;
1119 symbolS
*csym
, *psym
;
1122 if (*input_line_pointer
== '#')
1123 ++input_line_pointer
;
1125 cname
= input_line_pointer
;
1126 c
= get_symbol_end ();
1127 csym
= symbol_find (cname
);
1129 /* GCFIXME: should check that we don't have two .vtable_inherits for
1130 the same child symbol. Also, we can currently only do this if the
1131 child symbol is already exists and is placed in a fragment. */
1133 if (csym
== NULL
|| symbol_get_frag (csym
) == NULL
)
1135 as_bad ("expected `%s' to have already been set for .vtable_inherit",
1140 *input_line_pointer
= c
;
1143 if (*input_line_pointer
!= ',')
1145 as_bad ("expected comma after name in .vtable_inherit");
1146 ignore_rest_of_line ();
1150 ++input_line_pointer
;
1153 if (*input_line_pointer
== '#')
1154 ++input_line_pointer
;
1156 if (input_line_pointer
[0] == '0'
1157 && (input_line_pointer
[1] == '\0'
1158 || isspace ((unsigned char) input_line_pointer
[1])))
1160 psym
= section_symbol (absolute_section
);
1161 ++input_line_pointer
;
1165 pname
= input_line_pointer
;
1166 c
= get_symbol_end ();
1167 psym
= symbol_find_or_make (pname
);
1168 *input_line_pointer
= c
;
1171 demand_empty_rest_of_line ();
1176 assert (symbol_get_value_expression (csym
)->X_op
== O_constant
);
1177 fix_new (symbol_get_frag (csym
),
1178 symbol_get_value_expression (csym
)->X_add_number
, 0, psym
, 0, 0,
1179 BFD_RELOC_VTABLE_INHERIT
);
1182 /* This handles the .vtable_entry pseudo-op, which is used to indicate
1183 to the linker that a vtable slot was used. The syntax is
1184 ".vtable_entry tablename, offset". */
1187 obj_elf_vtable_entry (ignore
)
1188 int ignore ATTRIBUTE_UNUSED
;
1195 if (*input_line_pointer
== '#')
1196 ++input_line_pointer
;
1198 name
= input_line_pointer
;
1199 c
= get_symbol_end ();
1200 sym
= symbol_find_or_make (name
);
1201 *input_line_pointer
= c
;
1204 if (*input_line_pointer
!= ',')
1206 as_bad ("expected comma after name in .vtable_entry");
1207 ignore_rest_of_line ();
1211 ++input_line_pointer
;
1212 if (*input_line_pointer
== '#')
1213 ++input_line_pointer
;
1215 offset
= get_absolute_expression ();
1217 fix_new (frag_now
, frag_now_fix (), 0, sym
, offset
, 0,
1218 BFD_RELOC_VTABLE_ENTRY
);
1220 demand_empty_rest_of_line ();
1224 obj_read_begin_hook ()
1226 #ifdef NEED_ECOFF_DEBUG
1227 if (ECOFF_DEBUGGING
)
1228 ecoff_read_begin_hook ();
1233 obj_symbol_new_hook (symbolP
)
1236 struct elf_obj_sy
*sy_obj
;
1238 sy_obj
= symbol_get_obj (symbolP
);
1239 sy_obj
->size
= NULL
;
1240 sy_obj
->versioned_name
= NULL
;
1242 #ifdef NEED_ECOFF_DEBUG
1243 if (ECOFF_DEBUGGING
)
1244 ecoff_symbol_new_hook (symbolP
);
1249 obj_elf_version (ignore
)
1250 int ignore ATTRIBUTE_UNUSED
;
1256 asection
*seg
= now_seg
;
1257 subsegT subseg
= now_subseg
;
1258 Elf_Internal_Note i_note
;
1259 Elf_External_Note e_note
;
1260 asection
*note_secp
= (asection
*) NULL
;
1264 if (*input_line_pointer
== '\"')
1266 ++input_line_pointer
; /* -> 1st char of string. */
1267 name
= input_line_pointer
;
1269 while (is_a_char (c
= next_char_of_string ()))
1271 c
= *input_line_pointer
;
1272 *input_line_pointer
= '\0';
1273 *(input_line_pointer
- 1) = '\0';
1274 *input_line_pointer
= c
;
1276 /* create the .note section */
1278 note_secp
= subseg_new (".note", 0);
1279 bfd_set_section_flags (stdoutput
,
1281 SEC_HAS_CONTENTS
| SEC_READONLY
);
1283 /* process the version string */
1285 len
= strlen (name
);
1287 i_note
.namesz
= ((len
+ 1) + 3) & ~3; /* round this to word boundary */
1288 i_note
.descsz
= 0; /* no description */
1289 i_note
.type
= NT_VERSION
;
1290 p
= frag_more (sizeof (e_note
.namesz
));
1291 md_number_to_chars (p
, (valueT
) i_note
.namesz
, 4);
1292 p
= frag_more (sizeof (e_note
.descsz
));
1293 md_number_to_chars (p
, (valueT
) i_note
.descsz
, 4);
1294 p
= frag_more (sizeof (e_note
.type
));
1295 md_number_to_chars (p
, (valueT
) i_note
.type
, 4);
1297 for (i
= 0; i
< len
; i
++)
1301 FRAG_APPEND_1_CHAR (ch
);
1304 frag_align (2, 0, 0);
1306 subseg_set (seg
, subseg
);
1310 as_bad (_("Expected quoted string"));
1312 demand_empty_rest_of_line ();
1316 obj_elf_size (ignore
)
1317 int ignore ATTRIBUTE_UNUSED
;
1319 char *name
= input_line_pointer
;
1320 char c
= get_symbol_end ();
1325 p
= input_line_pointer
;
1328 if (*input_line_pointer
!= ',')
1331 as_bad (_("expected comma after name `%s' in .size directive"), name
);
1333 ignore_rest_of_line ();
1336 input_line_pointer
++;
1338 if (exp
.X_op
== O_absent
)
1340 as_bad (_("missing expression in .size directive"));
1341 exp
.X_op
= O_constant
;
1342 exp
.X_add_number
= 0;
1345 sym
= symbol_find_or_make (name
);
1347 if (exp
.X_op
== O_constant
)
1348 S_SET_SIZE (sym
, exp
.X_add_number
);
1351 symbol_get_obj (sym
)->size
=
1352 (expressionS
*) xmalloc (sizeof (expressionS
));
1353 *symbol_get_obj (sym
)->size
= exp
;
1355 demand_empty_rest_of_line ();
1358 /* Handle the ELF .type pseudo-op. This sets the type of a symbol.
1359 There are four syntaxes:
1361 The first (used on Solaris) is
1363 The second (used on UnixWare) is
1365 The third (reportedly to be used on Irix 6.0) is
1367 The fourth (used on NetBSD/Arm and Linux/ARM) is
1372 obj_elf_type (ignore
)
1373 int ignore ATTRIBUTE_UNUSED
;
1378 const char *typename
;
1381 name
= input_line_pointer
;
1382 c
= get_symbol_end ();
1383 sym
= symbol_find_or_make (name
);
1384 *input_line_pointer
= c
;
1387 if (*input_line_pointer
== ',')
1388 ++input_line_pointer
;
1391 if ( *input_line_pointer
== '#'
1392 || *input_line_pointer
== '@'
1393 || *input_line_pointer
== '%')
1394 ++input_line_pointer
;
1396 typename
= input_line_pointer
;
1397 c
= get_symbol_end ();
1400 if (strcmp (typename
, "function") == 0
1401 || strcmp (typename
, "STT_FUNC") == 0)
1402 type
= BSF_FUNCTION
;
1403 else if (strcmp (typename
, "object") == 0
1404 || strcmp (typename
, "STT_OBJECT") == 0)
1407 as_bad (_("ignoring unrecognized symbol type \"%s\""), typename
);
1409 *input_line_pointer
= c
;
1411 symbol_get_bfdsym (sym
)->flags
|= type
;
1413 demand_empty_rest_of_line ();
1417 obj_elf_ident (ignore
)
1418 int ignore ATTRIBUTE_UNUSED
;
1420 static segT comment_section
;
1421 segT old_section
= now_seg
;
1422 int old_subsection
= now_subseg
;
1424 #ifdef md_flush_pending_output
1425 md_flush_pending_output ();
1428 if (!comment_section
)
1431 comment_section
= subseg_new (".comment", 0);
1432 bfd_set_section_flags (stdoutput
, comment_section
,
1433 SEC_READONLY
| SEC_HAS_CONTENTS
);
1438 subseg_set (comment_section
, 0);
1440 subseg_set (old_section
, old_subsection
);
1443 #ifdef INIT_STAB_SECTION
1445 /* The first entry in a .stabs section is special. */
1448 obj_elf_init_stab_section (seg
)
1454 unsigned int stroff
;
1456 /* Force the section to align to a longword boundary. Without this,
1457 UnixWare ar crashes. */
1458 bfd_set_section_alignment (stdoutput
, seg
, 2);
1460 /* Make space for this first symbol. */
1464 as_where (&file
, (unsigned int *) NULL
);
1465 stabstr_name
= (char *) alloca (strlen (segment_name (seg
)) + 4);
1466 strcpy (stabstr_name
, segment_name (seg
));
1467 strcat (stabstr_name
, "str");
1468 stroff
= get_stab_string_offset (file
, stabstr_name
);
1470 md_number_to_chars (p
, stroff
, 4);
1471 seg_info (seg
)->stabu
.p
= p
;
1476 /* Fill in the counts in the first entry in a .stabs section. */
1479 adjust_stab_sections (abfd
, sec
, xxx
)
1482 PTR xxx ATTRIBUTE_UNUSED
;
1489 if (strncmp (".stab", sec
->name
, 5))
1491 if (!strcmp ("str", sec
->name
+ strlen (sec
->name
) - 3))
1494 name
= (char *) alloca (strlen (sec
->name
) + 4);
1495 strcpy (name
, sec
->name
);
1496 strcat (name
, "str");
1497 strsec
= bfd_get_section_by_name (abfd
, name
);
1499 strsz
= bfd_section_size (abfd
, strsec
);
1502 nsyms
= bfd_section_size (abfd
, sec
) / 12 - 1;
1504 p
= seg_info (sec
)->stabu
.p
;
1507 bfd_h_put_16 (abfd
, (bfd_vma
) nsyms
, (bfd_byte
*) p
+ 6);
1508 bfd_h_put_32 (abfd
, (bfd_vma
) strsz
, (bfd_byte
*) p
+ 8);
1511 #ifdef NEED_ECOFF_DEBUG
1513 /* This function is called by the ECOFF code. It is supposed to
1514 record the external symbol information so that the backend can
1515 write it out correctly. The ELF backend doesn't actually handle
1516 this at the moment, so we do it ourselves. We save the information
1520 elf_ecoff_set_ext (sym
, ext
)
1522 struct ecoff_extr
*ext
;
1524 symbol_get_bfdsym (sym
)->udata
.p
= (PTR
) ext
;
1527 /* This function is called by bfd_ecoff_debug_externals. It is
1528 supposed to *EXT to the external symbol information, and return
1529 whether the symbol should be used at all. */
1532 elf_get_extr (sym
, ext
)
1536 if (sym
->udata
.p
== NULL
)
1538 *ext
= *(EXTR
*) sym
->udata
.p
;
1542 /* This function is called by bfd_ecoff_debug_externals. It has
1543 nothing to do for ELF. */
1547 elf_set_index (sym
, indx
)
1548 asymbol
*sym ATTRIBUTE_UNUSED
;
1549 bfd_size_type indx ATTRIBUTE_UNUSED
;
1553 #endif /* NEED_ECOFF_DEBUG */
1556 elf_frob_symbol (symp
, puntp
)
1560 struct elf_obj_sy
*sy_obj
;
1562 #ifdef NEED_ECOFF_DEBUG
1563 if (ECOFF_DEBUGGING
)
1564 ecoff_frob_symbol (symp
);
1567 sy_obj
= symbol_get_obj (symp
);
1569 if (sy_obj
->size
!= NULL
)
1571 switch (sy_obj
->size
->X_op
)
1575 (S_GET_VALUE (sy_obj
->size
->X_add_symbol
)
1576 + sy_obj
->size
->X_add_number
1577 - S_GET_VALUE (sy_obj
->size
->X_op_symbol
)));
1581 (S_GET_VALUE (sy_obj
->size
->X_add_symbol
)
1582 + sy_obj
->size
->X_add_number
));
1585 as_bad (_(".size expression too complicated to fix up"));
1588 free (sy_obj
->size
);
1589 sy_obj
->size
= NULL
;
1592 if (sy_obj
->versioned_name
!= NULL
)
1594 /* This symbol was given a new name with the .symver directive.
1596 If this is an external reference, just rename the symbol to
1597 include the version string. This will make the relocs be
1598 against the correct versioned symbol.
1600 If this is a definition, add an alias. FIXME: Using an alias
1601 will permit the debugging information to refer to the right
1602 symbol. However, it's not clear whether it is the best
1605 if (! S_IS_DEFINED (symp
))
1609 /* Verify that the name isn't using the @@ syntax--this is
1610 reserved for definitions of the default version to link
1612 p
= strchr (sy_obj
->versioned_name
, ELF_VER_CHR
);
1614 if (p
[1] == ELF_VER_CHR
)
1616 as_bad (_("invalid attempt to declare external version name as default in symbol `%s'"),
1617 sy_obj
->versioned_name
);
1620 S_SET_NAME (symp
, sy_obj
->versioned_name
);
1626 /* FIXME: Creating a new symbol here is risky. We're in the
1627 final loop over the symbol table. We can get away with
1628 it only because the symbol goes to the end of the list,
1629 where the loop will still see it. It would probably be
1630 better to do this in obj_frob_file_before_adjust. */
1632 symp2
= symbol_find_or_make (sy_obj
->versioned_name
);
1634 /* Now we act as though we saw symp2 = sym. */
1636 S_SET_SEGMENT (symp2
, S_GET_SEGMENT (symp
));
1638 /* Subtracting out the frag address here is a hack because
1639 we are in the middle of the final loop. */
1642 - symbol_get_frag (symp
)->fr_address
));
1644 symbol_set_frag (symp2
, symbol_get_frag (symp
));
1646 /* This will copy over the size information. */
1647 copy_symbol_attributes (symp2
, symp
);
1649 if (S_IS_WEAK (symp
))
1652 if (S_IS_EXTERNAL (symp
))
1653 S_SET_EXTERNAL (symp2
);
1657 /* Double check weak symbols. */
1658 if (S_IS_WEAK (symp
))
1660 if (S_IS_COMMON (symp
))
1661 as_bad (_("Symbol `%s' can not be both weak and common"),
1666 /* The Irix 5 and 6 assemblers set the type of any common symbol and
1667 any undefined non-function symbol to STT_OBJECT. We try to be
1668 compatible, since newer Irix 5 and 6 linkers care. However, we
1669 only set undefined symbols to be STT_OBJECT if we are on Irix,
1670 because that is the only time gcc will generate the necessary
1671 .global directives to mark functions. */
1673 if (S_IS_COMMON (symp
))
1674 symbol_get_bfdsym (symp
)->flags
|= BSF_OBJECT
;
1676 if (strstr (TARGET_OS
, "irix") != NULL
1677 && ! S_IS_DEFINED (symp
)
1678 && (symbol_get_bfdsym (symp
)->flags
& BSF_FUNCTION
) == 0)
1679 symbol_get_bfdsym (symp
)->flags
|= BSF_OBJECT
;
1683 /* Frob the PowerPC, so that the symbol always has object type
1684 if it is not some other type. VxWorks needs this. */
1685 if ((symbol_get_bfdsym (symp
)->flags
1686 & (BSF_FUNCTION
| BSF_FILE
| BSF_SECTION_SYM
)) == 0
1687 && S_IS_DEFINED (symp
))
1688 symbol_get_bfdsym (symp
)->flags
|= BSF_OBJECT
;
1695 bfd_map_over_sections (stdoutput
, adjust_stab_sections
, (PTR
) 0);
1697 #ifdef elf_tc_final_processing
1698 elf_tc_final_processing ();
1702 /* It is required that we let write_relocs have the opportunity to
1703 optimize away fixups before output has begun, since it is possible
1704 to eliminate all fixups for a section and thus we never should
1705 have generated the relocation section. */
1708 elf_frob_file_after_relocs ()
1710 #ifdef NEED_ECOFF_DEBUG
1711 if (ECOFF_DEBUGGING
)
1712 /* Generate the ECOFF debugging information. */
1714 const struct ecoff_debug_swap
*debug_swap
;
1715 struct ecoff_debug_info debug
;
1720 = get_elf_backend_data (stdoutput
)->elf_backend_ecoff_debug_swap
;
1721 know (debug_swap
!= (const struct ecoff_debug_swap
*) NULL
);
1722 ecoff_build_debug (&debug
.symbolic_header
, &buf
, debug_swap
);
1724 /* Set up the pointers in debug. */
1725 #define SET(ptr, offset, type) \
1726 debug.ptr = (type) (buf + debug.symbolic_header.offset)
1728 SET (line
, cbLineOffset
, unsigned char *);
1729 SET (external_dnr
, cbDnOffset
, PTR
);
1730 SET (external_pdr
, cbPdOffset
, PTR
);
1731 SET (external_sym
, cbSymOffset
, PTR
);
1732 SET (external_opt
, cbOptOffset
, PTR
);
1733 SET (external_aux
, cbAuxOffset
, union aux_ext
*);
1734 SET (ss
, cbSsOffset
, char *);
1735 SET (external_fdr
, cbFdOffset
, PTR
);
1736 SET (external_rfd
, cbRfdOffset
, PTR
);
1737 /* ssext and external_ext are set up just below. */
1741 /* Set up the external symbols. */
1742 debug
.ssext
= debug
.ssext_end
= NULL
;
1743 debug
.external_ext
= debug
.external_ext_end
= NULL
;
1744 if (! bfd_ecoff_debug_externals (stdoutput
, &debug
, debug_swap
, true,
1745 elf_get_extr
, elf_set_index
))
1746 as_fatal (_("Failed to set up debugging information: %s"),
1747 bfd_errmsg (bfd_get_error ()));
1749 sec
= bfd_get_section_by_name (stdoutput
, ".mdebug");
1750 assert (sec
!= NULL
);
1752 know (stdoutput
->output_has_begun
== false);
1754 /* We set the size of the section, call bfd_set_section_contents
1755 to force the ELF backend to allocate a file position, and then
1756 write out the data. FIXME: Is this really the best way to do
1758 sec
->_raw_size
= bfd_ecoff_debug_size (stdoutput
, &debug
, debug_swap
);
1760 /* Pass BUF to bfd_set_section_contents because this will
1761 eventually become a call to fwrite, and ISO C prohibits
1762 passing a NULL pointer to a stdio function even if the
1763 pointer will not be used. */
1764 if (! bfd_set_section_contents (stdoutput
, sec
, (PTR
) buf
,
1765 (file_ptr
) 0, (bfd_size_type
) 0))
1766 as_fatal (_("Can't start writing .mdebug section: %s"),
1767 bfd_errmsg (bfd_get_error ()));
1769 know (stdoutput
->output_has_begun
== true);
1770 know (sec
->filepos
!= 0);
1772 if (! bfd_ecoff_write_debug (stdoutput
, &debug
, debug_swap
,
1774 as_fatal (_("Could not write .mdebug section: %s"),
1775 bfd_errmsg (bfd_get_error ()));
1777 #endif /* NEED_ECOFF_DEBUG */
1782 /* Heavily plagarized from obj_elf_version. The idea is to emit the
1783 SCO specific identifier in the .notes section to satisfy the SCO
1786 This looks more complicated than it really is. As opposed to the
1787 "obvious" solution, this should handle the cross dev cases
1788 correctly. (i.e, hosting on a 64 bit big endian processor, but
1789 generating SCO Elf code) Efficiency isn't a concern, as there
1790 should be exactly one of these sections per object module.
1792 SCO OpenServer 5 identifies it's ELF modules with a standard ELF
1795 int_32 namesz = 4 ; Name size
1796 int_32 descsz = 12 ; Descriptive information
1798 char name[4] = "SCO" ; Originator name ALWAYS SCO + NULL
1799 int_32 version = (major ver # << 16) | version of tools ;
1800 int_32 source = (tool_id << 16 ) | 1 ;
1801 int_32 info = 0 ; These are set by the SCO tools, but we
1802 don't know enough about the source
1803 environment to set them. SCO ld currently
1804 ignores them, and recommends we set them
1807 #define SCO_MAJOR_VERSION 0x1
1808 #define SCO_MINOR_VERSION 0x1
1818 asection
*seg
= now_seg
;
1819 subsegT subseg
= now_subseg
;
1820 Elf_Internal_Note i_note
;
1821 Elf_External_Note e_note
;
1822 asection
*note_secp
= (asection
*) NULL
;
1825 /* create the .note section */
1827 note_secp
= subseg_new (".note", 0);
1828 bfd_set_section_flags (stdoutput
,
1830 SEC_HAS_CONTENTS
| SEC_READONLY
);
1832 /* process the version string */
1835 i_note
.descsz
= 12; /* 12 descriptive bytes */
1836 i_note
.type
= NT_VERSION
; /* Contains a version string */
1838 p
= frag_more (sizeof (i_note
.namesz
));
1839 md_number_to_chars (p
, (valueT
) i_note
.namesz
, 4);
1841 p
= frag_more (sizeof (i_note
.descsz
));
1842 md_number_to_chars (p
, (valueT
) i_note
.descsz
, 4);
1844 p
= frag_more (sizeof (i_note
.type
));
1845 md_number_to_chars (p
, (valueT
) i_note
.type
, 4);
1850 /* Note: this is the version number of the ELF we're representing */
1852 md_number_to_chars (p
, (SCO_MAJOR_VERSION
<< 16) | (SCO_MINOR_VERSION
), 4);
1854 /* Here, we pick a magic number for ourselves (yes, I "registered"
1855 it with SCO. The bottom bit shows that we are compat with the
1858 md_number_to_chars (p
, 0x4c520000 | 0x0001, 4);
1860 /* If we knew (or cared) what the source language options were, we'd
1861 fill them in here. SCO has given us permission to ignore these
1862 and just set them to zero. */
1864 md_number_to_chars (p
, 0x0000, 4);
1866 frag_align (2, 0, 0);
1868 /* We probably can't restore the current segment, for there likely
1871 subseg_set (seg
, subseg
);
1875 #endif /* SCO_ELF */
1877 const struct format_ops elf_format_ops
=
1879 bfd_target_elf_flavour
,
1884 elf_frob_file_after_relocs
,
1885 elf_s_get_size
, elf_s_set_size
,
1886 elf_s_get_align
, elf_s_set_align
,
1887 elf_copy_symbol_attributes
,
1888 #ifdef NEED_ECOFF_DEBUG
1889 ecoff_generate_asm_lineno
,
1893 0, /* process_stab */
1895 elf_sec_sym_ok_for_reloc
,
1897 #ifdef NEED_ECOFF_DEBUG
1902 obj_read_begin_hook
,
1903 obj_symbol_new_hook
,