Commit | Line | Data |
---|---|---|
db232882 KR |
1 | /* BFD back-end data structures for ELF files. |
2 | Copyright (C) 1992, 1993 Free Software Foundation, Inc. | |
3 | Written by Cygnus Support. | |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
7 | This program 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 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program 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 this program; if not, write to the Free Software | |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
20 | ||
21 | #ifndef _LIBELF_H_ | |
22 | #define _LIBELF_H_ 1 | |
23 | ||
81187b54 KR |
24 | #include "elf/common.h" |
25 | #include "elf/internal.h" | |
26 | #include "elf/external.h" | |
27 | ||
9942e684 | 28 | #ifndef NAME |
7050286d | 29 | #if ARCH_SIZE==64 |
9942e684 | 30 | #define NAME(x,y) CAT3(x,64_,y) |
9942e684 | 31 | #else /* ARCH_SIZE==32 */ |
9942e684 KR |
32 | #define NAME(x,y) CAT3(x,32_,y) |
33 | #endif | |
34 | #endif | |
35 | ||
7050286d KR |
36 | #define ElfNAME(X) NAME(Elf,X) |
37 | #define elfNAME(X) NAME(elf,X) | |
38 | ||
db232882 KR |
39 | typedef struct |
40 | { | |
41 | asymbol symbol; | |
7050286d KR |
42 | ElfNAME (Internal_Sym) internal_elf_sym; |
43 | ElfNAME (External_Sym) native_elf_sym; | |
db232882 KR |
44 | /* these are used for the generation of .stabX symbols (?) */ |
45 | short desc; | |
46 | unsigned char type; | |
47 | char other; | |
7050286d KR |
48 | union |
49 | { | |
50 | unsigned int hppa_arg_reloc; | |
51 | PTR any; | |
52 | } | |
53 | tc_data; | |
54 | } | |
db232882 | 55 | |
7050286d KR |
56 | elfNAME (symbol_type); |
57 | ||
58 | /* Lacking nested functions and nested types, set up for mapping over | |
59 | BFD sections to produce ELF sections. */ | |
60 | typedef struct | |
61 | { | |
62 | ElfNAME (Internal_Ehdr) * i_ehdr; | |
63 | ElfNAME (Internal_Shdr) * i_shdrp; | |
64 | struct strtab *shstrtab; | |
65 | int symtab_section; | |
66 | } | |
67 | ||
68 | elf_sect_thunk; | |
69 | ||
70 | struct elfNAME(backend_data) | |
71 | { | |
72 | int use_rela_p; | |
73 | int elf_64_p; | |
81187b54 | 74 | enum bfd_architecture arch; |
7050286d KR |
75 | void (*elf_info_to_howto) PARAMS ((bfd *, arelent *, |
76 | ElfNAME (Internal_Rela) *)); | |
77 | void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *, | |
78 | ElfNAME (Internal_Rel) *)); | |
db232882 | 79 | |
8e40bcd8 KR |
80 | /* @@ I really don't think this should be here. I don't know what |
81 | global_sym is supposed to be used for, but I doubt it's something | |
82 | that would be considered global, e.g., if you've got a program | |
83 | reading and writing many BFDs. My hunch is that it's specific to | |
84 | the output BFD. If not, put a comment here explaining why. */ | |
7050286d | 85 | elfNAME (symbol_type) * global_sym; |
81187b54 KR |
86 | }; |
87 | ||
9942e684 KR |
88 | extern bfd_target *bfd_elf32_object_p PARAMS ((bfd *)); |
89 | extern bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *)); | |
90 | extern boolean bfd_elf32_mkobject PARAMS ((bfd *)); | |
91 | extern boolean bfd_elf32_write_object_contents PARAMS ((bfd *)); | |
92 | extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *)); | |
93 | extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *)); | |
94 | extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *, | |
95 | bfd *)); | |
96 | extern boolean bfd_elf32_set_section_contents PARAMS ((bfd *, sec_ptr, PTR, | |
97 | file_ptr, | |
98 | bfd_size_type)); | |
7050286d KR |
99 | |
100 | extern boolean elf_get_sect_thunk PARAMS ((bfd *, elf_sect_thunk *)); | |
9942e684 KR |
101 | extern unsigned int bfd_elf32_get_symtab_upper_bound PARAMS ((bfd *)); |
102 | extern unsigned int bfd_elf32_get_symtab PARAMS ((bfd *, asymbol **)); | |
103 | extern unsigned int bfd_elf32_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); | |
104 | extern unsigned int bfd_elf32_canonicalize_reloc PARAMS ((bfd *, sec_ptr, | |
105 | arelent **, | |
106 | asymbol **)); | |
107 | extern asymbol *bfd_elf32_make_empty_symbol PARAMS ((bfd *)); | |
108 | extern void bfd_elf32_print_symbol PARAMS ((bfd *, PTR, asymbol *, | |
109 | bfd_print_symbol_type)); | |
110 | extern void bfd_elf32_get_symbol_info PARAMS ((bfd *, asymbol *, | |
7050286d | 111 | symbol_info *)); |
9942e684 KR |
112 | extern alent *bfd_elf32_get_lineno PARAMS ((bfd *, asymbol *)); |
113 | extern boolean bfd_elf32_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, | |
114 | unsigned long)); | |
115 | extern boolean bfd_elf32_find_nearest_line PARAMS ((bfd *, asection *, | |
116 | asymbol **, | |
117 | bfd_vma, CONST char **, | |
118 | CONST char **, | |
119 | unsigned int *)); | |
120 | extern int bfd_elf32_sizeof_headers PARAMS ((bfd *, boolean)); | |
7050286d | 121 | extern unsigned long elf_hash PARAMS ((CONST unsigned char *)); |
81187b54 KR |
122 | |
123 | /* If the target doesn't have reloc handling written yet: */ | |
9942e684 KR |
124 | extern void bfd_elf32_no_info_to_howto PARAMS ((bfd *, arelent *, |
125 | Elf32_Internal_Rela *)); | |
db232882 | 126 | |
7050286d KR |
127 | #define get_elf_backend_data(abfd) \ |
128 | ((struct elfNAME (backend_data) *) (abfd)->xvec->backend_data) | |
129 | ||
130 | struct strtab | |
131 | { | |
132 | char *tab; | |
133 | int nentries; | |
134 | int length; | |
135 | }; | |
136 | ||
137 | extern struct elf32_internal_shdr * | |
138 | bfd_elf_locate_sh PARAMS ((bfd *, struct strtab *, | |
139 | struct elf32_internal_shdr *, CONST char *)); | |
140 | ||
db232882 | 141 | #endif /* _LIBELF_H_ */ |