1 /* ELF object file format.
2 Copyright (C) 1992, 93, 94, 95, 96, 1997 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 published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 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
22 /* HP PA-RISC support was contributed by the Center for Software Science
23 at the University of Utah. */
30 #define OUTPUT_FLAVOR bfd_target_elf_flavour
34 #define BYTES_IN_WORD 4 /* for now */
35 #include "bfd/elf-bfd.h"
37 /* Additional information we keep for each symbol. */
39 /* FIXME: For some reason, this structure is needed both here and in
41 #ifndef OBJ_SYMFIELD_TYPE
44 /* Use this to keep track of .size expressions that involve
45 differences that we can't compute yet. */
48 /* The name specified by the .symver directive. */
53 #define OBJ_SYMFIELD_TYPE struct elf_obj_sy
55 /* Symbol fields used by the ELF back end. */
56 #define ELF_TARGET_SYMBOL_FIELDS int local:1;
58 /* Don't change this; change ELF_TARGET_SYMBOL_FIELDS instead. */
59 #define TARGET_SYMBOL_FIELDS ELF_TARGET_SYMBOL_FIELDS
68 #define obj_begin() elf_begin ()
69 extern void elf_begin PARAMS ((void));
71 /* should be conditional on address size! */
72 #define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
74 #define S_GET_SIZE(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_size)
75 #define S_SET_SIZE(S,V) \
76 (elf_symbol((S)->bsym)->internal_elf_sym.st_size = (V))
78 #define S_GET_ALIGN(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_value)
79 #define S_SET_ALIGN(S,V) \
80 (elf_symbol ((S)->bsym)->internal_elf_sym.st_value = (V))
82 #define S_GET_OTHER(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_other)
83 #define S_SET_OTHER(S,V) \
84 (elf_symbol ((S)->bsym)->internal_elf_sym.st_other = (V))
86 extern asection *gdb_section;
88 #define obj_frob_file elf_frob_file
89 extern void elf_frob_file PARAMS ((void));
91 #define obj_frob_file_after_relocs elf_frob_file_after_relocs
92 extern void elf_frob_file_after_relocs PARAMS ((void));
94 #define obj_app_file elf_file_symbol
95 extern void elf_file_symbol PARAMS ((char *));
97 extern void obj_elf_section_change_hook PARAMS ((void));
99 extern void obj_elf_section PARAMS ((int));
100 extern void obj_elf_previous PARAMS ((int));
101 extern void obj_elf_version PARAMS ((int));
103 /* BFD wants to write the udata field, which is a no-no for the
104 globally defined sections. */
105 #define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0)
107 /* When setting one symbol equal to another, by default we probably
108 want them to have the same "size", whatever it means in the current
110 #define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \
113 if ((SRC)->sy_obj.size) \
115 if ((DEST)->sy_obj.size == NULL) \
116 (DEST)->sy_obj.size = \
117 (expressionS *) xmalloc (sizeof (expressionS)); \
118 *(DEST)->sy_obj.size = *(SRC)->sy_obj.size; \
122 if ((DEST)->sy_obj.size != NULL) \
123 free ((DEST)->sy_obj.size); \
124 (DEST)->sy_obj.size = NULL; \
126 S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \
127 S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \
131 /* Stabs go in a separate section. */
132 #define SEPARATE_STAB_SECTIONS 1
134 /* We need 12 bytes at the start of the section to hold some initial
136 extern void obj_elf_init_stab_section PARAMS ((segT));
137 #define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
139 /* For now, always set ECOFF_DEBUGGING for an Alpha target. */
141 #define ECOFF_DEBUGGING 1
144 /* For now, always set ECOFF_DEBUGGING for a MIPS target. */
146 #define ECOFF_DEBUGGING 1
151 /* If we are generating ECOFF debugging information, we need some
152 additional fields for each symbol. */
153 #undef TARGET_SYMBOL_FIELDS
154 #define TARGET_SYMBOL_FIELDS \
155 ELF_TARGET_SYMBOL_FIELDS \
156 struct efdr *ecoff_file; \
157 struct localsym *ecoff_symbol; \
158 valueT ecoff_extern_size;
160 /* We smuggle stabs in ECOFF rather than using a separate section.
161 The Irix linker can not handle a separate stabs section. */
162 #undef SEPARATE_STAB_SECTIONS
163 #undef INIT_STAB_SECTION
164 #define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \
165 ecoff_stab ((seg), (what), (string), (type), (other), (desc))
167 #define OBJ_GENERATE_ASM_LINENO(filename, lineno) \
168 ecoff_generate_asm_lineno ((filename), (lineno))
170 #endif /* ECOFF_DEBUGGING */
172 extern void elf_frob_symbol PARAMS ((struct symbol *, int *));
173 #define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt)
175 extern void elf_pop_insert PARAMS ((void));
176 #define obj_pop_insert() elf_pop_insert()
178 #ifndef OBJ_MAYBE_ELF
179 #define obj_ecoff_set_ext elf_ecoff_set_ext
180 #ifdef ANSI_PROTOTYPES
183 extern void elf_ecoff_set_ext PARAMS ((struct symbol *, struct ecoff_extr *));
186 #endif /* _OBJ_ELF_H */