Modified Files:
[binutils-gdb.git] / gas / config / obj-elf.h
1 /* ELF object file format.
2 Copyright (C) 1992, 1993 Free Software Foundation, Inc.
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
17 along with GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20
21 /* HP PA-RISC support was contributed by the Center for Software Science
22 at the University of Utah. */
23
24 #ifndef _OBJ_ELF_H
25 #define _OBJ_ELF_H
26
27 #define OBJ_ELF 1
28
29 #include <bfd.h>
30
31 #define BYTES_IN_WORD 4 /* for now */
32 #include "../bfd/libelf.h"
33
34 /* Symbol fields used by the ELF back end. */
35 #define ELF_TARGET_SYMBOL_FIELDS int local:1; unsigned long sy_name_offset;
36
37 /* Don't change this; change ELF_TARGET_SYMBOL_FIELDS instead. */
38 #define TARGET_SYMBOL_FIELDS ELF_TARGET_SYMBOL_FIELDS
39
40 #include "targ-cpu.h"
41
42 #ifndef FALSE
43 #define FALSE 0
44 #define TRUE !FALSE
45 #endif
46
47 /* should be conditional on address size! */
48 #define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
49
50 #define S_GET_SIZE(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_size)
51 #define S_SET_SIZE(S,V) \
52 (elf_symbol((S)->bsym)->internal_elf_sym.st_size = (V))
53
54 #define S_GET_ALIGN(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_value)
55 #define S_SET_ALIGN(S,V) \
56 (elf_symbol ((S)->bsym)->internal_elf_sym.st_value = (V))
57
58 extern asection *gdb_section;
59
60 /* Copy over the function bit and size of a forwarded symbol. */
61 #define obj_frob_forward_symbol(sym) \
62 (((sym)->bsym->flags |= \
63 ((sym)->sy_value.X_add_symbol->bsym->flags & BSF_FUNCTION)), \
64 S_SET_SIZE ((sym), S_GET_SIZE ((sym)->sy_value.X_add_symbol)))
65
66 #define obj_frob_file() elf_frob_file()
67
68 extern void elf_frob_file PARAMS ((void));
69 extern void elf_file_symbol PARAMS ((char *));
70
71 extern void obj_elf_section PARAMS ((int));
72 extern void obj_elf_previous PARAMS ((int));
73 extern void obj_elf_version PARAMS ((int));
74
75 /* BFD wants to write the udata field, which is a no-no for the
76 globally defined sections. */
77 #define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0)
78
79 /* Stabs go in a separate section. */
80 #define SEPARATE_STAB_SECTIONS
81
82 /* We need 12 bytes at the start of the section to hold some initial
83 information. */
84 extern void obj_elf_init_stab_section PARAMS ((segT));
85 #define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
86
87 /* For now, always set ECOFF_DEBUGGING for a MIPS target. */
88 #ifdef TC_MIPS
89 #define ECOFF_DEBUGGING
90 #endif
91
92 #ifdef ECOFF_DEBUGGING
93
94 /* If we are generating ECOFF debugging information, we need some
95 additional fields for each symbol. */
96 #undef TARGET_SYMBOL_FIELDS
97 #define TARGET_SYMBOL_FIELDS \
98 ELF_TARGET_SYMBOL_FIELDS \
99 struct efdr *ecoff_file; \
100 struct localsym *ecoff_symbol; \
101 valueT ecoff_extern_size;
102
103 /* We smuggle stabs in ECOFF rather than using a separate section.
104 The Irix linker can not handle a separate stabs section. */
105 #undef SEPARATE_STAB_SECTIONS
106 #undef INIT_STAB_SECTION
107 #define OBJ_PROCESS_STAB(what, string, type, other, desc) \
108 ecoff_stab ((what), (string), (type), (other), (desc))
109
110 #define OBJ_GENERATE_ASM_LINENO(filename, lineno) \
111 ecoff_generate_asm_lineno ((filename), (lineno))
112
113 /* ECOFF requires that we call the ecoff_frob_symbol hook. */
114 #define obj_frob_symbol(symp, punt) ecoff_frob_symbol (symp)
115
116 #endif /* ECOFF_DEBUGGING */
117
118 #endif /* _OBJ_ELF_H */