1 |
/* i370-specific support for 32-bit ELF |
/* i370-specific support for 32-bit ELF |
2 |
Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 |
Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 |
3 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
4 |
Written by Ian Lance Taylor, Cygnus Support. |
Written by Ian Lance Taylor, Cygnus Support. |
5 |
Hacked by Linas Vepstas for i370 linas@linas.org |
Hacked by Linas Vepstas for i370 linas@linas.org |
34 |
#include "elf-bfd.h" |
#include "elf-bfd.h" |
35 |
#include "elf/i370.h" |
#include "elf/i370.h" |
36 |
|
|
|
#define USE_RELA /* we want RELA relocations, not REL */ |
|
|
|
|
|
/* i370 relocations */ |
|
|
/* Note that there is really just one relocation that we currently |
|
|
* support (and only one that we seem to need, at the moment), and |
|
|
* that is the 31-bit address relocation. Note that the 370/390 |
|
|
* only supports a 31-bit (2GB) address space. |
|
|
*/ |
|
|
enum i370_reloc_type |
|
|
{ |
|
|
R_I370_NONE = 0, |
|
|
R_I370_ADDR31 = 1, |
|
|
R_I370_ADDR32 = 2, |
|
|
R_I370_ADDR16 = 3, |
|
|
R_I370_REL31 = 4, |
|
|
R_I370_REL32 = 5, |
|
|
R_I370_ADDR12 = 6, |
|
|
R_I370_REL12 = 7, |
|
|
R_I370_ADDR8 = 8, |
|
|
R_I370_REL8 = 9, |
|
|
R_I370_COPY = 10, |
|
|
R_I370_RELATIVE = 11, |
|
|
|
|
|
R_I370_max |
|
|
}; |
|
|
|
|
37 |
static reloc_howto_type *i370_elf_howto_table[ (int)R_I370_max ]; |
static reloc_howto_type *i370_elf_howto_table[ (int)R_I370_max ]; |
38 |
|
|
39 |
static reloc_howto_type i370_elf_howto_raw[] = |
static reloc_howto_type i370_elf_howto_raw[] = |
43 |
0, /* rightshift */ |
0, /* rightshift */ |
44 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
45 |
32, /* bitsize */ |
32, /* bitsize */ |
46 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
47 |
0, /* bitpos */ |
0, /* bitpos */ |
48 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
49 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
50 |
"R_I370_NONE", /* name */ |
"R_I370_NONE", /* name */ |
51 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
52 |
0, /* src_mask */ |
0, /* src_mask */ |
53 |
0, /* dst_mask */ |
0, /* dst_mask */ |
54 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
55 |
|
|
56 |
/* A standard 31 bit relocation. */ |
/* A standard 31 bit relocation. */ |
57 |
HOWTO (R_I370_ADDR31, /* type */ |
HOWTO (R_I370_ADDR31, /* type */ |
58 |
0, /* rightshift */ |
0, /* rightshift */ |
59 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
60 |
31, /* bitsize */ |
31, /* bitsize */ |
61 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
62 |
0, /* bitpos */ |
0, /* bitpos */ |
63 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
64 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
65 |
"R_I370_ADDR31", /* name */ |
"R_I370_ADDR31", /* name */ |
66 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
67 |
0, /* src_mask */ |
0, /* src_mask */ |
68 |
0x7fffffff, /* dst_mask */ |
0x7fffffff, /* dst_mask */ |
69 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
70 |
|
|
71 |
/* A standard 32 bit relocation. */ |
/* A standard 32 bit relocation. */ |
72 |
HOWTO (R_I370_ADDR32, /* type */ |
HOWTO (R_I370_ADDR32, /* type */ |
73 |
0, /* rightshift */ |
0, /* rightshift */ |
74 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
75 |
32, /* bitsize */ |
32, /* bitsize */ |
76 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
77 |
0, /* bitpos */ |
0, /* bitpos */ |
78 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
79 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
80 |
"R_I370_ADDR32", /* name */ |
"R_I370_ADDR32", /* name */ |
81 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
82 |
0, /* src_mask */ |
0, /* src_mask */ |
83 |
0xffffffff, /* dst_mask */ |
0xffffffff, /* dst_mask */ |
84 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
85 |
|
|
86 |
/* A standard 16 bit relocation. */ |
/* A standard 16 bit relocation. */ |
87 |
HOWTO (R_I370_ADDR16, /* type */ |
HOWTO (R_I370_ADDR16, /* type */ |
88 |
0, /* rightshift */ |
0, /* rightshift */ |
89 |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
90 |
16, /* bitsize */ |
16, /* bitsize */ |
91 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
92 |
0, /* bitpos */ |
0, /* bitpos */ |
93 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
94 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
95 |
"R_I370_ADDR16", /* name */ |
"R_I370_ADDR16", /* name */ |
96 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
97 |
0, /* src_mask */ |
0, /* src_mask */ |
98 |
0xffff, /* dst_mask */ |
0xffff, /* dst_mask */ |
99 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
100 |
|
|
101 |
/* 31-bit PC relative */ |
/* 31-bit PC relative */ |
102 |
HOWTO (R_I370_REL31, /* type */ |
HOWTO (R_I370_REL31, /* type */ |
103 |
0, /* rightshift */ |
0, /* rightshift */ |
104 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
105 |
31, /* bitsize */ |
31, /* bitsize */ |
106 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
107 |
0, /* bitpos */ |
0, /* bitpos */ |
108 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
109 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
110 |
"R_I370_REL31", /* name */ |
"R_I370_REL31", /* name */ |
111 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
112 |
0, /* src_mask */ |
0, /* src_mask */ |
113 |
0x7fffffff, /* dst_mask */ |
0x7fffffff, /* dst_mask */ |
114 |
true), /* pcrel_offset */ |
TRUE), /* pcrel_offset */ |
115 |
|
|
116 |
/* 32-bit PC relative */ |
/* 32-bit PC relative */ |
117 |
HOWTO (R_I370_REL32, /* type */ |
HOWTO (R_I370_REL32, /* type */ |
118 |
0, /* rightshift */ |
0, /* rightshift */ |
119 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
120 |
32, /* bitsize */ |
32, /* bitsize */ |
121 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
122 |
0, /* bitpos */ |
0, /* bitpos */ |
123 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
124 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
125 |
"R_I370_REL32", /* name */ |
"R_I370_REL32", /* name */ |
126 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
127 |
0, /* src_mask */ |
0, /* src_mask */ |
128 |
0xffffffff, /* dst_mask */ |
0xffffffff, /* dst_mask */ |
129 |
true), /* pcrel_offset */ |
TRUE), /* pcrel_offset */ |
130 |
|
|
131 |
/* A standard 12 bit relocation. */ |
/* A standard 12 bit relocation. */ |
132 |
HOWTO (R_I370_ADDR12, /* type */ |
HOWTO (R_I370_ADDR12, /* type */ |
133 |
0, /* rightshift */ |
0, /* rightshift */ |
134 |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
135 |
12, /* bitsize */ |
12, /* bitsize */ |
136 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
137 |
0, /* bitpos */ |
0, /* bitpos */ |
138 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
139 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
140 |
"R_I370_ADDR12", /* name */ |
"R_I370_ADDR12", /* name */ |
141 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
142 |
0, /* src_mask */ |
0, /* src_mask */ |
143 |
0xfff, /* dst_mask */ |
0xfff, /* dst_mask */ |
144 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
145 |
|
|
146 |
/* 12-bit PC relative */ |
/* 12-bit PC relative */ |
147 |
HOWTO (R_I370_REL12, /* type */ |
HOWTO (R_I370_REL12, /* type */ |
148 |
0, /* rightshift */ |
0, /* rightshift */ |
149 |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
150 |
12, /* bitsize */ |
12, /* bitsize */ |
151 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
152 |
0, /* bitpos */ |
0, /* bitpos */ |
153 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
154 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
155 |
"R_I370_REL12", /* name */ |
"R_I370_REL12", /* name */ |
156 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
157 |
0, /* src_mask */ |
0, /* src_mask */ |
158 |
0xfff, /* dst_mask */ |
0xfff, /* dst_mask */ |
159 |
true), /* pcrel_offset */ |
TRUE), /* pcrel_offset */ |
160 |
|
|
161 |
/* A standard 8 bit relocation. */ |
/* A standard 8 bit relocation. */ |
162 |
HOWTO (R_I370_ADDR8, /* type */ |
HOWTO (R_I370_ADDR8, /* type */ |
163 |
0, /* rightshift */ |
0, /* rightshift */ |
164 |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
165 |
8, /* bitsize */ |
8, /* bitsize */ |
166 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
167 |
0, /* bitpos */ |
0, /* bitpos */ |
168 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
169 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
170 |
"R_I370_ADDR8", /* name */ |
"R_I370_ADDR8", /* name */ |
171 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
172 |
0, /* src_mask */ |
0, /* src_mask */ |
173 |
0xff, /* dst_mask */ |
0xff, /* dst_mask */ |
174 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
175 |
|
|
176 |
/* 8-bit PC relative */ |
/* 8-bit PC relative */ |
177 |
HOWTO (R_I370_REL8, /* type */ |
HOWTO (R_I370_REL8, /* type */ |
178 |
0, /* rightshift */ |
0, /* rightshift */ |
179 |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
180 |
8, /* bitsize */ |
8, /* bitsize */ |
181 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
182 |
0, /* bitpos */ |
0, /* bitpos */ |
183 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
184 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
185 |
"R_I370_REL8", /* name */ |
"R_I370_REL8", /* name */ |
186 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
187 |
0, /* src_mask */ |
0, /* src_mask */ |
188 |
0xff, /* dst_mask */ |
0xff, /* dst_mask */ |
189 |
true), /* pcrel_offset */ |
TRUE), /* pcrel_offset */ |
190 |
|
|
191 |
/* This is used only by the dynamic linker. The symbol should exist |
/* This is used only by the dynamic linker. The symbol should exist |
192 |
both in the object being run and in some shared library. The |
both in the object being run and in some shared library. The |
197 |
0, /* rightshift */ |
0, /* rightshift */ |
198 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
199 |
32, /* bitsize */ |
32, /* bitsize */ |
200 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
201 |
0, /* bitpos */ |
0, /* bitpos */ |
202 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
203 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
204 |
"R_I370_COPY", /* name */ |
"R_I370_COPY", /* name */ |
205 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
206 |
0, /* src_mask */ |
0, /* src_mask */ |
207 |
0, /* dst_mask */ |
0, /* dst_mask */ |
208 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
209 |
|
|
210 |
/* Used only by the dynamic linker. When the object is run, this |
/* Used only by the dynamic linker. When the object is run, this |
211 |
longword is set to the load address of the object, plus the |
longword is set to the load address of the object, plus the |
214 |
0, /* rightshift */ |
0, /* rightshift */ |
215 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
216 |
32, /* bitsize */ |
32, /* bitsize */ |
217 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
218 |
0, /* bitpos */ |
0, /* bitpos */ |
219 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
220 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
221 |
"R_I370_RELATIVE", /* name */ |
"R_I370_RELATIVE", /* name */ |
222 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
223 |
0, /* src_mask */ |
0, /* src_mask */ |
224 |
0xffffffff, /* dst_mask */ |
0xffffffff, /* dst_mask */ |
225 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
226 |
|
|
227 |
}; |
}; |
228 |
|
|
229 |
static void i370_elf_howto_init PARAMS ((void)); |
static void i370_elf_howto_init |
230 |
|
PARAMS ((void)); |
231 |
static reloc_howto_type *i370_elf_reloc_type_lookup |
static reloc_howto_type *i370_elf_reloc_type_lookup |
232 |
PARAMS ((bfd *, bfd_reloc_code_real_type)); |
PARAMS ((bfd *, bfd_reloc_code_real_type)); |
233 |
|
static void i370_elf_info_to_howto |
234 |
static void i370_elf_info_to_howto PARAMS ((bfd *abfd, arelent *cache_ptr, |
PARAMS ((bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)); |
235 |
Elf32_Internal_Rela *dst)); |
static bfd_boolean i370_elf_set_private_flags |
236 |
static boolean i370_elf_set_private_flags PARAMS ((bfd *, flagword)); |
PARAMS ((bfd *, flagword)); |
237 |
|
|
238 |
/* Initialize the i370_elf_howto_table, so that linear accesses can be done. */ |
/* Initialize the i370_elf_howto_table, so that linear accesses can be done. */ |
239 |
|
|
276 |
return i370_elf_howto_table[ (int)i370_reloc ]; |
return i370_elf_howto_table[ (int)i370_reloc ]; |
277 |
}; |
}; |
278 |
|
|
279 |
static boolean i370_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); |
static bfd_boolean i370_elf_merge_private_bfd_data |
280 |
|
PARAMS ((bfd *, bfd *)); |
281 |
static boolean i370_elf_relocate_section PARAMS ((bfd *, |
static bfd_boolean i370_elf_relocate_section |
282 |
struct bfd_link_info *info, |
PARAMS ((bfd *, struct bfd_link_info *info, bfd *, asection *, bfd_byte *, |
283 |
bfd *, |
Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, |
284 |
asection *, |
asection **)); |
|
bfd_byte *, |
|
|
Elf_Internal_Rela *relocs, |
|
|
Elf_Internal_Sym *local_syms, |
|
|
asection **)); |
|
285 |
static void i370_elf_post_process_headers |
static void i370_elf_post_process_headers |
286 |
PARAMS ((bfd *, struct bfd_link_info *)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
287 |
|
static bfd_boolean i370_elf_create_dynamic_sections |
288 |
static boolean i370_elf_create_dynamic_sections PARAMS ((bfd *, |
PARAMS ((bfd *, struct bfd_link_info *)); |
289 |
struct bfd_link_info *)); |
static bfd_boolean i370_elf_section_from_shdr |
290 |
|
PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); |
291 |
static boolean i370_elf_section_from_shdr PARAMS ((bfd *, |
static bfd_boolean i370_elf_fake_sections |
292 |
Elf32_Internal_Shdr *, |
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); |
293 |
const char *)); |
static bfd_boolean i370_elf_check_relocs |
294 |
static boolean i370_elf_fake_sections PARAMS ((bfd *, |
PARAMS ((bfd *, struct bfd_link_info *, asection *, |
295 |
Elf32_Internal_Shdr *, |
const Elf_Internal_Rela *)); |
296 |
asection *)); |
static bfd_boolean i370_elf_adjust_dynamic_symbol |
297 |
#if 0 |
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); |
298 |
static elf_linker_section_t *i370_elf_create_linker_section |
static bfd_boolean i370_elf_adjust_dynindx |
299 |
PARAMS ((bfd *abfd, |
PARAMS ((struct elf_link_hash_entry *, PTR)); |
300 |
struct bfd_link_info *info, |
static bfd_boolean i370_elf_size_dynamic_sections |
301 |
enum elf_linker_section_enum)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
302 |
#endif |
static bfd_boolean i370_elf_finish_dynamic_sections |
303 |
static boolean i370_elf_check_relocs PARAMS ((bfd *, |
PARAMS ((bfd *, struct bfd_link_info *)); |
|
struct bfd_link_info *, |
|
|
asection *, |
|
|
const Elf_Internal_Rela *)); |
|
|
|
|
|
static boolean i370_elf_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *, |
|
|
struct elf_link_hash_entry *)); |
|
|
|
|
|
static boolean i370_elf_adjust_dynindx PARAMS ((struct elf_link_hash_entry *, PTR)); |
|
|
|
|
|
static boolean i370_elf_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); |
|
|
|
|
|
static boolean i370_elf_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); |
|
304 |
|
|
305 |
/* The name of the dynamic interpreter. This is put in the .interp |
/* The name of the dynamic interpreter. This is put in the .interp |
306 |
section. */ |
section. */ |
313 |
i370_elf_info_to_howto (abfd, cache_ptr, dst) |
i370_elf_info_to_howto (abfd, cache_ptr, dst) |
314 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
315 |
arelent *cache_ptr; |
arelent *cache_ptr; |
316 |
Elf32_Internal_Rela *dst; |
Elf_Internal_Rela *dst; |
317 |
{ |
{ |
318 |
if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table */ |
if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table */ |
319 |
i370_elf_howto_init (); |
i370_elf_howto_init (); |
326 |
* why are we bothering with them ??? |
* why are we bothering with them ??? |
327 |
*/ |
*/ |
328 |
/* Function to set whether a module needs the -mrelocatable bit set. */ |
/* Function to set whether a module needs the -mrelocatable bit set. */ |
329 |
static boolean |
static bfd_boolean |
330 |
i370_elf_set_private_flags (abfd, flags) |
i370_elf_set_private_flags (abfd, flags) |
331 |
bfd *abfd; |
bfd *abfd; |
332 |
flagword flags; |
flagword flags; |
335 |
|| elf_elfheader (abfd)->e_flags == flags); |
|| elf_elfheader (abfd)->e_flags == flags); |
336 |
|
|
337 |
elf_elfheader (abfd)->e_flags = flags; |
elf_elfheader (abfd)->e_flags = flags; |
338 |
elf_flags_init (abfd) = true; |
elf_flags_init (abfd) = TRUE; |
339 |
return true; |
return TRUE; |
340 |
} |
} |
341 |
|
|
342 |
/* Merge backend specific data from an object file to the output |
/* Merge backend specific data from an object file to the output |
343 |
object file when linking */ |
object file when linking */ |
344 |
static boolean |
static bfd_boolean |
345 |
i370_elf_merge_private_bfd_data (ibfd, obfd) |
i370_elf_merge_private_bfd_data (ibfd, obfd) |
346 |
bfd *ibfd; |
bfd *ibfd; |
347 |
bfd *obfd; |
bfd *obfd; |
351 |
|
|
352 |
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour |
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour |
353 |
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour) |
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour) |
354 |
return true; |
return TRUE; |
355 |
|
|
356 |
new_flags = elf_elfheader (ibfd)->e_flags; |
new_flags = elf_elfheader (ibfd)->e_flags; |
357 |
old_flags = elf_elfheader (obfd)->e_flags; |
old_flags = elf_elfheader (obfd)->e_flags; |
358 |
if (!elf_flags_init (obfd)) /* First call, no flags set */ |
if (!elf_flags_init (obfd)) /* First call, no flags set */ |
359 |
{ |
{ |
360 |
elf_flags_init (obfd) = true; |
elf_flags_init (obfd) = TRUE; |
361 |
elf_elfheader (obfd)->e_flags = new_flags; |
elf_elfheader (obfd)->e_flags = new_flags; |
362 |
} |
} |
363 |
|
|
367 |
else /* Incompatible flags */ |
else /* Incompatible flags */ |
368 |
{ |
{ |
369 |
(*_bfd_error_handler) |
(*_bfd_error_handler) |
370 |
("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", |
("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", |
371 |
bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); |
ibfd, (long) new_flags, (long) old_flags); |
372 |
|
|
373 |
bfd_set_error (bfd_error_bad_value); |
bfd_set_error (bfd_error_bad_value); |
374 |
return false; |
return FALSE; |
375 |
} |
} |
376 |
|
|
377 |
return true; |
return TRUE; |
378 |
} |
} |
379 |
|
|
380 |
/* Handle an i370 specific section when reading an object file. This |
/* Handle an i370 specific section when reading an object file. This |
384 |
* just enough to allow glibc-2.1 ld.so to compile & link. |
* just enough to allow glibc-2.1 ld.so to compile & link. |
385 |
*/ |
*/ |
386 |
|
|
387 |
static boolean |
static bfd_boolean |
388 |
i370_elf_section_from_shdr (abfd, hdr, name) |
i370_elf_section_from_shdr (abfd, hdr, name) |
389 |
bfd *abfd; |
bfd *abfd; |
390 |
Elf32_Internal_Shdr *hdr; |
Elf_Internal_Shdr *hdr; |
391 |
const char *name; |
const char *name; |
392 |
{ |
{ |
393 |
asection *newsect; |
asection *newsect; |
394 |
flagword flags; |
flagword flags; |
395 |
|
|
396 |
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) |
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) |
397 |
return false; |
return FALSE; |
398 |
|
|
399 |
newsect = hdr->bfd_section; |
newsect = hdr->bfd_section; |
400 |
flags = bfd_get_section_flags (abfd, newsect); |
flags = bfd_get_section_flags (abfd, newsect); |
405 |
flags |= SEC_SORT_ENTRIES; |
flags |= SEC_SORT_ENTRIES; |
406 |
|
|
407 |
bfd_set_section_flags (abfd, newsect, flags); |
bfd_set_section_flags (abfd, newsect, flags); |
408 |
return true; |
return TRUE; |
409 |
} |
} |
410 |
|
|
411 |
/* Set up any other section flags and such that may be necessary. */ |
/* Set up any other section flags and such that may be necessary. */ |
414 |
* just enough to allow glibc-2.1 ld.so to compile & link. |
* just enough to allow glibc-2.1 ld.so to compile & link. |
415 |
*/ |
*/ |
416 |
|
|
417 |
static boolean |
static bfd_boolean |
418 |
i370_elf_fake_sections (abfd, shdr, asect) |
i370_elf_fake_sections (abfd, shdr, asect) |
419 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
420 |
Elf32_Internal_Shdr *shdr; |
Elf_Internal_Shdr *shdr; |
421 |
asection *asect; |
asection *asect; |
422 |
{ |
{ |
423 |
if ((asect->flags & SEC_EXCLUDE) != 0) |
if ((asect->flags & SEC_EXCLUDE) != 0) |
426 |
if ((asect->flags & SEC_SORT_ENTRIES) != 0) |
if ((asect->flags & SEC_SORT_ENTRIES) != 0) |
427 |
shdr->sh_type = SHT_ORDERED; |
shdr->sh_type = SHT_ORDERED; |
428 |
|
|
429 |
return true; |
return TRUE; |
|
} |
|
|
|
|
|
#if 0 |
|
|
/* Create a special linker section */ |
|
|
/* XXX hack alert bogus This routine is mostly all junk and almost |
|
|
* certainly does the wrong thing. Its here simply because it does |
|
|
* just enough to allow glibc-2.1 ld.so to compile & link. |
|
|
*/ |
|
|
|
|
|
static elf_linker_section_t * |
|
|
i370_elf_create_linker_section (abfd, info, which) |
|
|
bfd *abfd; |
|
|
struct bfd_link_info *info; |
|
|
enum elf_linker_section_enum which; |
|
|
{ |
|
|
bfd *dynobj = elf_hash_table (info)->dynobj; |
|
|
elf_linker_section_t *lsect; |
|
|
|
|
|
/* Record the first bfd section that needs the special section */ |
|
|
if (!dynobj) |
|
|
dynobj = elf_hash_table (info)->dynobj = abfd; |
|
|
|
|
|
/* If this is the first time, create the section */ |
|
|
lsect = elf_linker_section (dynobj, which); |
|
|
if (!lsect) |
|
|
{ |
|
|
elf_linker_section_t defaults; |
|
|
static elf_linker_section_t zero_section; |
|
|
|
|
|
defaults = zero_section; |
|
|
defaults.which = which; |
|
|
defaults.hole_written_p = false; |
|
|
defaults.alignment = 2; |
|
|
|
|
|
/* Both of these sections are (technically) created by the user |
|
|
putting data in them, so they shouldn't be marked |
|
|
SEC_LINKER_CREATED. |
|
|
|
|
|
The linker creates them so it has somewhere to attach their |
|
|
respective symbols. In fact, if they were empty it would |
|
|
be OK to leave the symbol set to 0 (or any random number), because |
|
|
the appropriate register should never be used. */ |
|
|
defaults.flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS |
|
|
| SEC_IN_MEMORY); |
|
|
|
|
|
switch (which) |
|
|
{ |
|
|
default: |
|
|
(*_bfd_error_handler) ("%s: Unknown special linker type %d", |
|
|
bfd_archive_filename (abfd), |
|
|
(int) which); |
|
|
|
|
|
bfd_set_error (bfd_error_bad_value); |
|
|
return (elf_linker_section_t *)0; |
|
|
|
|
|
case LINKER_SECTION_SDATA: /* .sdata/.sbss section */ |
|
|
defaults.name = ".sdata"; |
|
|
defaults.rel_name = ".rela.sdata"; |
|
|
defaults.bss_name = ".sbss"; |
|
|
defaults.sym_name = "_SDA_BASE_"; |
|
|
defaults.sym_offset = 32768; |
|
|
break; |
|
|
|
|
|
case LINKER_SECTION_SDATA2: /* .sdata2/.sbss2 section */ |
|
|
defaults.name = ".sdata2"; |
|
|
defaults.rel_name = ".rela.sdata2"; |
|
|
defaults.bss_name = ".sbss2"; |
|
|
defaults.sym_name = "_SDA2_BASE_"; |
|
|
defaults.sym_offset = 32768; |
|
|
defaults.flags |= SEC_READONLY; |
|
|
break; |
|
|
} |
|
|
|
|
|
lsect = _bfd_elf_create_linker_section (abfd, info, which, &defaults); |
|
|
} |
|
|
|
|
|
return lsect; |
|
430 |
} |
} |
|
#endif |
|
431 |
|
|
432 |
/* We have to create .dynsbss and .rela.sbss here so that they get mapped |
/* We have to create .dynsbss and .rela.sbss here so that they get mapped |
433 |
to output sections (just like _bfd_elf_create_dynamic_sections has |
to output sections (just like _bfd_elf_create_dynamic_sections has |
437 |
* just enough to allow glibc-2.1 ld.so to compile & link. |
* just enough to allow glibc-2.1 ld.so to compile & link. |
438 |
*/ |
*/ |
439 |
|
|
440 |
static boolean |
static bfd_boolean |
441 |
i370_elf_create_dynamic_sections (abfd, info) |
i370_elf_create_dynamic_sections (abfd, info) |
442 |
bfd *abfd; |
bfd *abfd; |
443 |
struct bfd_link_info *info; |
struct bfd_link_info *info; |
446 |
flagword flags; |
flagword flags; |
447 |
|
|
448 |
if (!_bfd_elf_create_dynamic_sections(abfd, info)) |
if (!_bfd_elf_create_dynamic_sections(abfd, info)) |
449 |
return false; |
return FALSE; |
450 |
|
|
451 |
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY |
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY |
452 |
| SEC_LINKER_CREATED); |
| SEC_LINKER_CREATED); |
454 |
s = bfd_make_section (abfd, ".dynsbss"); |
s = bfd_make_section (abfd, ".dynsbss"); |
455 |
if (s == NULL |
if (s == NULL |
456 |
|| ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) |
|| ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) |
457 |
return false; |
return FALSE; |
458 |
|
|
459 |
if (! info->shared) |
if (! info->shared) |
460 |
{ |
{ |
462 |
if (s == NULL |
if (s == NULL |
463 |
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) |
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) |
464 |
|| ! bfd_set_section_alignment (abfd, s, 2)) |
|| ! bfd_set_section_alignment (abfd, s, 2)) |
465 |
return false; |
return FALSE; |
466 |
} |
} |
467 |
|
|
468 |
/* xxx beats me, seem to need a rela.text ... */ |
/* xxx beats me, seem to need a rela.text ... */ |
470 |
if (s == NULL |
if (s == NULL |
471 |
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) |
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) |
472 |
|| ! bfd_set_section_alignment (abfd, s, 2)) |
|| ! bfd_set_section_alignment (abfd, s, 2)) |
473 |
return false; |
return FALSE; |
474 |
return true; |
return TRUE; |
475 |
} |
} |
476 |
|
|
477 |
/* Adjust a symbol defined by a dynamic object and referenced by a |
/* Adjust a symbol defined by a dynamic object and referenced by a |
484 |
* just enough to allow glibc-2.1 ld.so to compile & link. |
* just enough to allow glibc-2.1 ld.so to compile & link. |
485 |
*/ |
*/ |
486 |
|
|
487 |
static boolean |
static bfd_boolean |
488 |
i370_elf_adjust_dynamic_symbol (info, h) |
i370_elf_adjust_dynamic_symbol (info, h) |
489 |
struct bfd_link_info *info; |
struct bfd_link_info *info; |
490 |
struct elf_link_hash_entry *h; |
struct elf_link_hash_entry *h; |
500 |
|
|
501 |
/* Make sure we know what is going on here. */ |
/* Make sure we know what is going on here. */ |
502 |
BFD_ASSERT (dynobj != NULL |
BFD_ASSERT (dynobj != NULL |
503 |
&& ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) |
&& (h->needs_plt |
504 |
|| h->weakdef != NULL |
|| h->u.weakdef != NULL |
505 |
|| ((h->elf_link_hash_flags |
|| (h->def_dynamic |
506 |
& ELF_LINK_HASH_DEF_DYNAMIC) != 0 |
&& h->ref_regular |
507 |
&& (h->elf_link_hash_flags |
&& !h->def_regular))); |
|
& ELF_LINK_HASH_REF_REGULAR) != 0 |
|
|
&& (h->elf_link_hash_flags |
|
|
& ELF_LINK_HASH_DEF_REGULAR) == 0))); |
|
508 |
|
|
509 |
s = bfd_get_section_by_name (dynobj, ".rela.text"); |
s = bfd_get_section_by_name (dynobj, ".rela.text"); |
510 |
BFD_ASSERT (s != NULL); |
BFD_ASSERT (s != NULL); |
511 |
s->_raw_size += sizeof (Elf32_External_Rela); |
s->size += sizeof (Elf32_External_Rela); |
512 |
|
|
513 |
/* If this is a weak symbol, and there is a real definition, the |
/* If this is a weak symbol, and there is a real definition, the |
514 |
processor independent code will have arranged for us to see the |
processor independent code will have arranged for us to see the |
515 |
real definition first, and we can just use the same value. */ |
real definition first, and we can just use the same value. */ |
516 |
if (h->weakdef != NULL) |
if (h->u.weakdef != NULL) |
517 |
{ |
{ |
518 |
BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined |
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined |
519 |
|| h->weakdef->root.type == bfd_link_hash_defweak); |
|| h->u.weakdef->root.type == bfd_link_hash_defweak); |
520 |
h->root.u.def.section = h->weakdef->root.u.def.section; |
h->root.u.def.section = h->u.weakdef->root.u.def.section; |
521 |
h->root.u.def.value = h->weakdef->root.u.def.value; |
h->root.u.def.value = h->u.weakdef->root.u.def.value; |
522 |
return true; |
return TRUE; |
523 |
} |
} |
524 |
|
|
525 |
/* This is a reference to a symbol defined by a dynamic object which |
/* This is a reference to a symbol defined by a dynamic object which |
530 |
For such cases we need not do anything here; the relocations will |
For such cases we need not do anything here; the relocations will |
531 |
be handled correctly by relocate_section. */ |
be handled correctly by relocate_section. */ |
532 |
if (info->shared) |
if (info->shared) |
533 |
return true; |
return TRUE; |
534 |
|
|
535 |
/* We must allocate the symbol in our .dynbss section, which will |
/* We must allocate the symbol in our .dynbss section, which will |
536 |
become part of the .bss section of the executable. There will be |
become part of the .bss section of the executable. There will be |
565 |
else |
else |
566 |
srel = bfd_get_section_by_name (dynobj, ".rela.bss"); |
srel = bfd_get_section_by_name (dynobj, ".rela.bss"); |
567 |
BFD_ASSERT (srel != NULL); |
BFD_ASSERT (srel != NULL); |
568 |
srel->_raw_size += sizeof (Elf32_External_Rela); |
srel->size += sizeof (Elf32_External_Rela); |
569 |
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; |
h->needs_copy = 1; |
570 |
} |
} |
571 |
|
|
572 |
/* We need to figure out the alignment required for this symbol. I |
/* We need to figure out the alignment required for this symbol. I |
576 |
power_of_two = 4; |
power_of_two = 4; |
577 |
|
|
578 |
/* Apply the required alignment. */ |
/* Apply the required alignment. */ |
579 |
s->_raw_size = BFD_ALIGN (s->_raw_size, |
s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); |
|
(bfd_size_type) (1 << power_of_two)); |
|
580 |
if (power_of_two > bfd_get_section_alignment (dynobj, s)) |
if (power_of_two > bfd_get_section_alignment (dynobj, s)) |
581 |
{ |
{ |
582 |
if (! bfd_set_section_alignment (dynobj, s, power_of_two)) |
if (! bfd_set_section_alignment (dynobj, s, power_of_two)) |
583 |
return false; |
return FALSE; |
584 |
} |
} |
585 |
|
|
586 |
/* Define the symbol as being at this point in the section. */ |
/* Define the symbol as being at this point in the section. */ |
587 |
h->root.u.def.section = s; |
h->root.u.def.section = s; |
588 |
h->root.u.def.value = s->_raw_size; |
h->root.u.def.value = s->size; |
589 |
|
|
590 |
/* Increment the section size to make room for the symbol. */ |
/* Increment the section size to make room for the symbol. */ |
591 |
s->_raw_size += h->size; |
s->size += h->size; |
592 |
|
|
593 |
return true; |
return TRUE; |
594 |
} |
} |
595 |
|
|
596 |
/* Increment the index of a dynamic symbol by a given amount. Called |
/* Increment the index of a dynamic symbol by a given amount. Called |
600 |
* just enough to allow glibc-2.1 ld.so to compile & link. |
* just enough to allow glibc-2.1 ld.so to compile & link. |
601 |
*/ |
*/ |
602 |
|
|
603 |
static boolean |
static bfd_boolean |
604 |
i370_elf_adjust_dynindx (h, cparg) |
i370_elf_adjust_dynindx (h, cparg) |
605 |
struct elf_link_hash_entry *h; |
struct elf_link_hash_entry *h; |
606 |
PTR cparg; |
PTR cparg; |
619 |
if (h->dynindx != -1) |
if (h->dynindx != -1) |
620 |
h->dynindx += *cp; |
h->dynindx += *cp; |
621 |
|
|
622 |
return true; |
return TRUE; |
623 |
} |
} |
624 |
|
|
625 |
/* Set the sizes of the dynamic sections. */ |
/* Set the sizes of the dynamic sections. */ |
628 |
* just enough to allow glibc-2.1 ld.so to compile & link. |
* just enough to allow glibc-2.1 ld.so to compile & link. |
629 |
*/ |
*/ |
630 |
|
|
631 |
static boolean |
static bfd_boolean |
632 |
i370_elf_size_dynamic_sections (output_bfd, info) |
i370_elf_size_dynamic_sections (output_bfd, info) |
633 |
bfd *output_bfd; |
bfd *output_bfd; |
634 |
struct bfd_link_info *info; |
struct bfd_link_info *info; |
635 |
{ |
{ |
636 |
bfd *dynobj; |
bfd *dynobj; |
637 |
asection *s; |
asection *s; |
638 |
boolean plt; |
bfd_boolean plt; |
639 |
boolean relocs; |
bfd_boolean relocs; |
640 |
boolean reltext; |
bfd_boolean reltext; |
641 |
|
|
642 |
#ifdef DEBUG |
#ifdef DEBUG |
643 |
fprintf (stderr, "i370_elf_size_dynamic_sections called\n"); |
fprintf (stderr, "i370_elf_size_dynamic_sections called\n"); |
649 |
if (elf_hash_table (info)->dynamic_sections_created) |
if (elf_hash_table (info)->dynamic_sections_created) |
650 |
{ |
{ |
651 |
/* Set the contents of the .interp section to the interpreter. */ |
/* Set the contents of the .interp section to the interpreter. */ |
652 |
if (! info->shared) |
if (info->executable) |
653 |
{ |
{ |
654 |
s = bfd_get_section_by_name (dynobj, ".interp"); |
s = bfd_get_section_by_name (dynobj, ".interp"); |
655 |
BFD_ASSERT (s != NULL); |
BFD_ASSERT (s != NULL); |
656 |
s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; |
s->size = sizeof ELF_DYNAMIC_INTERPRETER; |
657 |
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; |
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; |
658 |
} |
} |
659 |
} |
} |
673 |
{ |
{ |
674 |
s = bfd_get_section_by_name (dynobj, *p); |
s = bfd_get_section_by_name (dynobj, *p); |
675 |
if (s != NULL) |
if (s != NULL) |
676 |
s->_raw_size = 0; |
s->size = 0; |
677 |
} |
} |
678 |
} |
} |
679 |
|
|
680 |
/* The check_relocs and adjust_dynamic_symbol entry points have |
/* The check_relocs and adjust_dynamic_symbol entry points have |
681 |
determined the sizes of the various dynamic sections. Allocate |
determined the sizes of the various dynamic sections. Allocate |
682 |
memory for them. */ |
memory for them. */ |
683 |
plt = false; |
plt = FALSE; |
684 |
relocs = false; |
relocs = FALSE; |
685 |
reltext = false; |
reltext = FALSE; |
686 |
for (s = dynobj->sections; s != NULL; s = s->next) |
for (s = dynobj->sections; s != NULL; s = s->next) |
687 |
{ |
{ |
688 |
const char *name; |
const char *name; |
689 |
boolean strip; |
bfd_boolean strip; |
690 |
|
|
691 |
if ((s->flags & SEC_LINKER_CREATED) == 0) |
if ((s->flags & SEC_LINKER_CREATED) == 0) |
692 |
continue; |
continue; |
694 |
/* It's OK to base decisions on the section name, because none |
/* It's OK to base decisions on the section name, because none |
695 |
of the dynobj section names depend upon the input files. */ |
of the dynobj section names depend upon the input files. */ |
696 |
name = bfd_get_section_name (dynobj, s); |
name = bfd_get_section_name (dynobj, s); |
697 |
strip = false; |
strip = FALSE; |
698 |
|
|
699 |
if (strcmp (name, ".plt") == 0) |
if (strcmp (name, ".plt") == 0) |
700 |
{ |
{ |
701 |
if (s->_raw_size == 0) |
if (s->size == 0) |
702 |
{ |
{ |
703 |
/* Strip this section if we don't need it; see the |
/* Strip this section if we don't need it; see the |
704 |
comment below. */ |
comment below. */ |
705 |
strip = true; |
strip = TRUE; |
706 |
} |
} |
707 |
else |
else |
708 |
{ |
{ |
709 |
/* Remember whether there is a PLT. */ |
/* Remember whether there is a PLT. */ |
710 |
plt = true; |
plt = TRUE; |
711 |
} |
} |
712 |
} |
} |
713 |
else if (strncmp (name, ".rela", 5) == 0) |
else if (strncmp (name, ".rela", 5) == 0) |
714 |
{ |
{ |
715 |
if (s->_raw_size == 0) |
if (s->size == 0) |
716 |
{ |
{ |
717 |
/* If we don't need this section, strip it from the |
/* If we don't need this section, strip it from the |
718 |
output file. This is mostly to handle .rela.bss and |
output file. This is mostly to handle .rela.bss and |
723 |
adjust_dynamic_symbol is called, and it is that |
adjust_dynamic_symbol is called, and it is that |
724 |
function which decides whether anything needs to go |
function which decides whether anything needs to go |
725 |
into these sections. */ |
into these sections. */ |
726 |
strip = true; |
strip = TRUE; |
727 |
} |
} |
728 |
else |
else |
729 |
{ |
{ |
731 |
const char *outname; |
const char *outname; |
732 |
|
|
733 |
/* Remember whether there are any relocation sections. */ |
/* Remember whether there are any relocation sections. */ |
734 |
relocs = true; |
relocs = TRUE; |
735 |
|
|
736 |
/* If this relocation section applies to a read only |
/* If this relocation section applies to a read only |
737 |
section, then we probably need a DT_TEXTREL entry. */ |
section, then we probably need a DT_TEXTREL entry. */ |
741 |
if (target != NULL |
if (target != NULL |
742 |
&& (target->flags & SEC_READONLY) != 0 |
&& (target->flags & SEC_READONLY) != 0 |
743 |
&& (target->flags & SEC_ALLOC) != 0) |
&& (target->flags & SEC_ALLOC) != 0) |
744 |
reltext = true; |
reltext = TRUE; |
745 |
|
|
746 |
/* We use the reloc_count field as a counter if we need |
/* We use the reloc_count field as a counter if we need |
747 |
to copy relocs into the output file. */ |
to copy relocs into the output file. */ |
774 |
continue; |
continue; |
775 |
} |
} |
776 |
/* Allocate memory for the section contents. */ |
/* Allocate memory for the section contents. */ |
777 |
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); |
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); |
778 |
if (s->contents == NULL && s->_raw_size != 0) |
if (s->contents == NULL && s->size != 0) |
779 |
return false; |
return FALSE; |
780 |
} |
} |
781 |
|
|
782 |
if (elf_hash_table (info)->dynamic_sections_created) |
if (elf_hash_table (info)->dynamic_sections_created) |
787 |
the .dynamic section. The DT_DEBUG entry is filled in by the |
the .dynamic section. The DT_DEBUG entry is filled in by the |
788 |
dynamic linker and used by the debugger. */ |
dynamic linker and used by the debugger. */ |
789 |
#define add_dynamic_entry(TAG, VAL) \ |
#define add_dynamic_entry(TAG, VAL) \ |
790 |
bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) |
_bfd_elf_add_dynamic_entry (info, TAG, VAL) |
791 |
|
|
792 |
if (!info->shared) |
if (!info->shared) |
793 |
{ |
{ |
794 |
if (!add_dynamic_entry (DT_DEBUG, 0)) |
if (!add_dynamic_entry (DT_DEBUG, 0)) |
795 |
return false; |
return FALSE; |
796 |
} |
} |
797 |
|
|
798 |
if (plt) |
if (plt) |
801 |
|| !add_dynamic_entry (DT_PLTRELSZ, 0) |
|| !add_dynamic_entry (DT_PLTRELSZ, 0) |
802 |
|| !add_dynamic_entry (DT_PLTREL, DT_RELA) |
|| !add_dynamic_entry (DT_PLTREL, DT_RELA) |
803 |
|| !add_dynamic_entry (DT_JMPREL, 0)) |
|| !add_dynamic_entry (DT_JMPREL, 0)) |
804 |
return false; |
return FALSE; |
805 |
} |
} |
806 |
|
|
807 |
if (relocs) |
if (relocs) |
809 |
if (!add_dynamic_entry (DT_RELA, 0) |
if (!add_dynamic_entry (DT_RELA, 0) |
810 |
|| !add_dynamic_entry (DT_RELASZ, 0) |
|| !add_dynamic_entry (DT_RELASZ, 0) |
811 |
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) |
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) |
812 |
return false; |
return FALSE; |
813 |
} |
} |
814 |
|
|
815 |
if (reltext) |
if (reltext) |
816 |
{ |
{ |
817 |
if (!add_dynamic_entry (DT_TEXTREL, 0)) |
if (!add_dynamic_entry (DT_TEXTREL, 0)) |
818 |
return false; |
return FALSE; |
819 |
info->flags |= DF_TEXTREL; |
info->flags |= DF_TEXTREL; |
820 |
} |
} |
821 |
} |
} |
830 |
FIXME: We assume that there will never be relocations to |
FIXME: We assume that there will never be relocations to |
831 |
locations in linker-created sections that do not have |
locations in linker-created sections that do not have |
832 |
externally-visible names. Instead, we should work out precisely |
externally-visible names. Instead, we should work out precisely |
833 |
which sections relocations are targetted at. */ |
which sections relocations are targeted at. */ |
834 |
if (info->shared) |
if (info->shared) |
835 |
{ |
{ |
836 |
int c; |
int c; |
858 |
elf_hash_table (info)->dynsymcount += c; |
elf_hash_table (info)->dynsymcount += c; |
859 |
} |
} |
860 |
|
|
861 |
return true; |
return TRUE; |
862 |
} |
} |
863 |
|
|
864 |
/* Look through the relocs for a section during the first phase, and |
/* Look through the relocs for a section during the first phase, and |
869 |
* just enough to allow glibc-2.1 ld.so to compile & link. |
* just enough to allow glibc-2.1 ld.so to compile & link. |
870 |
*/ |
*/ |
871 |
|
|
872 |
static boolean |
static bfd_boolean |
873 |
i370_elf_check_relocs (abfd, info, sec, relocs) |
i370_elf_check_relocs (abfd, info, sec, relocs) |
874 |
bfd *abfd; |
bfd *abfd; |
875 |
struct bfd_link_info *info; |
struct bfd_link_info *info; |
884 |
bfd_vma *local_got_offsets; |
bfd_vma *local_got_offsets; |
885 |
asection *sreloc; |
asection *sreloc; |
886 |
|
|
887 |
if (info->relocateable) |
if (info->relocatable) |
888 |
return true; |
return TRUE; |
889 |
|
|
890 |
#ifdef DEBUG |
#ifdef DEBUG |
891 |
fprintf (stderr, "i370_elf_check_relocs called for section %s in %s\n", |
_bfd_error_handler ("i370_elf_check_relocs called for section %A in %B", |
892 |
bfd_get_section_name (abfd, sec), |
sec, abfd); |
|
bfd_archive_filename (abfd)); |
|
893 |
#endif |
#endif |
894 |
|
|
895 |
dynobj = elf_hash_table (info)->dynobj; |
dynobj = elf_hash_table (info)->dynobj; |
928 |
elf_elfheader (abfd)->e_shstrndx, |
elf_elfheader (abfd)->e_shstrndx, |
929 |
elf_section_data (sec)->rel_hdr.sh_name)); |
elf_section_data (sec)->rel_hdr.sh_name)); |
930 |
if (name == NULL) |
if (name == NULL) |
931 |
return false; |
return FALSE; |
932 |
|
|
933 |
BFD_ASSERT (strncmp (name, ".rela", 5) == 0 |
BFD_ASSERT (strncmp (name, ".rela", 5) == 0 |
934 |
&& strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0); |
&& strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0); |
946 |
if (sreloc == NULL |
if (sreloc == NULL |
947 |
|| ! bfd_set_section_flags (dynobj, sreloc, flags) |
|| ! bfd_set_section_flags (dynobj, sreloc, flags) |
948 |
|| ! bfd_set_section_alignment (dynobj, sreloc, 2)) |
|| ! bfd_set_section_alignment (dynobj, sreloc, 2)) |
949 |
return false; |
return FALSE; |
950 |
} |
} |
951 |
} |
} |
952 |
|
|
953 |
sreloc->_raw_size += sizeof (Elf32_External_Rela); |
sreloc->size += sizeof (Elf32_External_Rela); |
954 |
|
|
955 |
/* FIXME: We should here do what the m68k and i386 |
/* FIXME: We should here do what the m68k and i386 |
956 |
backends do: if the reloc is pc-relative, record it |
backends do: if the reloc is pc-relative, record it |
961 |
} |
} |
962 |
} |
} |
963 |
|
|
964 |
return true; |
return TRUE; |
965 |
} |
} |
966 |
|
|
967 |
/* Finish up the dynamic sections. */ |
/* Finish up the dynamic sections. */ |
970 |
* just enough to allow glibc-2.1 ld.so to compile & link. |
* just enough to allow glibc-2.1 ld.so to compile & link. |
971 |
*/ |
*/ |
972 |
|
|
973 |
static boolean |
static bfd_boolean |
974 |
i370_elf_finish_dynamic_sections (output_bfd, info) |
i370_elf_finish_dynamic_sections (output_bfd, info) |
975 |
bfd *output_bfd; |
bfd *output_bfd; |
976 |
struct bfd_link_info *info; |
struct bfd_link_info *info; |
994 |
BFD_ASSERT (splt != NULL && sdyn != NULL); |
BFD_ASSERT (splt != NULL && sdyn != NULL); |
995 |
|
|
996 |
dyncon = (Elf32_External_Dyn *) sdyn->contents; |
dyncon = (Elf32_External_Dyn *) sdyn->contents; |
997 |
dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); |
dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); |
998 |
for (; dyncon < dynconend; dyncon++) |
for (; dyncon < dynconend; dyncon++) |
999 |
{ |
{ |
1000 |
Elf_Internal_Dyn dyn; |
Elf_Internal_Dyn dyn; |
1001 |
const char *name; |
const char *name; |
1002 |
boolean size; |
bfd_boolean size; |
1003 |
|
|
1004 |
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); |
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); |
1005 |
|
|
1006 |
switch (dyn.d_tag) |
switch (dyn.d_tag) |
1007 |
{ |
{ |
1008 |
case DT_PLTGOT: name = ".plt"; size = false; break; |
case DT_PLTGOT: name = ".plt"; size = FALSE; break; |
1009 |
case DT_PLTRELSZ: name = ".rela.plt"; size = true; break; |
case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; |
1010 |
case DT_JMPREL: name = ".rela.plt"; size = false; break; |
case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; |
1011 |
default: name = NULL; size = false; break; |
default: name = NULL; size = FALSE; break; |
1012 |
} |
} |
1013 |
|
|
1014 |
if (name != NULL) |
if (name != NULL) |
1023 |
if (! size) |
if (! size) |
1024 |
dyn.d_un.d_ptr = s->vma; |
dyn.d_un.d_ptr = s->vma; |
1025 |
else |
else |
1026 |
{ |
dyn.d_un.d_val = s->size; |
|
if (s->_cooked_size != 0) |
|
|
dyn.d_un.d_val = s->_cooked_size; |
|
|
else |
|
|
dyn.d_un.d_val = s->_raw_size; |
|
|
} |
|
1027 |
} |
} |
1028 |
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); |
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); |
1029 |
} |
} |
1095 |
maxdindx + 1; |
maxdindx + 1; |
1096 |
} |
} |
1097 |
|
|
1098 |
return true; |
return TRUE; |
1099 |
} |
} |
1100 |
|
|
1101 |
/* The RELOCATE_SECTION function is called by the ELF backend linker |
/* The RELOCATE_SECTION function is called by the ELF backend linker |
1107 |
|
|
1108 |
This function is responsible for adjust the section contents as |
This function is responsible for adjust the section contents as |
1109 |
necessary, and (if using Rela relocs and generating a |
necessary, and (if using Rela relocs and generating a |
1110 |
relocateable output file) adjusting the reloc addend as |
relocatable output file) adjusting the reloc addend as |
1111 |
necessary. |
necessary. |
1112 |
|
|
1113 |
This function does not have to worry about setting the reloc |
This function does not have to worry about setting the reloc |
1121 |
The global hash table entry for the global symbols can be found |
The global hash table entry for the global symbols can be found |
1122 |
via elf_sym_hashes (input_bfd). |
via elf_sym_hashes (input_bfd). |
1123 |
|
|
1124 |
When generating relocateable output, this function must handle |
When generating relocatable output, this function must handle |
1125 |
STB_LOCAL/STT_SECTION symbols specially. The output symbol is |
STB_LOCAL/STT_SECTION symbols specially. The output symbol is |
1126 |
going to be the section symbol corresponding to the output |
going to be the section symbol corresponding to the output |
1127 |
section, which means that the addend must be adjusted |
section, which means that the addend must be adjusted |
1128 |
accordingly. */ |
accordingly. */ |
1129 |
|
|
1130 |
static boolean |
static bfd_boolean |
1131 |
i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, |
i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, |
1132 |
contents, relocs, local_syms, local_sections) |
contents, relocs, local_syms, local_sections) |
1133 |
bfd *output_bfd; |
bfd *output_bfd; |
1134 |
struct bfd_link_info *info; |
struct bfd_link_info *info; |
1135 |
bfd *input_bfd; |
bfd *input_bfd; |
1139 |
Elf_Internal_Sym *local_syms; |
Elf_Internal_Sym *local_syms; |
1140 |
asection **local_sections; |
asection **local_sections; |
1141 |
{ |
{ |
1142 |
Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; |
Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; |
1143 |
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); |
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); |
1144 |
bfd *dynobj = elf_hash_table (info)->dynobj; |
bfd *dynobj = elf_hash_table (info)->dynobj; |
1145 |
Elf_Internal_Rela *rel = relocs; |
Elf_Internal_Rela *rel = relocs; |
1146 |
Elf_Internal_Rela *relend = relocs + input_section->reloc_count; |
Elf_Internal_Rela *relend = relocs + input_section->reloc_count; |
1147 |
asection *sreloc = NULL; |
asection *sreloc = NULL; |
1148 |
bfd_vma *local_got_offsets; |
bfd_vma *local_got_offsets; |
1149 |
boolean ret = true; |
bfd_boolean ret = TRUE; |
1150 |
|
|
1151 |
if (info->relocateable) |
if (info->relocatable) |
1152 |
return true; |
return TRUE; |
1153 |
|
|
1154 |
#ifdef DEBUG |
#ifdef DEBUG |
1155 |
fprintf (stderr, "i370_elf_relocate_section called for %s section %s, %ld relocations%s\n", |
_bfd_error_handler ("i370_elf_relocate_section called for %B section %A, %ld relocations%s", |
1156 |
bfd_archive_filename (input_bfd), |
input_bfd, input_section, |
1157 |
bfd_section_name(input_bfd, input_section), |
(long) input_section->reloc_count, |
1158 |
(long) input_section->reloc_count, |
(info->relocatable) ? " (relocatable)" : ""); |
|
(info->relocateable) ? " (relocatable)" : ""); |
|
1159 |
#endif |
#endif |
1160 |
|
|
1161 |
if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table if needed */ |
if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table if needed */ |
1181 |
if ((unsigned)r_type >= (unsigned)R_I370_max |
if ((unsigned)r_type >= (unsigned)R_I370_max |
1182 |
|| !i370_elf_howto_table[(int)r_type]) |
|| !i370_elf_howto_table[(int)r_type]) |
1183 |
{ |
{ |
1184 |
(*_bfd_error_handler) ("%s: unknown relocation type %d", |
(*_bfd_error_handler) ("%B: unknown relocation type %d", |
1185 |
bfd_archive_filename (input_bfd), |
input_bfd, |
1186 |
(int) r_type); |
(int) r_type); |
1187 |
|
|
1188 |
bfd_set_error (bfd_error_bad_value); |
bfd_set_error (bfd_error_bad_value); |
1189 |
ret = false; |
ret = FALSE; |
1190 |
continue; |
continue; |
1191 |
} |
} |
1192 |
|
|
1199 |
sec = local_sections[r_symndx]; |
sec = local_sections[r_symndx]; |
1200 |
sym_name = "<local symbol>"; |
sym_name = "<local symbol>"; |
1201 |
|
|
1202 |
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); |
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); |
1203 |
addend = rel->r_addend; |
addend = rel->r_addend; |
1204 |
} |
} |
1205 |
else |
else |
1215 |
sec = h->root.u.def.section; |
sec = h->root.u.def.section; |
1216 |
if (info->shared |
if (info->shared |
1217 |
&& ((! info->symbolic && h->dynindx != -1) |
&& ((! info->symbolic && h->dynindx != -1) |
1218 |
|| (h->elf_link_hash_flags |
|| !h->def_regular) |
|
& ELF_LINK_HASH_DEF_REGULAR) == 0) |
|
1219 |
&& (input_section->flags & SEC_ALLOC) != 0 |
&& (input_section->flags & SEC_ALLOC) != 0 |
1220 |
&& (r_type == R_I370_ADDR31 |
&& (r_type == R_I370_ADDR31 |
1221 |
|| r_type == R_I370_COPY |
|| r_type == R_I370_COPY |
1234 |
} |
} |
1235 |
else if (h->root.type == bfd_link_hash_undefweak) |
else if (h->root.type == bfd_link_hash_undefweak) |
1236 |
relocation = 0; |
relocation = 0; |
1237 |
else if (info->shared |
else if (info->unresolved_syms_in_objects == RM_IGNORE |
1238 |
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) |
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) |
1239 |
relocation = 0; |
relocation = 0; |
1240 |
else |
else |
1241 |
{ |
{ |
1242 |
(*info->callbacks->undefined_symbol) (info, |
if ((*info->callbacks->undefined_symbol) |
1243 |
h->root.root.string, |
(info, h->root.root.string, input_bfd, |
1244 |
input_bfd, |
input_section, rel->r_offset, |
1245 |
input_section, |
(info->unresolved_syms_in_objects == RM_GENERATE_ERROR |
1246 |
rel->r_offset, |
|| ELF_ST_VISIBILITY (h->other)))) |
1247 |
true); |
{ |
1248 |
ret = false; |
ret = FALSE; |
1249 |
continue; |
continue; |
1250 |
|
} |
1251 |
|
relocation = 0; |
1252 |
} |
} |
1253 |
} |
} |
1254 |
|
|
1256 |
{ |
{ |
1257 |
default: |
default: |
1258 |
(*_bfd_error_handler) |
(*_bfd_error_handler) |
1259 |
("%s: unknown relocation type %d for symbol %s", |
("%B: unknown relocation type %d for symbol %s", |
1260 |
bfd_archive_filename (input_bfd), |
input_bfd, (int) r_type, sym_name); |
|
(int) r_type, sym_name); |
|
1261 |
|
|
1262 |
bfd_set_error (bfd_error_bad_value); |
bfd_set_error (bfd_error_bad_value); |
1263 |
ret = false; |
ret = FALSE; |
1264 |
continue; |
continue; |
1265 |
|
|
1266 |
case (int)R_I370_NONE: |
case (int)R_I370_NONE: |
1284 |
&& r_symndx != 0) |
&& r_symndx != 0) |
1285 |
{ |
{ |
1286 |
Elf_Internal_Rela outrel; |
Elf_Internal_Rela outrel; |
1287 |
|
bfd_byte *loc; |
1288 |
int skip; |
int skip; |
1289 |
|
|
1290 |
#ifdef DEBUG |
#ifdef DEBUG |
1306 |
elf_elfheader (input_bfd)->e_shstrndx, |
elf_elfheader (input_bfd)->e_shstrndx, |
1307 |
elf_section_data (input_section)->rel_hdr.sh_name)); |
elf_section_data (input_section)->rel_hdr.sh_name)); |
1308 |
if (name == NULL) |
if (name == NULL) |
1309 |
return false; |
return FALSE; |
1310 |
|
|
1311 |
BFD_ASSERT (strncmp (name, ".rela", 5) == 0 |
BFD_ASSERT (strncmp (name, ".rela", 5) == 0 |
1312 |
&& strcmp (bfd_get_section_name (input_bfd, |
&& strcmp (bfd_get_section_name (input_bfd, |
1334 |
become local. */ |
become local. */ |
1335 |
else if (h != NULL |
else if (h != NULL |
1336 |
&& ((! info->symbolic && h->dynindx != -1) |
&& ((! info->symbolic && h->dynindx != -1) |
1337 |
|| (h->elf_link_hash_flags |
|| !h->def_regular)) |
|
& ELF_LINK_HASH_DEF_REGULAR) == 0)) |
|
1338 |
{ |
{ |
1339 |
BFD_ASSERT (h->dynindx != -1); |
BFD_ASSERT (h->dynindx != -1); |
1340 |
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); |
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); |
1351 |
{ |
{ |
1352 |
long indx; |
long indx; |
1353 |
|
|
1354 |
if (h == NULL) |
if (bfd_is_abs_section (sec)) |
|
sec = local_sections[r_symndx]; |
|
|
else |
|
|
{ |
|
|
BFD_ASSERT (h->root.type == bfd_link_hash_defined |
|
|
|| (h->root.type |
|
|
== bfd_link_hash_defweak)); |
|
|
sec = h->root.u.def.section; |
|
|
} |
|
|
if (sec != NULL && bfd_is_abs_section (sec)) |
|
1355 |
indx = 0; |
indx = 0; |
1356 |
else if (sec == NULL || sec->owner == NULL) |
else if (sec == NULL || sec->owner == NULL) |
1357 |
{ |
{ |
1358 |
bfd_set_error (bfd_error_bad_value); |
bfd_set_error (bfd_error_bad_value); |
1359 |
return false; |
return FALSE; |
1360 |
} |
} |
1361 |
else |
else |
1362 |
{ |
{ |
1380 |
} |
} |
1381 |
} |
} |
1382 |
|
|
1383 |
bfd_elf32_swap_reloca_out (output_bfd, &outrel, |
loc = sreloc->contents; |
1384 |
(((Elf32_External_Rela *) |
loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); |
1385 |
sreloc->contents) |
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); |
|
+ sreloc->reloc_count)); |
|
|
++sreloc->reloc_count; |
|
1386 |
|
|
1387 |
/* This reloc will be computed at runtime, so there's no |
/* This reloc will be computed at runtime, so there's no |
1388 |
need to do anything now, unless this is a RELATIVE |
need to do anything now, unless this is a RELATIVE |
1397 |
case (int)R_I370_COPY: |
case (int)R_I370_COPY: |
1398 |
case (int)R_I370_RELATIVE: |
case (int)R_I370_RELATIVE: |
1399 |
(*_bfd_error_handler) |
(*_bfd_error_handler) |
1400 |
("%s: Relocation %s is not yet supported for symbol %s.", |
("%B: Relocation %s is not yet supported for symbol %s.", |
1401 |
bfd_archive_filename (input_bfd), |
input_bfd, |
1402 |
i370_elf_howto_table[(int) r_type]->name, |
i370_elf_howto_table[(int) r_type]->name, |
1403 |
sym_name); |
sym_name); |
1404 |
|
|
1405 |
bfd_set_error (bfd_error_invalid_operation); |
bfd_set_error (bfd_error_invalid_operation); |
1406 |
ret = false; |
ret = FALSE; |
1407 |
continue; |
continue; |
1408 |
} |
} |
1409 |
|
|
1427 |
|
|
1428 |
if (r != bfd_reloc_ok) |
if (r != bfd_reloc_ok) |
1429 |
{ |
{ |
1430 |
ret = false; |
ret = FALSE; |
1431 |
switch (r) |
switch (r) |
1432 |
{ |
{ |
1433 |
default: |
default: |
1438 |
const char *name; |
const char *name; |
1439 |
|
|
1440 |
if (h != NULL) |
if (h != NULL) |
1441 |
name = h->root.root.string; |
name = NULL; |
1442 |
else |
else |
1443 |
{ |
{ |
1444 |
name = bfd_elf_string_from_elf_section (input_bfd, |
name = bfd_elf_string_from_elf_section (input_bfd, |
1452 |
} |
} |
1453 |
|
|
1454 |
(*info->callbacks->reloc_overflow) (info, |
(*info->callbacks->reloc_overflow) (info, |
1455 |
|
(h ? &h->root : NULL), |
1456 |
name, |
name, |
1457 |
howto->name, |
howto->name, |
1458 |
(bfd_vma) 0, |
(bfd_vma) 0, |
1523 |
|
|
1524 |
#define elf_backend_post_process_headers i370_elf_post_process_headers |
#define elf_backend_post_process_headers i370_elf_post_process_headers |
1525 |
|
|
1526 |
static int i370_noop PARAMS ((void)); |
static int i370_noop |
1527 |
|
PARAMS ((void)); |
1528 |
|
|
1529 |
static int i370_noop () |
static int i370_noop () |
1530 |
{ |
{ |
1534 |
/* we need to define these at least as no-ops to link glibc ld.so */ |
/* we need to define these at least as no-ops to link glibc ld.so */ |
1535 |
|
|
1536 |
#define elf_backend_add_symbol_hook \ |
#define elf_backend_add_symbol_hook \ |
1537 |
(boolean (*) PARAMS ((bfd *, struct bfd_link_info *, \ |
(bfd_boolean (*) \ |
1538 |
const Elf_Internal_Sym *, const char **, flagword *, \ |
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, \ |
1539 |
asection **, bfd_vma *))) i370_noop |
const char **, flagword *, asection **, bfd_vma *))) i370_noop |
1540 |
#define elf_backend_finish_dynamic_symbol \ |
#define elf_backend_finish_dynamic_symbol \ |
1541 |
(boolean (*) PARAMS ((bfd *, struct bfd_link_info *, \ |
(bfd_boolean (*) \ |
1542 |
struct elf_link_hash_entry *, \ |
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, \ |
1543 |
Elf_Internal_Sym *))) i370_noop |
Elf_Internal_Sym *))) i370_noop |
1544 |
#define elf_backend_additional_program_headers \ |
#define elf_backend_additional_program_headers \ |
1545 |
(int (*) PARAMS ((bfd *))) i370_noop |
(int (*) PARAMS ((bfd *))) i370_noop |
1546 |
#define elf_backend_modify_segment_map \ |
#define elf_backend_modify_segment_map \ |
1547 |
(boolean (*) PARAMS ((bfd *))) i370_noop |
(bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) i370_noop |
1548 |
|
|
1549 |
#include "elf32-target.h" |
#include "elf32-target.h" |