1 /* ELF object file format
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
3 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2,
10 or (at your option) any later version.
12 GAS is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #define OBJ_HEADER "obj-elf.h"
27 #ifndef ECOFF_DEBUGGING
28 #define ECOFF_DEBUGGING 0
30 #define NEED_ECOFF_DEBUG
33 #ifdef NEED_ECOFF_DEBUG
38 #include "elf/alpha.h"
53 static bfd_vma elf_s_get_size
PARAMS ((symbolS
*));
54 static void elf_s_set_size
PARAMS ((symbolS
*, bfd_vma
));
55 static bfd_vma elf_s_get_align
PARAMS ((symbolS
*));
56 static void elf_s_set_align
PARAMS ((symbolS
*, bfd_vma
));
57 static void elf_copy_symbol_attributes
PARAMS ((symbolS
*, symbolS
*));
58 static int elf_sec_sym_ok_for_reloc
PARAMS ((asection
*));
59 static void adjust_stab_sections
PARAMS ((bfd
*, asection
*, PTR
));
61 #ifdef NEED_ECOFF_DEBUG
62 static boolean elf_get_extr
PARAMS ((asymbol
*, EXTR
*));
63 static void elf_set_index
PARAMS ((asymbol
*, bfd_size_type
));
66 static void obj_elf_line
PARAMS ((int));
67 void obj_elf_version
PARAMS ((int));
68 static void obj_elf_size
PARAMS ((int));
69 static void obj_elf_type
PARAMS ((int));
70 static void obj_elf_ident
PARAMS ((int));
71 static void obj_elf_weak
PARAMS ((int));
72 static void obj_elf_local
PARAMS ((int));
73 static void obj_elf_visibility
PARAMS ((int));
74 static void obj_elf_symver
PARAMS ((int));
75 static void obj_elf_vtable_inherit
PARAMS ((int));
76 static void obj_elf_vtable_entry
PARAMS ((int));
77 static void obj_elf_subsection
PARAMS ((int));
78 static void obj_elf_popsection
PARAMS ((int));
80 static const pseudo_typeS elf_pseudo_table
[] =
82 {"comm", obj_elf_common
, 0},
83 {"common", obj_elf_common
, 1},
84 {"ident", obj_elf_ident
, 0},
85 {"local", obj_elf_local
, 0},
86 {"previous", obj_elf_previous
, 0},
87 {"section", obj_elf_section
, 0},
88 {"section.s", obj_elf_section
, 0},
89 {"sect", obj_elf_section
, 0},
90 {"sect.s", obj_elf_section
, 0},
91 {"pushsection", obj_elf_section
, 1},
92 {"popsection", obj_elf_popsection
, 0},
93 {"size", obj_elf_size
, 0},
94 {"type", obj_elf_type
, 0},
95 {"version", obj_elf_version
, 0},
96 {"weak", obj_elf_weak
, 0},
98 /* These define symbol visibility. */
99 {"internal", obj_elf_visibility
, STV_INTERNAL
},
100 {"hidden", obj_elf_visibility
, STV_HIDDEN
},
101 {"protected", obj_elf_visibility
, STV_PROTECTED
},
103 /* These are used for stabs-in-elf configurations. */
104 {"line", obj_elf_line
, 0},
106 /* This is a GNU extension to handle symbol versions. */
107 {"symver", obj_elf_symver
, 0},
109 /* A GNU extension to change subsection only. */
110 {"subsection", obj_elf_subsection
, 0},
112 /* These are GNU extensions to aid in garbage collecting C++ vtables. */
113 {"vtable_inherit", obj_elf_vtable_inherit
, 0},
114 {"vtable_entry", obj_elf_vtable_entry
, 0},
116 /* These are used for dwarf. */
121 /* We need to trap the section changing calls to handle .previous. */
122 {"data", obj_elf_data
, 0},
123 {"text", obj_elf_text
, 0},
129 static const pseudo_typeS ecoff_debug_pseudo_table
[] =
131 #ifdef NEED_ECOFF_DEBUG
132 /* COFF style debugging information for ECOFF. .ln is not used; .loc
134 { "def", ecoff_directive_def
, 0 },
135 { "dim", ecoff_directive_dim
, 0 },
136 { "endef", ecoff_directive_endef
, 0 },
137 { "file", ecoff_directive_file
, 0 },
138 { "scl", ecoff_directive_scl
, 0 },
139 { "tag", ecoff_directive_tag
, 0 },
140 { "val", ecoff_directive_val
, 0 },
142 /* COFF debugging requires pseudo-ops .size and .type, but ELF
143 already has meanings for those. We use .esize and .etype
144 instead. These are only generated by gcc anyhow. */
145 { "esize", ecoff_directive_size
, 0 },
146 { "etype", ecoff_directive_type
, 0 },
148 /* ECOFF specific debugging information. */
149 { "begin", ecoff_directive_begin
, 0 },
150 { "bend", ecoff_directive_bend
, 0 },
151 { "end", ecoff_directive_end
, 0 },
152 { "ent", ecoff_directive_ent
, 0 },
153 { "fmask", ecoff_directive_fmask
, 0 },
154 { "frame", ecoff_directive_frame
, 0 },
155 { "loc", ecoff_directive_loc
, 0 },
156 { "mask", ecoff_directive_mask
, 0 },
158 /* Other ECOFF directives. */
159 { "extern", ecoff_directive_extern
, 0 },
161 /* These are used on Irix. I don't know how to implement them. */
162 { "alias", s_ignore
, 0 },
163 { "bgnb", s_ignore
, 0 },
164 { "endb", s_ignore
, 0 },
165 { "lab", s_ignore
, 0 },
166 { "noalias", s_ignore
, 0 },
167 { "verstamp", s_ignore
, 0 },
168 { "vreg", s_ignore
, 0 },
171 {NULL
, NULL
, 0} /* end sentinel */
175 #include "aout/aout64.h"
177 /* This is called when the assembler starts. */
182 /* Add symbols for the known sections to the symbol table. */
183 symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput
,
184 TEXT_SECTION_NAME
)));
185 symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput
,
186 DATA_SECTION_NAME
)));
187 symbol_table_insert (section_symbol (bfd_get_section_by_name (stdoutput
,
194 pop_insert (elf_pseudo_table
);
196 pop_insert (ecoff_debug_pseudo_table
);
203 return S_GET_SIZE (sym
);
207 elf_s_set_size (sym
, sz
)
211 S_SET_SIZE (sym
, sz
);
215 elf_s_get_align (sym
)
218 return S_GET_ALIGN (sym
);
222 elf_s_set_align (sym
, align
)
226 S_SET_ALIGN (sym
, align
);
230 elf_s_get_other (sym
)
233 return elf_symbol (symbol_get_bfdsym (sym
))->internal_elf_sym
.st_other
;
237 elf_copy_symbol_attributes (dest
, src
)
240 OBJ_COPY_SYMBOL_ATTRIBUTES (dest
, src
);
244 elf_sec_sym_ok_for_reloc (sec
)
247 return obj_sec_sym_ok_for_reloc (sec
);
256 sym
= symbol_new (s
, absolute_section
, (valueT
) 0, (struct frag
*) 0);
257 symbol_set_frag (sym
, &zero_address_frag
);
258 symbol_get_bfdsym (sym
)->flags
|= BSF_FILE
;
260 if (symbol_rootP
!= sym
)
262 symbol_remove (sym
, &symbol_rootP
, &symbol_lastP
);
263 symbol_insert (sym
, symbol_rootP
, &symbol_rootP
, &symbol_lastP
);
265 verify_symbol_chain (symbol_rootP
, symbol_lastP
);
269 #ifdef NEED_ECOFF_DEBUG
275 obj_elf_common (is_common
)
285 if (flag_mri
&& is_common
)
291 name
= input_line_pointer
;
292 c
= get_symbol_end ();
293 /* just after name is now '\0' */
294 p
= input_line_pointer
;
297 if (*input_line_pointer
!= ',')
299 as_bad (_("Expected comma after symbol-name"));
300 ignore_rest_of_line ();
303 input_line_pointer
++; /* skip ',' */
304 if ((temp
= get_absolute_expression ()) < 0)
306 as_bad (_(".COMMon length (%d.) <0! Ignored."), temp
);
307 ignore_rest_of_line ();
312 symbolP
= symbol_find_or_make (name
);
314 if (S_IS_DEFINED (symbolP
) && ! S_IS_COMMON (symbolP
))
316 as_bad (_("Ignoring attempt to re-define symbol"));
317 ignore_rest_of_line ();
320 if (S_GET_VALUE (symbolP
) != 0)
322 if (S_GET_VALUE (symbolP
) != (valueT
) size
)
324 as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."),
325 S_GET_NAME (symbolP
), (long) S_GET_VALUE (symbolP
), size
);
328 know (symbolP
->sy_frag
== &zero_address_frag
);
329 if (*input_line_pointer
!= ',')
334 input_line_pointer
++;
337 if (! have_align
|| *input_line_pointer
!= '"')
343 temp
= get_absolute_expression ();
347 as_warn (_("Common alignment negative; 0 assumed"));
350 if (symbol_get_obj (symbolP
)->local
)
359 old_subsec
= now_subseg
;
362 /* convert to a power of 2 alignment */
363 for (align
= 0; (temp
& 1) == 0; temp
>>= 1, ++align
);
366 as_bad (_("Common alignment not a power of 2"));
367 ignore_rest_of_line ();
373 record_alignment (bss_section
, align
);
374 subseg_set (bss_section
, 0);
376 frag_align (align
, 0, 0);
377 if (S_GET_SEGMENT (symbolP
) == bss_section
)
378 symbol_get_frag (symbolP
)->fr_symbol
= 0;
379 symbol_set_frag (symbolP
, frag_now
);
380 pfrag
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, symbolP
,
381 (offsetT
) size
, (char *) 0);
383 S_SET_SIZE (symbolP
, size
);
384 S_SET_SEGMENT (symbolP
, bss_section
);
385 S_CLEAR_EXTERNAL (symbolP
);
386 subseg_set (old_sec
, old_subsec
);
391 S_SET_VALUE (symbolP
, (valueT
) size
);
392 S_SET_ALIGN (symbolP
, temp
);
393 S_SET_EXTERNAL (symbolP
);
394 S_SET_SEGMENT (symbolP
, bfd_com_section_ptr
);
399 input_line_pointer
++;
400 /* @@ Some use the dot, some don't. Can we get some consistency?? */
401 if (*input_line_pointer
== '.')
402 input_line_pointer
++;
403 /* @@ Some say data, some say bss. */
404 if (strncmp (input_line_pointer
, "bss\"", 4)
405 && strncmp (input_line_pointer
, "data\"", 5))
407 while (*--input_line_pointer
!= '"')
409 input_line_pointer
--;
410 goto bad_common_segment
;
412 while (*input_line_pointer
++ != '"')
414 goto allocate_common
;
417 symbol_get_bfdsym (symbolP
)->flags
|= BSF_OBJECT
;
419 demand_empty_rest_of_line ();
424 p
= input_line_pointer
;
425 while (*p
&& *p
!= '\n')
429 as_bad (_("bad .common segment %s"), input_line_pointer
+ 1);
431 input_line_pointer
= p
;
432 ignore_rest_of_line ();
438 obj_elf_local (ignore
)
439 int ignore ATTRIBUTE_UNUSED
;
447 name
= input_line_pointer
;
448 c
= get_symbol_end ();
449 symbolP
= symbol_find_or_make (name
);
450 *input_line_pointer
= c
;
452 S_CLEAR_EXTERNAL (symbolP
);
453 symbol_get_obj (symbolP
)->local
= 1;
456 input_line_pointer
++;
458 if (*input_line_pointer
== '\n')
463 demand_empty_rest_of_line ();
467 obj_elf_weak (ignore
)
468 int ignore ATTRIBUTE_UNUSED
;
476 name
= input_line_pointer
;
477 c
= get_symbol_end ();
478 symbolP
= symbol_find_or_make (name
);
479 *input_line_pointer
= c
;
481 S_SET_WEAK (symbolP
);
482 symbol_get_obj (symbolP
)->local
= 1;
485 input_line_pointer
++;
487 if (*input_line_pointer
== '\n')
492 demand_empty_rest_of_line ();
496 obj_elf_visibility (visibility
)
503 elf_symbol_type
*elfsym
;
507 name
= input_line_pointer
;
508 c
= get_symbol_end ();
509 symbolP
= symbol_find_or_make (name
);
510 *input_line_pointer
= c
;
514 bfdsym
= symbol_get_bfdsym (symbolP
);
515 elfsym
= elf_symbol_from (bfd_asymbol_bfd (bfdsym
), bfdsym
);
519 elfsym
->internal_elf_sym
.st_other
= visibility
;
523 input_line_pointer
++;
527 if (*input_line_pointer
== '\n')
533 demand_empty_rest_of_line ();
537 static segT previous_section
;
538 static int previous_subsection
;
542 struct section_stack
*next
;
544 int subseg
, prev_subseg
;
547 static struct section_stack
*section_stack
;
550 /* Handle the .section pseudo-op. This code supports two different
553 The first is found on Solaris, and looks like
554 .section ".sec1",#alloc,#execinstr,#write
555 Here the names after '#' are the SHF_* flags to turn on for the
556 section. I'm not sure how it determines the SHT_* type (BFD
557 doesn't really give us control over the type, anyhow).
559 The second format is found on UnixWare, and probably most SVR4
560 machines, and looks like
561 .section .sec1,"a",@progbits
562 The quoted string may contain any combination of a, w, x, and
563 represents the SHF_* flags to turn on for the section. The string
564 beginning with '@' can be progbits or nobits. There should be
565 other possibilities, but I don't know what they are. In any case,
566 BFD doesn't really let us set the section type. */
568 /* Certain named sections have particular defined types, listed on p.
570 struct special_section
577 static struct special_section
const special_sections
[] =
579 { ".bss", SHT_NOBITS
, SHF_ALLOC
+ SHF_WRITE
},
580 { ".comment", SHT_PROGBITS
, 0 },
581 { ".data", SHT_PROGBITS
, SHF_ALLOC
+ SHF_WRITE
},
582 { ".data1", SHT_PROGBITS
, SHF_ALLOC
+ SHF_WRITE
},
583 { ".debug", SHT_PROGBITS
, 0 },
584 { ".fini", SHT_PROGBITS
, SHF_ALLOC
+ SHF_EXECINSTR
},
585 { ".init", SHT_PROGBITS
, SHF_ALLOC
+ SHF_EXECINSTR
},
586 { ".line", SHT_PROGBITS
, 0 },
587 { ".note", SHT_NOTE
, 0 },
588 { ".rodata", SHT_PROGBITS
, SHF_ALLOC
},
589 { ".rodata1", SHT_PROGBITS
, SHF_ALLOC
},
590 { ".text", SHT_PROGBITS
, SHF_ALLOC
+ SHF_EXECINSTR
},
592 #ifdef ELF_TC_SPECIAL_SECTIONS
593 ELF_TC_SPECIAL_SECTIONS
597 /* The following section names are special, but they can not
598 reasonably appear in assembler code. Some of the attributes are
599 processor dependent. */
600 { ".dynamic", SHT_DYNAMIC
, SHF_ALLOC
/* + SHF_WRITE */ },
601 { ".dynstr", SHT_STRTAB
, SHF_ALLOC
},
602 { ".dynsym", SHT_DYNSYM
, SHF_ALLOC
},
603 { ".got", SHT_PROGBITS
, 0 },
604 { ".hash", SHT_HASH
, SHF_ALLOC
},
605 { ".interp", SHT_PROGBITS
, /* SHF_ALLOC */ },
606 { ".plt", SHT_PROGBITS
, 0 },
607 { ".shstrtab",SHT_STRTAB
, 0 },
608 { ".strtab", SHT_STRTAB
, /* SHF_ALLOC */ },
609 { ".symtab", SHT_SYMTAB
, /* SHF_ALLOC */ },
616 obj_elf_change_section (name
, type
, attr
, push
)
618 int type
, attr
, push
;
623 #ifdef md_flush_pending_output
624 md_flush_pending_output ();
627 /* Switch to the section, creating it if necessary. */
630 struct section_stack
*elt
;
631 elt
= xmalloc (sizeof (struct section_stack
));
632 elt
->next
= section_stack
;
634 elt
->prev_seg
= previous_section
;
635 elt
->subseg
= now_subseg
;
636 elt
->prev_subseg
= previous_subsection
;
639 previous_section
= now_seg
;
640 previous_subsection
= now_subseg
;
642 new_sec
= bfd_get_section_by_name (stdoutput
, name
) == NULL
;
643 sec
= subseg_new (name
, 0);
651 /* See if this is one of the special sections. */
652 for (i
= 0; special_sections
[i
].name
!= NULL
; i
++)
653 if (strcmp (name
, special_sections
[i
].name
) == 0)
655 if (type
== SHT_NULL
)
656 type
= special_sections
[i
].type
;
657 else if (type
!= special_sections
[i
].type
)
658 as_warn (_("Setting incorrect section type for %s"), name
);
660 if ((attr
&~ special_sections
[i
].attributes
) != 0)
662 /* As a GNU extension, we permit a .note section to be
663 allocatable. If the linker sees an allocateable .note
664 section, it will create a PT_NOTE segment in the output
666 if (strcmp (name
, ".note") != 0
667 || attr
!= SHF_ALLOC
)
668 as_warn (_("Setting incorrect section attributes for %s"),
671 attr
|= special_sections
[i
].attributes
;
675 /* Convert ELF type and flags to BFD flags. */
677 | ((attr
& SHF_WRITE
) ? 0 : SEC_READONLY
)
678 | ((attr
& SHF_ALLOC
) ? SEC_ALLOC
: 0)
679 | (((attr
& SHF_ALLOC
) && type
!= SHT_NOBITS
) ? SEC_LOAD
: 0)
680 | ((attr
& SHF_EXECINSTR
) ? SEC_CODE
: 0));
681 #ifdef md_elf_section_flags
682 flags
= md_elf_section_flags (flags
, attr
, type
);
685 /* Prevent SEC_HAS_CONTENTS from being inadvertently set. */
686 if (type
== SHT_NOBITS
)
687 seg_info (sec
)->bss
= 1;
689 bfd_set_section_flags (stdoutput
, sec
, flags
);
691 /* Add a symbol for this section to the symbol table. */
692 secsym
= symbol_find (name
);
694 symbol_set_bfdsym (secsym
, sec
->symbol
);
696 symbol_table_insert (section_symbol (sec
));
699 #ifdef md_elf_section_change_hook
700 md_elf_section_change_hook ();
705 obj_elf_parse_section_letters (str
, len
)
722 attr
|= SHF_EXECINSTR
;
726 char *bad_msg
= _("Unrecognized .section attribute: want a,w,x");
727 #ifdef md_elf_section_letter
728 int md_attr
= md_elf_section_letter (*str
, &bad_msg
);
734 as_warn ("%s", bad_msg
);
747 obj_elf_section_word (str
, len
)
751 if (len
== 5 && strncmp (str
, "write", 5) == 0)
753 if (len
== 5 && strncmp (str
, "alloc", 5) == 0)
755 if (len
== 9 && strncmp (str
, "execinstr", 9) == 0)
756 return SHF_EXECINSTR
;
758 #ifdef md_elf_section_word
760 int md_attr
= md_elf_section_word (str
, len
);
766 as_warn (_("Unrecognized section attribute"));
771 obj_elf_section_type (str
, len
)
775 if (len
== 8 && strncmp (str
, "progbits", 8) == 0)
777 if (len
== 6 && strncmp (str
, "nobits", 6) == 0)
780 #ifdef md_elf_section_type
782 int md_type
= md_elf_section_type (str
, len
);
788 as_warn (_("Unrecognized section type"));
793 obj_elf_section (push
)
796 char *name
, *beg
, *end
;
797 int type
, attr
, dummy
;
804 #ifdef md_flush_pending_output
805 md_flush_pending_output ();
808 previous_section
= now_seg
;
809 previous_subsection
= now_subseg
;
811 s_mri_sect (&mri_type
);
813 #ifdef md_elf_section_change_hook
814 md_elf_section_change_hook ();
819 #endif /* ! defined (TC_I370) */
821 /* Get name of section. */
823 if (*input_line_pointer
== '"')
825 name
= demand_copy_C_string (&dummy
);
828 ignore_rest_of_line ();
834 end
= input_line_pointer
;
835 while (0 == strchr ("\n\t,; ", *end
))
837 if (end
== input_line_pointer
)
839 as_warn (_("Missing section name"));
840 ignore_rest_of_line ();
844 name
= xmalloc (end
- input_line_pointer
+ 1);
845 memcpy (name
, input_line_pointer
, end
- input_line_pointer
);
846 name
[end
- input_line_pointer
] = '\0';
847 input_line_pointer
= end
;
854 if (*input_line_pointer
== ',')
856 /* Skip the comma. */
857 ++input_line_pointer
;
860 if (*input_line_pointer
== '"')
862 beg
= demand_copy_C_string (&dummy
);
865 ignore_rest_of_line ();
868 attr
|= obj_elf_parse_section_letters (beg
, strlen (beg
));
871 if (*input_line_pointer
== ',')
874 ++input_line_pointer
;
876 c
= *input_line_pointer
;
879 beg
= demand_copy_C_string (&dummy
);
882 ignore_rest_of_line ();
885 type
= obj_elf_section_type (beg
, strlen (beg
));
887 else if (c
== '@' || c
== '%')
889 beg
= ++input_line_pointer
;
890 c
= get_symbol_end ();
891 *input_line_pointer
= c
;
892 type
= obj_elf_section_type (beg
, input_line_pointer
- beg
);
903 if (*input_line_pointer
!= '#')
905 as_warn (_("Bad .section directive - character following name is not '#'"));
906 ignore_rest_of_line ();
909 beg
= ++input_line_pointer
;
910 c
= get_symbol_end ();
911 *input_line_pointer
= c
;
913 attr
|= obj_elf_section_word (beg
, input_line_pointer
- beg
);
917 while (*input_line_pointer
++ == ',');
918 --input_line_pointer
;
922 demand_empty_rest_of_line ();
924 obj_elf_change_section (name
, type
, attr
, push
);
927 /* Change to the .data section. */
933 #ifdef md_flush_pending_output
934 md_flush_pending_output ();
937 previous_section
= now_seg
;
938 previous_subsection
= now_subseg
;
941 #ifdef md_elf_section_change_hook
942 md_elf_section_change_hook ();
946 /* Change to the .text section. */
952 #ifdef md_flush_pending_output
953 md_flush_pending_output ();
956 previous_section
= now_seg
;
957 previous_subsection
= now_subseg
;
960 #ifdef md_elf_section_change_hook
961 md_elf_section_change_hook ();
966 obj_elf_subsection (ignore
)
967 int ignore ATTRIBUTE_UNUSED
;
971 #ifdef md_flush_pending_output
972 md_flush_pending_output ();
975 previous_section
= now_seg
;
976 previous_subsection
= now_subseg
;
978 temp
= get_absolute_expression ();
979 subseg_set (now_seg
, (subsegT
) temp
);
980 demand_empty_rest_of_line ();
982 #ifdef md_elf_section_change_hook
983 md_elf_section_change_hook ();
987 /* This can be called from the processor backends if they change
991 obj_elf_section_change_hook ()
993 previous_section
= now_seg
;
994 previous_subsection
= now_subseg
;
998 obj_elf_previous (ignore
)
999 int ignore ATTRIBUTE_UNUSED
;
1004 if (previous_section
== 0)
1006 as_bad (_(".previous without corresponding .section; ignored"));
1010 #ifdef md_flush_pending_output
1011 md_flush_pending_output ();
1014 new_section
= previous_section
;
1015 new_subsection
= previous_subsection
;
1016 previous_section
= now_seg
;
1017 previous_subsection
= now_subseg
;
1018 subseg_set (new_section
, new_subsection
);
1020 #ifdef md_elf_section_change_hook
1021 md_elf_section_change_hook ();
1026 obj_elf_popsection (xxx
)
1027 int xxx ATTRIBUTE_UNUSED
;
1029 struct section_stack
*top
= section_stack
;
1033 as_bad (_(".popsection without corresponding .pushsection; ignored"));
1037 #ifdef md_flush_pending_output
1038 md_flush_pending_output ();
1041 section_stack
= top
->next
;
1042 previous_section
= top
->prev_seg
;
1043 previous_subsection
= top
->prev_subseg
;
1044 subseg_set (top
->seg
, top
->subseg
);
1047 #ifdef md_elf_section_change_hook
1048 md_elf_section_change_hook ();
1053 obj_elf_line (ignore
)
1054 int ignore ATTRIBUTE_UNUSED
;
1056 /* Assume delimiter is part of expression. BSD4.2 as fails with
1057 delightful bug, so we are not being incompatible here. */
1058 new_logical_line ((char *) NULL
, (int) (get_absolute_expression ()));
1059 demand_empty_rest_of_line ();
1062 /* This handles the .symver pseudo-op, which is used to specify a
1063 symbol version. The syntax is ``.symver NAME,SYMVERNAME''.
1064 SYMVERNAME may contain ELF_VER_CHR ('@') characters. This
1065 pseudo-op causes the assembler to emit a symbol named SYMVERNAME
1066 with the same value as the symbol NAME. */
1069 obj_elf_symver (ignore
)
1070 int ignore ATTRIBUTE_UNUSED
;
1076 name
= input_line_pointer
;
1077 c
= get_symbol_end ();
1079 sym
= symbol_find_or_make (name
);
1081 *input_line_pointer
= c
;
1083 if (symbol_get_obj (sym
)->versioned_name
!= NULL
)
1085 as_bad (_("multiple .symver directives for symbol `%s'"),
1087 ignore_rest_of_line ();
1092 if (*input_line_pointer
!= ',')
1094 as_bad (_("expected comma after name in .symver"));
1095 ignore_rest_of_line ();
1099 ++input_line_pointer
;
1100 name
= input_line_pointer
;
1103 c
= get_symbol_end ();
1104 if (c
!= ELF_VER_CHR
)
1106 *input_line_pointer
++ = c
;
1109 symbol_get_obj (sym
)->versioned_name
= xstrdup (name
);
1111 *input_line_pointer
= c
;
1113 if (strchr (symbol_get_obj (sym
)->versioned_name
, ELF_VER_CHR
) == NULL
)
1115 as_bad (_("missing version name in `%s' for symbol `%s'"),
1116 symbol_get_obj (sym
)->versioned_name
, S_GET_NAME (sym
));
1117 ignore_rest_of_line ();
1121 demand_empty_rest_of_line ();
1124 /* This handles the .vtable_inherit pseudo-op, which is used to indicate
1125 to the linker the hierarchy in which a particular table resides. The
1126 syntax is ".vtable_inherit CHILDNAME, PARENTNAME". */
1129 obj_elf_vtable_inherit (ignore
)
1130 int ignore ATTRIBUTE_UNUSED
;
1132 char *cname
, *pname
;
1133 symbolS
*csym
, *psym
;
1136 if (*input_line_pointer
== '#')
1137 ++input_line_pointer
;
1139 cname
= input_line_pointer
;
1140 c
= get_symbol_end ();
1141 csym
= symbol_find (cname
);
1143 /* GCFIXME: should check that we don't have two .vtable_inherits for
1144 the same child symbol. Also, we can currently only do this if the
1145 child symbol is already exists and is placed in a fragment. */
1147 if (csym
== NULL
|| symbol_get_frag (csym
) == NULL
)
1149 as_bad ("expected `%s' to have already been set for .vtable_inherit",
1154 *input_line_pointer
= c
;
1157 if (*input_line_pointer
!= ',')
1159 as_bad ("expected comma after name in .vtable_inherit");
1160 ignore_rest_of_line ();
1164 ++input_line_pointer
;
1167 if (*input_line_pointer
== '#')
1168 ++input_line_pointer
;
1170 if (input_line_pointer
[0] == '0'
1171 && (input_line_pointer
[1] == '\0'
1172 || isspace ((unsigned char) input_line_pointer
[1])))
1174 psym
= section_symbol (absolute_section
);
1175 ++input_line_pointer
;
1179 pname
= input_line_pointer
;
1180 c
= get_symbol_end ();
1181 psym
= symbol_find_or_make (pname
);
1182 *input_line_pointer
= c
;
1185 demand_empty_rest_of_line ();
1190 assert (symbol_get_value_expression (csym
)->X_op
== O_constant
);
1191 fix_new (symbol_get_frag (csym
),
1192 symbol_get_value_expression (csym
)->X_add_number
, 0, psym
, 0, 0,
1193 BFD_RELOC_VTABLE_INHERIT
);
1196 /* This handles the .vtable_entry pseudo-op, which is used to indicate
1197 to the linker that a vtable slot was used. The syntax is
1198 ".vtable_entry tablename, offset". */
1201 obj_elf_vtable_entry (ignore
)
1202 int ignore ATTRIBUTE_UNUSED
;
1209 if (*input_line_pointer
== '#')
1210 ++input_line_pointer
;
1212 name
= input_line_pointer
;
1213 c
= get_symbol_end ();
1214 sym
= symbol_find_or_make (name
);
1215 *input_line_pointer
= c
;
1218 if (*input_line_pointer
!= ',')
1220 as_bad ("expected comma after name in .vtable_entry");
1221 ignore_rest_of_line ();
1225 ++input_line_pointer
;
1226 if (*input_line_pointer
== '#')
1227 ++input_line_pointer
;
1229 offset
= get_absolute_expression ();
1231 fix_new (frag_now
, frag_now_fix (), 0, sym
, offset
, 0,
1232 BFD_RELOC_VTABLE_ENTRY
);
1234 demand_empty_rest_of_line ();
1238 elf_obj_read_begin_hook ()
1240 #ifdef NEED_ECOFF_DEBUG
1241 if (ECOFF_DEBUGGING
)
1242 ecoff_read_begin_hook ();
1247 elf_obj_symbol_new_hook (symbolP
)
1250 struct elf_obj_sy
*sy_obj
;
1252 sy_obj
= symbol_get_obj (symbolP
);
1253 sy_obj
->size
= NULL
;
1254 sy_obj
->versioned_name
= NULL
;
1256 #ifdef NEED_ECOFF_DEBUG
1257 if (ECOFF_DEBUGGING
)
1258 ecoff_symbol_new_hook (symbolP
);
1263 obj_elf_version (ignore
)
1264 int ignore ATTRIBUTE_UNUSED
;
1270 asection
*seg
= now_seg
;
1271 subsegT subseg
= now_subseg
;
1272 Elf_Internal_Note i_note
;
1273 Elf_External_Note e_note
;
1274 asection
*note_secp
= (asection
*) NULL
;
1278 if (*input_line_pointer
== '\"')
1280 ++input_line_pointer
; /* -> 1st char of string. */
1281 name
= input_line_pointer
;
1283 while (is_a_char (c
= next_char_of_string ()))
1285 c
= *input_line_pointer
;
1286 *input_line_pointer
= '\0';
1287 *(input_line_pointer
- 1) = '\0';
1288 *input_line_pointer
= c
;
1290 /* create the .note section */
1292 note_secp
= subseg_new (".note", 0);
1293 bfd_set_section_flags (stdoutput
,
1295 SEC_HAS_CONTENTS
| SEC_READONLY
);
1297 /* process the version string */
1299 len
= strlen (name
);
1301 i_note
.namesz
= ((len
+ 1) + 3) & ~3; /* round this to word boundary */
1302 i_note
.descsz
= 0; /* no description */
1303 i_note
.type
= NT_VERSION
;
1304 p
= frag_more (sizeof (e_note
.namesz
));
1305 md_number_to_chars (p
, (valueT
) i_note
.namesz
, 4);
1306 p
= frag_more (sizeof (e_note
.descsz
));
1307 md_number_to_chars (p
, (valueT
) i_note
.descsz
, 4);
1308 p
= frag_more (sizeof (e_note
.type
));
1309 md_number_to_chars (p
, (valueT
) i_note
.type
, 4);
1311 for (i
= 0; i
< len
; i
++)
1315 FRAG_APPEND_1_CHAR (ch
);
1318 frag_align (2, 0, 0);
1320 subseg_set (seg
, subseg
);
1324 as_bad (_("Expected quoted string"));
1326 demand_empty_rest_of_line ();
1330 obj_elf_size (ignore
)
1331 int ignore ATTRIBUTE_UNUSED
;
1333 char *name
= input_line_pointer
;
1334 char c
= get_symbol_end ();
1339 p
= input_line_pointer
;
1342 if (*input_line_pointer
!= ',')
1345 as_bad (_("expected comma after name `%s' in .size directive"), name
);
1347 ignore_rest_of_line ();
1350 input_line_pointer
++;
1352 if (exp
.X_op
== O_absent
)
1354 as_bad (_("missing expression in .size directive"));
1355 exp
.X_op
= O_constant
;
1356 exp
.X_add_number
= 0;
1359 sym
= symbol_find_or_make (name
);
1361 if (exp
.X_op
== O_constant
)
1362 S_SET_SIZE (sym
, exp
.X_add_number
);
1365 symbol_get_obj (sym
)->size
=
1366 (expressionS
*) xmalloc (sizeof (expressionS
));
1367 *symbol_get_obj (sym
)->size
= exp
;
1369 demand_empty_rest_of_line ();
1372 /* Handle the ELF .type pseudo-op. This sets the type of a symbol.
1373 There are four syntaxes:
1375 The first (used on Solaris) is
1377 The second (used on UnixWare) is
1379 The third (reportedly to be used on Irix 6.0) is
1381 The fourth (used on NetBSD/Arm and Linux/ARM) is
1386 obj_elf_type (ignore
)
1387 int ignore ATTRIBUTE_UNUSED
;
1392 const char *typename
;
1395 name
= input_line_pointer
;
1396 c
= get_symbol_end ();
1397 sym
= symbol_find_or_make (name
);
1398 *input_line_pointer
= c
;
1401 if (*input_line_pointer
== ',')
1402 ++input_line_pointer
;
1405 if ( *input_line_pointer
== '#'
1406 || *input_line_pointer
== '@'
1407 || *input_line_pointer
== '%')
1408 ++input_line_pointer
;
1410 typename
= input_line_pointer
;
1411 c
= get_symbol_end ();
1414 if (strcmp (typename
, "function") == 0
1415 || strcmp (typename
, "STT_FUNC") == 0)
1416 type
= BSF_FUNCTION
;
1417 else if (strcmp (typename
, "object") == 0
1418 || strcmp (typename
, "STT_OBJECT") == 0)
1421 as_bad (_("ignoring unrecognized symbol type \"%s\""), typename
);
1423 *input_line_pointer
= c
;
1425 symbol_get_bfdsym (sym
)->flags
|= type
;
1427 demand_empty_rest_of_line ();
1431 obj_elf_ident (ignore
)
1432 int ignore ATTRIBUTE_UNUSED
;
1434 static segT comment_section
;
1435 segT old_section
= now_seg
;
1436 int old_subsection
= now_subseg
;
1438 #ifdef md_flush_pending_output
1439 md_flush_pending_output ();
1442 if (!comment_section
)
1445 comment_section
= subseg_new (".comment", 0);
1446 bfd_set_section_flags (stdoutput
, comment_section
,
1447 SEC_READONLY
| SEC_HAS_CONTENTS
);
1452 subseg_set (comment_section
, 0);
1454 subseg_set (old_section
, old_subsection
);
1457 #ifdef INIT_STAB_SECTION
1459 /* The first entry in a .stabs section is special. */
1462 obj_elf_init_stab_section (seg
)
1468 unsigned int stroff
;
1470 /* Force the section to align to a longword boundary. Without this,
1471 UnixWare ar crashes. */
1472 bfd_set_section_alignment (stdoutput
, seg
, 2);
1474 /* Make space for this first symbol. */
1478 as_where (&file
, (unsigned int *) NULL
);
1479 stabstr_name
= (char *) alloca (strlen (segment_name (seg
)) + 4);
1480 strcpy (stabstr_name
, segment_name (seg
));
1481 strcat (stabstr_name
, "str");
1482 stroff
= get_stab_string_offset (file
, stabstr_name
);
1484 md_number_to_chars (p
, stroff
, 4);
1485 seg_info (seg
)->stabu
.p
= p
;
1490 /* Fill in the counts in the first entry in a .stabs section. */
1493 adjust_stab_sections (abfd
, sec
, xxx
)
1496 PTR xxx ATTRIBUTE_UNUSED
;
1503 if (strncmp (".stab", sec
->name
, 5))
1505 if (!strcmp ("str", sec
->name
+ strlen (sec
->name
) - 3))
1508 name
= (char *) alloca (strlen (sec
->name
) + 4);
1509 strcpy (name
, sec
->name
);
1510 strcat (name
, "str");
1511 strsec
= bfd_get_section_by_name (abfd
, name
);
1513 strsz
= bfd_section_size (abfd
, strsec
);
1516 nsyms
= bfd_section_size (abfd
, sec
) / 12 - 1;
1518 p
= seg_info (sec
)->stabu
.p
;
1521 bfd_h_put_16 (abfd
, (bfd_vma
) nsyms
, (bfd_byte
*) p
+ 6);
1522 bfd_h_put_32 (abfd
, (bfd_vma
) strsz
, (bfd_byte
*) p
+ 8);
1525 #ifdef NEED_ECOFF_DEBUG
1527 /* This function is called by the ECOFF code. It is supposed to
1528 record the external symbol information so that the backend can
1529 write it out correctly. The ELF backend doesn't actually handle
1530 this at the moment, so we do it ourselves. We save the information
1534 elf_ecoff_set_ext (sym
, ext
)
1536 struct ecoff_extr
*ext
;
1538 symbol_get_bfdsym (sym
)->udata
.p
= (PTR
) ext
;
1541 /* This function is called by bfd_ecoff_debug_externals. It is
1542 supposed to *EXT to the external symbol information, and return
1543 whether the symbol should be used at all. */
1546 elf_get_extr (sym
, ext
)
1550 if (sym
->udata
.p
== NULL
)
1552 *ext
= *(EXTR
*) sym
->udata
.p
;
1556 /* This function is called by bfd_ecoff_debug_externals. It has
1557 nothing to do for ELF. */
1561 elf_set_index (sym
, indx
)
1562 asymbol
*sym ATTRIBUTE_UNUSED
;
1563 bfd_size_type indx ATTRIBUTE_UNUSED
;
1567 #endif /* NEED_ECOFF_DEBUG */
1570 elf_frob_symbol (symp
, puntp
)
1574 struct elf_obj_sy
*sy_obj
;
1576 #ifdef NEED_ECOFF_DEBUG
1577 if (ECOFF_DEBUGGING
)
1578 ecoff_frob_symbol (symp
);
1581 sy_obj
= symbol_get_obj (symp
);
1583 if (sy_obj
->size
!= NULL
)
1585 switch (sy_obj
->size
->X_op
)
1589 (S_GET_VALUE (sy_obj
->size
->X_add_symbol
)
1590 + sy_obj
->size
->X_add_number
1591 - S_GET_VALUE (sy_obj
->size
->X_op_symbol
)));
1595 (S_GET_VALUE (sy_obj
->size
->X_add_symbol
)
1596 + sy_obj
->size
->X_add_number
));
1599 as_bad (_(".size expression too complicated to fix up"));
1602 free (sy_obj
->size
);
1603 sy_obj
->size
= NULL
;
1606 if (sy_obj
->versioned_name
!= NULL
)
1608 /* This symbol was given a new name with the .symver directive.
1610 If this is an external reference, just rename the symbol to
1611 include the version string. This will make the relocs be
1612 against the correct versioned symbol.
1614 If this is a definition, add an alias. FIXME: Using an alias
1615 will permit the debugging information to refer to the right
1616 symbol. However, it's not clear whether it is the best
1619 if (! S_IS_DEFINED (symp
))
1623 /* Verify that the name isn't using the @@ syntax--this is
1624 reserved for definitions of the default version to link
1626 p
= strchr (sy_obj
->versioned_name
, ELF_VER_CHR
);
1628 if (p
[1] == ELF_VER_CHR
)
1630 as_bad (_("invalid attempt to declare external version name as default in symbol `%s'"),
1631 sy_obj
->versioned_name
);
1634 S_SET_NAME (symp
, sy_obj
->versioned_name
);
1640 /* FIXME: Creating a new symbol here is risky. We're in the
1641 final loop over the symbol table. We can get away with
1642 it only because the symbol goes to the end of the list,
1643 where the loop will still see it. It would probably be
1644 better to do this in obj_frob_file_before_adjust. */
1646 symp2
= symbol_find_or_make (sy_obj
->versioned_name
);
1648 /* Now we act as though we saw symp2 = sym. */
1650 S_SET_SEGMENT (symp2
, S_GET_SEGMENT (symp
));
1652 /* Subtracting out the frag address here is a hack because
1653 we are in the middle of the final loop. */
1656 - symbol_get_frag (symp
)->fr_address
));
1658 symbol_set_frag (symp2
, symbol_get_frag (symp
));
1660 /* This will copy over the size information. */
1661 copy_symbol_attributes (symp2
, symp
);
1663 if (S_IS_WEAK (symp
))
1666 if (S_IS_EXTERNAL (symp
))
1667 S_SET_EXTERNAL (symp2
);
1671 /* Double check weak symbols. */
1672 if (S_IS_WEAK (symp
))
1674 if (S_IS_COMMON (symp
))
1675 as_bad (_("Symbol `%s' can not be both weak and common"),
1680 /* The Irix 5 and 6 assemblers set the type of any common symbol and
1681 any undefined non-function symbol to STT_OBJECT. We try to be
1682 compatible, since newer Irix 5 and 6 linkers care. However, we
1683 only set undefined symbols to be STT_OBJECT if we are on Irix,
1684 because that is the only time gcc will generate the necessary
1685 .global directives to mark functions. */
1687 if (S_IS_COMMON (symp
))
1688 symbol_get_bfdsym (symp
)->flags
|= BSF_OBJECT
;
1690 if (strstr (TARGET_OS
, "irix") != NULL
1691 && ! S_IS_DEFINED (symp
)
1692 && (symbol_get_bfdsym (symp
)->flags
& BSF_FUNCTION
) == 0)
1693 symbol_get_bfdsym (symp
)->flags
|= BSF_OBJECT
;
1697 /* If TC_PPC is defined, we used to force the type of a symbol to be
1698 BSF_OBJECT if it was otherwise unset. This was required by some
1699 version of VxWorks. Thomas de Lellis <tdel@windriver.com> says
1700 that this is no longer needed, so it is now commented out. */
1701 if ((symbol_get_bfdsym (symp
)->flags
1702 & (BSF_FUNCTION
| BSF_FILE
| BSF_SECTION_SYM
)) == 0
1703 && S_IS_DEFINED (symp
))
1704 symbol_get_bfdsym (symp
)->flags
|= BSF_OBJECT
;
1711 bfd_map_over_sections (stdoutput
, adjust_stab_sections
, (PTR
) 0);
1713 #ifdef elf_tc_final_processing
1714 elf_tc_final_processing ();
1718 /* It is required that we let write_relocs have the opportunity to
1719 optimize away fixups before output has begun, since it is possible
1720 to eliminate all fixups for a section and thus we never should
1721 have generated the relocation section. */
1724 elf_frob_file_after_relocs ()
1726 #ifdef NEED_ECOFF_DEBUG
1727 if (ECOFF_DEBUGGING
)
1728 /* Generate the ECOFF debugging information. */
1730 const struct ecoff_debug_swap
*debug_swap
;
1731 struct ecoff_debug_info debug
;
1736 = get_elf_backend_data (stdoutput
)->elf_backend_ecoff_debug_swap
;
1737 know (debug_swap
!= (const struct ecoff_debug_swap
*) NULL
);
1738 ecoff_build_debug (&debug
.symbolic_header
, &buf
, debug_swap
);
1740 /* Set up the pointers in debug. */
1741 #define SET(ptr, offset, type) \
1742 debug.ptr = (type) (buf + debug.symbolic_header.offset)
1744 SET (line
, cbLineOffset
, unsigned char *);
1745 SET (external_dnr
, cbDnOffset
, PTR
);
1746 SET (external_pdr
, cbPdOffset
, PTR
);
1747 SET (external_sym
, cbSymOffset
, PTR
);
1748 SET (external_opt
, cbOptOffset
, PTR
);
1749 SET (external_aux
, cbAuxOffset
, union aux_ext
*);
1750 SET (ss
, cbSsOffset
, char *);
1751 SET (external_fdr
, cbFdOffset
, PTR
);
1752 SET (external_rfd
, cbRfdOffset
, PTR
);
1753 /* ssext and external_ext are set up just below. */
1757 /* Set up the external symbols. */
1758 debug
.ssext
= debug
.ssext_end
= NULL
;
1759 debug
.external_ext
= debug
.external_ext_end
= NULL
;
1760 if (! bfd_ecoff_debug_externals (stdoutput
, &debug
, debug_swap
, true,
1761 elf_get_extr
, elf_set_index
))
1762 as_fatal (_("Failed to set up debugging information: %s"),
1763 bfd_errmsg (bfd_get_error ()));
1765 sec
= bfd_get_section_by_name (stdoutput
, ".mdebug");
1766 assert (sec
!= NULL
);
1768 know (stdoutput
->output_has_begun
== false);
1770 /* We set the size of the section, call bfd_set_section_contents
1771 to force the ELF backend to allocate a file position, and then
1772 write out the data. FIXME: Is this really the best way to do
1774 sec
->_raw_size
= bfd_ecoff_debug_size (stdoutput
, &debug
, debug_swap
);
1776 /* Pass BUF to bfd_set_section_contents because this will
1777 eventually become a call to fwrite, and ISO C prohibits
1778 passing a NULL pointer to a stdio function even if the
1779 pointer will not be used. */
1780 if (! bfd_set_section_contents (stdoutput
, sec
, (PTR
) buf
,
1781 (file_ptr
) 0, (bfd_size_type
) 0))
1782 as_fatal (_("Can't start writing .mdebug section: %s"),
1783 bfd_errmsg (bfd_get_error ()));
1785 know (stdoutput
->output_has_begun
== true);
1786 know (sec
->filepos
!= 0);
1788 if (! bfd_ecoff_write_debug (stdoutput
, &debug
, debug_swap
,
1790 as_fatal (_("Could not write .mdebug section: %s"),
1791 bfd_errmsg (bfd_get_error ()));
1793 #endif /* NEED_ECOFF_DEBUG */
1798 /* Heavily plagarized from obj_elf_version. The idea is to emit the
1799 SCO specific identifier in the .notes section to satisfy the SCO
1802 This looks more complicated than it really is. As opposed to the
1803 "obvious" solution, this should handle the cross dev cases
1804 correctly. (i.e, hosting on a 64 bit big endian processor, but
1805 generating SCO Elf code) Efficiency isn't a concern, as there
1806 should be exactly one of these sections per object module.
1808 SCO OpenServer 5 identifies it's ELF modules with a standard ELF
1811 int_32 namesz = 4 ; Name size
1812 int_32 descsz = 12 ; Descriptive information
1814 char name[4] = "SCO" ; Originator name ALWAYS SCO + NULL
1815 int_32 version = (major ver # << 16) | version of tools ;
1816 int_32 source = (tool_id << 16 ) | 1 ;
1817 int_32 info = 0 ; These are set by the SCO tools, but we
1818 don't know enough about the source
1819 environment to set them. SCO ld currently
1820 ignores them, and recommends we set them
1823 #define SCO_MAJOR_VERSION 0x1
1824 #define SCO_MINOR_VERSION 0x1
1834 asection
*seg
= now_seg
;
1835 subsegT subseg
= now_subseg
;
1836 Elf_Internal_Note i_note
;
1837 Elf_External_Note e_note
;
1838 asection
*note_secp
= (asection
*) NULL
;
1841 /* create the .note section */
1843 note_secp
= subseg_new (".note", 0);
1844 bfd_set_section_flags (stdoutput
,
1846 SEC_HAS_CONTENTS
| SEC_READONLY
);
1848 /* process the version string */
1851 i_note
.descsz
= 12; /* 12 descriptive bytes */
1852 i_note
.type
= NT_VERSION
; /* Contains a version string */
1854 p
= frag_more (sizeof (i_note
.namesz
));
1855 md_number_to_chars (p
, (valueT
) i_note
.namesz
, 4);
1857 p
= frag_more (sizeof (i_note
.descsz
));
1858 md_number_to_chars (p
, (valueT
) i_note
.descsz
, 4);
1860 p
= frag_more (sizeof (i_note
.type
));
1861 md_number_to_chars (p
, (valueT
) i_note
.type
, 4);
1866 /* Note: this is the version number of the ELF we're representing */
1868 md_number_to_chars (p
, (SCO_MAJOR_VERSION
<< 16) | (SCO_MINOR_VERSION
), 4);
1870 /* Here, we pick a magic number for ourselves (yes, I "registered"
1871 it with SCO. The bottom bit shows that we are compat with the
1874 md_number_to_chars (p
, 0x4c520000 | 0x0001, 4);
1876 /* If we knew (or cared) what the source language options were, we'd
1877 fill them in here. SCO has given us permission to ignore these
1878 and just set them to zero. */
1880 md_number_to_chars (p
, 0x0000, 4);
1882 frag_align (2, 0, 0);
1884 /* We probably can't restore the current segment, for there likely
1887 subseg_set (seg
, subseg
);
1891 #endif /* SCO_ELF */
1893 const struct format_ops elf_format_ops
=
1895 bfd_target_elf_flavour
,
1896 0, /* dfl_leading_underscore */
1897 1, /* emit_section_symbols */
1900 elf_frob_file_after_relocs
,
1901 elf_s_get_size
, elf_s_set_size
,
1902 elf_s_get_align
, elf_s_set_align
,
1905 elf_copy_symbol_attributes
,
1906 #ifdef NEED_ECOFF_DEBUG
1907 ecoff_generate_asm_lineno
,
1910 0, /* generate_asm_lineno */
1911 0, /* process_stab */
1913 elf_sec_sym_ok_for_reloc
,
1915 #ifdef NEED_ECOFF_DEBUG
1918 0, /* ecoff_set_ext */
1920 elf_obj_read_begin_hook
,
1921 elf_obj_symbol_new_hook
,