Enable --emulation={i386coff,i386elf} for i386 gas.
[deliverable/binutils-gdb.git] / gas / config / obj-elf.h
CommitLineData
252b5132 1/* ELF object file format.
49309057
ILT
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
3 Free Software Foundation, Inc.
252b5132
RH
4
5 This file is part of GAS, the GNU Assembler.
6
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 1, or (at your option)
10 any later version.
11
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
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
20 02111-1307, USA. */
21
22
23/* HP PA-RISC support was contributed by the Center for Software Science
24 at the University of Utah. */
25
26#ifndef _OBJ_ELF_H
27#define _OBJ_ELF_H
28
29#define OBJ_ELF 1
30
4ca72d38 31#ifndef OUTPUT_FLAVOR
252b5132 32#define OUTPUT_FLAVOR bfd_target_elf_flavour
4ca72d38 33#endif
252b5132
RH
34
35#include <bfd.h>
36
37#define BYTES_IN_WORD 4 /* for now */
38#include "bfd/elf-bfd.h"
39
49309057
ILT
40#include "targ-cpu.h"
41
42#ifdef TC_ALPHA
43#define ECOFF_DEBUGGING alpha_flag_mdebug
44extern int alpha_flag_mdebug;
45#endif
46
47/* For now, always set ECOFF_DEBUGGING for a MIPS target. */
48#ifdef TC_MIPS
49#ifdef MIPS_STABS_ELF
50#define ECOFF_DEBUGGING 0
51#else
52#define ECOFF_DEBUGGING 1
53#endif /* MIPS_STABS_ELF */
54#endif /* TC_MIPS */
55
252b5132 56/* Additional information we keep for each symbol. */
252b5132
RH
57struct elf_obj_sy
58{
49309057
ILT
59 /* Whether the symbol has been marked as local. */
60 int local;
61
252b5132
RH
62 /* Use this to keep track of .size expressions that involve
63 differences that we can't compute yet. */
64 expressionS *size;
65
66 /* The name specified by the .symver directive. */
67 char *versioned_name;
49309057
ILT
68
69#ifdef ECOFF_DEBUGGING
70 /* If we are generating ECOFF debugging information, we need some
71 additional fields for each symbol. */
72 struct efdr *ecoff_file;
73 struct localsym *ecoff_symbol;
74 valueT ecoff_extern_size;
75#endif
252b5132 76};
252b5132
RH
77
78#define OBJ_SYMFIELD_TYPE struct elf_obj_sy
79
252b5132
RH
80#ifndef FALSE
81#define FALSE 0
82#define TRUE !FALSE
83#endif
84
85#define obj_begin() elf_begin ()
86extern void elf_begin PARAMS ((void));
87
88/* should be conditional on address size! */
89#define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
90
4ca72d38 91#ifndef S_GET_SIZE
49309057
ILT
92#define S_GET_SIZE(S) \
93 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size)
4ca72d38
AM
94#endif
95#ifndef S_SET_SIZE
252b5132 96#define S_SET_SIZE(S,V) \
49309057 97 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size = (V))
4ca72d38 98#endif
252b5132 99
4ca72d38 100#ifndef S_GET_ALIGN
49309057
ILT
101#define S_GET_ALIGN(S) \
102 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value)
4ca72d38
AM
103#endif
104#ifndef S_SET_ALIGN
252b5132 105#define S_SET_ALIGN(S,V) \
49309057 106 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value = (V))
4ca72d38 107#endif
252b5132 108
49309057
ILT
109#define S_GET_OTHER(S) \
110 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other)
252b5132 111#define S_SET_OTHER(S,V) \
49309057 112 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other = (V))
252b5132
RH
113
114extern asection *gdb_section;
115
4ca72d38 116#ifndef obj_frob_file
252b5132 117#define obj_frob_file elf_frob_file
4ca72d38 118#endif
252b5132
RH
119extern void elf_frob_file PARAMS ((void));
120
4ca72d38 121#ifndef obj_frob_file_after_relocs
252b5132 122#define obj_frob_file_after_relocs elf_frob_file_after_relocs
4ca72d38 123#endif
252b5132
RH
124extern void elf_frob_file_after_relocs PARAMS ((void));
125
126#define obj_app_file elf_file_symbol
127extern void elf_file_symbol PARAMS ((char *));
128
129extern void obj_elf_section_change_hook PARAMS ((void));
130
131extern void obj_elf_section PARAMS ((int));
132extern void obj_elf_previous PARAMS ((int));
133extern void obj_elf_version PARAMS ((int));
40b10cc7
NC
134extern void obj_elf_common PARAMS ((int));
135extern void obj_elf_data PARAMS ((int));
136extern void obj_elf_text PARAMS ((int));
252b5132
RH
137
138/* BFD wants to write the udata field, which is a no-no for the
139 globally defined sections. */
4ca72d38 140#ifndef obj_sec_sym_ok_for_reloc
252b5132 141#define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0)
4ca72d38 142#endif
252b5132
RH
143
144/* When setting one symbol equal to another, by default we probably
145 want them to have the same "size", whatever it means in the current
146 context. */
4ca72d38 147#ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
252b5132
RH
148#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \
149do \
150 { \
49309057
ILT
151 struct elf_obj_sy *srcelf = symbol_get_obj (SRC); \
152 struct elf_obj_sy *destelf = symbol_get_obj (DEST); \
153 if (srcelf->size) \
252b5132 154 { \
49309057
ILT
155 if (destelf->size == NULL) \
156 destelf->size = \
252b5132 157 (expressionS *) xmalloc (sizeof (expressionS)); \
49309057 158 *destelf->size = *srcelf->size; \
252b5132
RH
159 } \
160 else \
161 { \
49309057
ILT
162 if (destelf->size != NULL) \
163 free (destelf->size); \
164 destelf->size = NULL; \
252b5132
RH
165 } \
166 S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \
167 S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \
168 } \
169while (0)
4ca72d38 170#endif
252b5132
RH
171
172/* Stabs go in a separate section. */
173#define SEPARATE_STAB_SECTIONS 1
174
175/* We need 12 bytes at the start of the section to hold some initial
176 information. */
177extern void obj_elf_init_stab_section PARAMS ((segT));
178#define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
179
252b5132 180#ifdef ECOFF_DEBUGGING
252b5132
RH
181/* We smuggle stabs in ECOFF rather than using a separate section.
182 The Irix linker can not handle a separate stabs section. */
183
184#undef SEPARATE_STAB_SECTIONS
185#define SEPARATE_STAB_SECTIONS (!ECOFF_DEBUGGING)
186
187#undef INIT_STAB_SECTION
188#define INIT_STAB_SECTION(seg) \
189 ((void)(ECOFF_DEBUGGING ? 0 : (obj_elf_init_stab_section (seg), 0)))
190
4ca72d38 191#undef OBJ_PROCESS_STAB
252b5132
RH
192#define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \
193 if (ECOFF_DEBUGGING) \
194 ecoff_stab ((seg), (what), (string), (type), (other), (desc))
195#endif /* ECOFF_DEBUGGING */
196
49309057 197extern void elf_frob_symbol PARAMS ((symbolS *, int *));
252b5132
RH
198#ifndef obj_frob_symbol
199#define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt)
200#endif
201
202extern void elf_pop_insert PARAMS ((void));
4ca72d38 203#ifndef obj_pop_insert
252b5132 204#define obj_pop_insert() elf_pop_insert()
4ca72d38 205#endif
252b5132
RH
206
207#ifndef OBJ_MAYBE_ELF
208#define obj_ecoff_set_ext elf_ecoff_set_ext
209#ifdef ANSI_PROTOTYPES
210struct ecoff_extr;
211#endif
49309057 212extern void elf_ecoff_set_ext PARAMS ((symbolS *, struct ecoff_extr *));
252b5132
RH
213#endif
214
215#endif /* _OBJ_ELF_H */
This page took 0.040731 seconds and 4 git commands to generate.