Commit | Line | Data |
---|---|---|
bd4d4b8a | 1 | /* ELF object file format. |
d88cc85d | 2 | Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. |
bd4d4b8a KR |
3 | |
4 | This file is part of GAS, the GNU Assembler. | |
5 | ||
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) | |
9 | any later version. | |
10 | ||
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. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
8095b665 ILT |
17 | along with GAS; see the file COPYING. If not, write to the Free |
18 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
bd4d4b8a KR |
20 | |
21 | ||
22 | /* HP PA-RISC support was contributed by the Center for Software Science | |
23 | at the University of Utah. */ | |
24 | ||
25 | #ifndef _OBJ_ELF_H | |
26 | #define _OBJ_ELF_H | |
27 | ||
28 | #define OBJ_ELF 1 | |
29 | ||
5b9a7bef KR |
30 | #define OUTPUT_FLAVOR bfd_target_elf_flavour |
31 | ||
bd4d4b8a KR |
32 | #include <bfd.h> |
33 | ||
34 | #define BYTES_IN_WORD 4 /* for now */ | |
8095b665 | 35 | #include "bfd/elf-bfd.h" |
5b9a7bef | 36 | |
d88cc85d ILT |
37 | /* Additional information we keep for each symbol. */ |
38 | ||
39 | struct elf_obj_sy | |
40 | { | |
41 | /* Use this to keep track of .size expressions that involve | |
42 | differences that we can't compute yet. */ | |
43 | expressionS *size; | |
44 | ||
45 | /* The name specified by the .symver directive. */ | |
46 | char *versioned_name; | |
47 | }; | |
48 | ||
49 | #define OBJ_SYMFIELD_TYPE struct elf_obj_sy | |
bd4d4b8a | 50 | |
c6858c1b | 51 | /* Symbol fields used by the ELF back end. */ |
8095b665 | 52 | #define ELF_TARGET_SYMBOL_FIELDS int local:1; |
c6858c1b ILT |
53 | |
54 | /* Don't change this; change ELF_TARGET_SYMBOL_FIELDS instead. */ | |
55 | #define TARGET_SYMBOL_FIELDS ELF_TARGET_SYMBOL_FIELDS | |
bd4d4b8a | 56 | |
bd4d4b8a KR |
57 | #include "targ-cpu.h" |
58 | ||
59 | #ifndef FALSE | |
60 | #define FALSE 0 | |
61 | #define TRUE !FALSE | |
62 | #endif | |
63 | ||
0bd28bc4 ILT |
64 | #define obj_begin() elf_begin () |
65 | extern void elf_begin PARAMS ((void)); | |
66 | ||
bd4d4b8a | 67 | /* should be conditional on address size! */ |
6a54ad63 | 68 | #define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd)) |
bd4d4b8a | 69 | |
80903ca6 | 70 | #define S_GET_SIZE(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_size) |
58d4951d ILT |
71 | #define S_SET_SIZE(S,V) \ |
72 | (elf_symbol((S)->bsym)->internal_elf_sym.st_size = (V)) | |
bd4d4b8a | 73 | |
6f89cd42 KH |
74 | #define S_GET_ALIGN(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_value) |
75 | #define S_SET_ALIGN(S,V) \ | |
76 | (elf_symbol ((S)->bsym)->internal_elf_sym.st_value = (V)) | |
77 | ||
d88cc85d ILT |
78 | #define S_GET_OTHER(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_other) |
79 | #define S_SET_OTHER(S,V) \ | |
80 | (elf_symbol ((S)->bsym)->internal_elf_sym.st_other = (V)) | |
bd4d4b8a | 81 | |
d88cc85d | 82 | extern asection *gdb_section; |
bd4d4b8a | 83 | |
d88cc85d | 84 | #define obj_frob_file elf_frob_file |
bd4d4b8a | 85 | extern void elf_frob_file PARAMS ((void)); |
d88cc85d ILT |
86 | |
87 | #define obj_frob_file_after_relocs elf_frob_file_after_relocs | |
88 | extern void elf_frob_file_after_relocs PARAMS ((void)); | |
89 | ||
5b9a7bef | 90 | #define obj_app_file elf_file_symbol |
d88cc85d | 91 | extern void elf_file_symbol PARAMS ((char *)); |
bd4d4b8a | 92 | |
6a54ad63 | 93 | extern void obj_elf_section PARAMS ((int)); |
80903ca6 | 94 | extern void obj_elf_previous PARAMS ((int)); |
c6858c1b | 95 | extern void obj_elf_version PARAMS ((int)); |
80903ca6 | 96 | |
6f89cd42 KH |
97 | /* BFD wants to write the udata field, which is a no-no for the |
98 | globally defined sections. */ | |
99 | #define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0) | |
100 | ||
9a36b83f KR |
101 | /* When setting one symbol equal to another, by default we probably |
102 | want them to have the same "size", whatever it means in the current | |
103 | context. */ | |
d88cc85d ILT |
104 | #define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \ |
105 | do \ | |
106 | { \ | |
107 | S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \ | |
108 | S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \ | |
109 | } \ | |
110 | while (0) | |
9a36b83f | 111 | |
80903ca6 | 112 | /* Stabs go in a separate section. */ |
e51a3912 | 113 | #define SEPARATE_STAB_SECTIONS 1 |
80903ca6 ILT |
114 | |
115 | /* We need 12 bytes at the start of the section to hold some initial | |
116 | information. */ | |
c6858c1b ILT |
117 | extern void obj_elf_init_stab_section PARAMS ((segT)); |
118 | #define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg) | |
119 | ||
0bd28bc4 ILT |
120 | /* For now, always set ECOFF_DEBUGGING for an Alpha target. */ |
121 | #ifdef TC_ALPHA | |
122 | #define ECOFF_DEBUGGING 1 | |
123 | #endif | |
124 | ||
c6858c1b ILT |
125 | /* For now, always set ECOFF_DEBUGGING for a MIPS target. */ |
126 | #ifdef TC_MIPS | |
5b9a7bef | 127 | #define ECOFF_DEBUGGING 1 |
c6858c1b ILT |
128 | #endif |
129 | ||
5b9a7bef | 130 | #if ECOFF_DEBUGGING |
c6858c1b ILT |
131 | |
132 | /* If we are generating ECOFF debugging information, we need some | |
133 | additional fields for each symbol. */ | |
134 | #undef TARGET_SYMBOL_FIELDS | |
135 | #define TARGET_SYMBOL_FIELDS \ | |
136 | ELF_TARGET_SYMBOL_FIELDS \ | |
137 | struct efdr *ecoff_file; \ | |
138 | struct localsym *ecoff_symbol; \ | |
6f89cd42 | 139 | valueT ecoff_extern_size; |
c6858c1b ILT |
140 | |
141 | /* We smuggle stabs in ECOFF rather than using a separate section. | |
142 | The Irix linker can not handle a separate stabs section. */ | |
143 | #undef SEPARATE_STAB_SECTIONS | |
144 | #undef INIT_STAB_SECTION | |
5b9a7bef | 145 | #define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \ |
8095b665 | 146 | ecoff_stab ((seg), (what), (string), (type), (other), (desc)) |
c6858c1b | 147 | |
ad14517d KH |
148 | #define OBJ_GENERATE_ASM_LINENO(filename, lineno) \ |
149 | ecoff_generate_asm_lineno ((filename), (lineno)) | |
6f89cd42 | 150 | |
c6858c1b | 151 | #endif /* ECOFF_DEBUGGING */ |
6a54ad63 | 152 | |
8095b665 ILT |
153 | extern void elf_frob_symbol PARAMS ((struct symbol *, int *)); |
154 | #define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt) | |
155 | ||
156 | extern void elf_pop_insert PARAMS ((void)); | |
157 | #define obj_pop_insert() elf_pop_insert() | |
158 | ||
159 | #ifndef OBJ_MAYBE_ELF | |
160 | #define obj_ecoff_set_ext elf_ecoff_set_ext | |
161 | extern void elf_ecoff_set_ext (); | |
162 | #endif | |
5b9a7bef | 163 | |
bd4d4b8a | 164 | #endif /* _OBJ_ELF_H */ |