* dwarf2dbg.c (dwarf2_gen_line_info): Mirror the section symbol
[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
31#define OUTPUT_FLAVOR bfd_target_elf_flavour
32
33#include <bfd.h>
34
35#define BYTES_IN_WORD 4 /* for now */
36#include "bfd/elf-bfd.h"
37
49309057
ILT
38#include "targ-cpu.h"
39
40#ifdef TC_ALPHA
41#define ECOFF_DEBUGGING alpha_flag_mdebug
42extern int alpha_flag_mdebug;
43#endif
44
45/* For now, always set ECOFF_DEBUGGING for a MIPS target. */
46#ifdef TC_MIPS
47#ifdef MIPS_STABS_ELF
48#define ECOFF_DEBUGGING 0
49#else
50#define ECOFF_DEBUGGING 1
51#endif /* MIPS_STABS_ELF */
52#endif /* TC_MIPS */
53
252b5132
RH
54/* Additional information we keep for each symbol. */
55
56/* FIXME: For some reason, this structure is needed both here and in
57 obj-multi.h. */
58#ifndef OBJ_SYMFIELD_TYPE
59struct elf_obj_sy
60{
49309057
ILT
61 /* Whether the symbol has been marked as local. */
62 int local;
63
252b5132
RH
64 /* Use this to keep track of .size expressions that involve
65 differences that we can't compute yet. */
66 expressionS *size;
67
68 /* The name specified by the .symver directive. */
69 char *versioned_name;
49309057
ILT
70
71#ifdef ECOFF_DEBUGGING
72 /* If we are generating ECOFF debugging information, we need some
73 additional fields for each symbol. */
74 struct efdr *ecoff_file;
75 struct localsym *ecoff_symbol;
76 valueT ecoff_extern_size;
77#endif
252b5132
RH
78};
79#endif
80
81#define OBJ_SYMFIELD_TYPE struct elf_obj_sy
82
252b5132
RH
83#ifndef FALSE
84#define FALSE 0
85#define TRUE !FALSE
86#endif
87
88#define obj_begin() elf_begin ()
89extern void elf_begin PARAMS ((void));
90
91/* should be conditional on address size! */
92#define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
93
49309057
ILT
94#define S_GET_SIZE(S) \
95 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size)
252b5132 96#define S_SET_SIZE(S,V) \
49309057 97 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size = (V))
252b5132 98
49309057
ILT
99#define S_GET_ALIGN(S) \
100 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value)
252b5132 101#define S_SET_ALIGN(S,V) \
49309057 102 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value = (V))
252b5132 103
49309057
ILT
104#define S_GET_OTHER(S) \
105 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other)
252b5132 106#define S_SET_OTHER(S,V) \
49309057 107 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other = (V))
252b5132
RH
108
109extern asection *gdb_section;
110
111#define obj_frob_file elf_frob_file
112extern void elf_frob_file PARAMS ((void));
113
114#define obj_frob_file_after_relocs elf_frob_file_after_relocs
115extern void elf_frob_file_after_relocs PARAMS ((void));
116
117#define obj_app_file elf_file_symbol
118extern void elf_file_symbol PARAMS ((char *));
119
120extern void obj_elf_section_change_hook PARAMS ((void));
121
122extern void obj_elf_section PARAMS ((int));
123extern void obj_elf_previous PARAMS ((int));
124extern void obj_elf_version PARAMS ((int));
125
126/* BFD wants to write the udata field, which is a no-no for the
127 globally defined sections. */
128#define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0)
129
130/* When setting one symbol equal to another, by default we probably
131 want them to have the same "size", whatever it means in the current
132 context. */
133#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \
134do \
135 { \
49309057
ILT
136 struct elf_obj_sy *srcelf = symbol_get_obj (SRC); \
137 struct elf_obj_sy *destelf = symbol_get_obj (DEST); \
138 if (srcelf->size) \
252b5132 139 { \
49309057
ILT
140 if (destelf->size == NULL) \
141 destelf->size = \
252b5132 142 (expressionS *) xmalloc (sizeof (expressionS)); \
49309057 143 *destelf->size = *srcelf->size; \
252b5132
RH
144 } \
145 else \
146 { \
49309057
ILT
147 if (destelf->size != NULL) \
148 free (destelf->size); \
149 destelf->size = NULL; \
252b5132
RH
150 } \
151 S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \
152 S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \
153 } \
154while (0)
155
156/* Stabs go in a separate section. */
157#define SEPARATE_STAB_SECTIONS 1
158
159/* We need 12 bytes at the start of the section to hold some initial
160 information. */
161extern void obj_elf_init_stab_section PARAMS ((segT));
162#define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
163
252b5132 164#ifdef ECOFF_DEBUGGING
252b5132
RH
165/* We smuggle stabs in ECOFF rather than using a separate section.
166 The Irix linker can not handle a separate stabs section. */
167
168#undef SEPARATE_STAB_SECTIONS
169#define SEPARATE_STAB_SECTIONS (!ECOFF_DEBUGGING)
170
171#undef INIT_STAB_SECTION
172#define INIT_STAB_SECTION(seg) \
173 ((void)(ECOFF_DEBUGGING ? 0 : (obj_elf_init_stab_section (seg), 0)))
174
175#define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \
176 if (ECOFF_DEBUGGING) \
177 ecoff_stab ((seg), (what), (string), (type), (other), (desc))
178#endif /* ECOFF_DEBUGGING */
179
49309057 180extern void elf_frob_symbol PARAMS ((symbolS *, int *));
252b5132
RH
181#ifndef obj_frob_symbol
182#define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt)
183#endif
184
185extern void elf_pop_insert PARAMS ((void));
186#define obj_pop_insert() elf_pop_insert()
187
188#ifndef OBJ_MAYBE_ELF
189#define obj_ecoff_set_ext elf_ecoff_set_ext
190#ifdef ANSI_PROTOTYPES
191struct ecoff_extr;
192#endif
49309057 193extern void elf_ecoff_set_ext PARAMS ((symbolS *, struct ecoff_extr *));
252b5132
RH
194#endif
195
196#endif /* _OBJ_ELF_H */
This page took 0.047598 seconds and 4 git commands to generate.