1 |
/* BFD back-end for OpenRISC 1000 COFF binaries. |
/* BFD back-end for OpenRISC 1000 COFF binaries. |
2 |
Copyright 2002 Free Software Foundation, Inc. |
Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
3 |
Contributed by Ivan Guzvinec <ivang@opencores.org> |
Contributed by Ivan Guzvinec <ivang@opencores.org> |
4 |
|
|
5 |
This file is part of BFD, the Binary File Descriptor library. |
This file is part of BFD, the Binary File Descriptor library. |
27 |
#include "coff/internal.h" |
#include "coff/internal.h" |
28 |
#include "libcoff.h" |
#include "libcoff.h" |
29 |
|
|
30 |
static long get_symbol_value PARAMS ((asymbol *)); |
static long get_symbol_value |
31 |
static bfd_reloc_status_type or32_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); |
PARAMS ((asymbol *)); |
32 |
static boolean coff_or32_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, struct internal_reloc *, struct internal_syment *, asection **)); |
static bfd_reloc_status_type or32_reloc |
33 |
static boolean coff_or32_adjust_symndx PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, boolean *)); |
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); |
34 |
static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); |
static bfd_boolean coff_or32_relocate_section |
35 |
|
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, |
36 |
|
struct internal_reloc *, struct internal_syment *, asection **)); |
37 |
|
static bfd_boolean coff_or32_adjust_symndx |
38 |
|
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, |
39 |
|
struct internal_reloc *, bfd_boolean *)); |
40 |
|
static void reloc_processing |
41 |
|
PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); |
42 |
|
|
43 |
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) |
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) |
44 |
|
|
59 |
/* Provided the symbol, returns the value reffed. */ |
/* Provided the symbol, returns the value reffed. */ |
60 |
|
|
61 |
static long |
static long |
62 |
get_symbol_value (symbol) |
get_symbol_value (symbol) |
63 |
asymbol *symbol; |
asymbol *symbol; |
64 |
{ |
{ |
65 |
long relocation = 0; |
long relocation = 0; |
66 |
|
|
67 |
if (bfd_is_com_section (symbol->section)) |
if (bfd_is_com_section (symbol->section)) |
68 |
relocation = 0; |
relocation = 0; |
69 |
else |
else |
70 |
relocation = symbol->value + |
relocation = symbol->value + |
71 |
symbol->section->output_section->vma + |
symbol->section->output_section->vma + |
72 |
symbol->section->output_offset; |
symbol->section->output_offset; |
89 |
{ |
{ |
90 |
/* The consth relocation comes in two parts, we have to remember |
/* The consth relocation comes in two parts, we have to remember |
91 |
the state between calls, in these variables. */ |
the state between calls, in these variables. */ |
92 |
static boolean part1_consth_active = false; |
static bfd_boolean part1_consth_active = FALSE; |
93 |
static unsigned long part1_consth_value; |
static unsigned long part1_consth_value; |
94 |
|
|
95 |
unsigned long insn; |
unsigned long insn; |
100 |
|
|
101 |
unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ |
unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ |
102 |
bfd_byte *hit_data =addr + (bfd_byte *)(data); |
bfd_byte *hit_data =addr + (bfd_byte *)(data); |
103 |
|
|
104 |
r_type = reloc_entry->howto->type; |
r_type = reloc_entry->howto->type; |
105 |
|
|
106 |
if (output_bfd) |
if (output_bfd) |
107 |
{ |
{ |
108 |
/* Partial linking - do nothing. */ |
/* Partial linking - do nothing. */ |
109 |
reloc_entry->address += input_section->output_offset; |
reloc_entry->address += input_section->output_offset; |
114 |
&& bfd_is_und_section (symbol_in->section)) |
&& bfd_is_und_section (symbol_in->section)) |
115 |
{ |
{ |
116 |
/* Keep the state machine happy in case we're called again. */ |
/* Keep the state machine happy in case we're called again. */ |
117 |
if (r_type == R_IHIHALF) |
if (r_type == R_IHIHALF) |
118 |
{ |
{ |
119 |
part1_consth_active = true; |
part1_consth_active = TRUE; |
120 |
part1_consth_value = 0; |
part1_consth_value = 0; |
121 |
} |
} |
122 |
|
|
123 |
return bfd_reloc_undefined; |
return bfd_reloc_undefined; |
124 |
} |
} |
125 |
|
|
126 |
if ((part1_consth_active) && (r_type != R_IHCONST)) |
if ((part1_consth_active) && (r_type != R_IHCONST)) |
127 |
{ |
{ |
128 |
part1_consth_active = false; |
part1_consth_active = FALSE; |
129 |
*error_message = (char *) "Missing IHCONST"; |
*error_message = (char *) "Missing IHCONST"; |
130 |
|
|
131 |
return bfd_reloc_dangerous; |
return bfd_reloc_dangerous; |
133 |
|
|
134 |
sym_value = get_symbol_value (symbol_in); |
sym_value = get_symbol_value (symbol_in); |
135 |
|
|
136 |
switch (r_type) |
switch (r_type) |
137 |
{ |
{ |
138 |
case R_IREL: |
case R_IREL: |
139 |
insn = bfd_get_32(abfd, hit_data); |
insn = bfd_get_32(abfd, hit_data); |
140 |
|
|
141 |
/* Take the value in the field and sign extend it. */ |
/* Take the value in the field and sign extend it. */ |
142 |
signed_value = EXTRACT_JUMPTARG (insn); |
signed_value = EXTRACT_JUMPTARG (insn); |
148 |
signed_value = 0; |
signed_value = 0; |
149 |
|
|
150 |
signed_value += sym_value + reloc_entry->addend; |
signed_value += sym_value + reloc_entry->addend; |
151 |
#if 0 |
/* Relative jmp/call, so subtract from the value the |
152 |
if ((signed_value & ~0x3ffff) == 0) |
address of the place we're coming from. */ |
153 |
{ /* Absolute jmp/call. */ |
signed_value -= (reloc_entry->address |
154 |
insn |= (1<<24); /* Make it absolute. */ |
+ input_section->output_section->vma |
155 |
/* FIXME: Should we change r_type to R_IABS. */ |
+ input_section->output_offset); |
156 |
} |
if (signed_value > 0x7ffffff || signed_value < -0x8000000) |
157 |
else |
return bfd_reloc_overflow; |
158 |
#endif |
|
|
{ |
|
|
/* Relative jmp/call, so subtract from the value the |
|
|
address of the place we're coming from. */ |
|
|
signed_value -= (reloc_entry->address |
|
|
+ input_section->output_section->vma |
|
|
+ input_section->output_offset); |
|
|
if (signed_value > 0x7ffffff || signed_value < -0x8000000) |
|
|
return bfd_reloc_overflow; |
|
|
} |
|
159 |
signed_value >>= 2; |
signed_value >>= 2; |
160 |
insn = INSERT_JUMPTARG (insn, signed_value); |
insn = INSERT_JUMPTARG (insn, signed_value); |
161 |
bfd_put_32 (abfd, insn, hit_data); |
bfd_put_32 (abfd, insn, hit_data); |
162 |
break; |
break; |
163 |
|
|
164 |
case R_ILOHALF: |
case R_ILOHALF: |
165 |
insn = bfd_get_32 (abfd, hit_data); |
insn = bfd_get_32 (abfd, hit_data); |
166 |
unsigned_value = EXTRACT_HWORD (insn); |
unsigned_value = EXTRACT_HWORD (insn); |
167 |
unsigned_value += sym_value + reloc_entry->addend; |
unsigned_value += sym_value + reloc_entry->addend; |
168 |
insn = INSERT_HWORD (insn, unsigned_value); |
insn = INSERT_HWORD (insn, unsigned_value); |
169 |
bfd_put_32 (abfd, insn, hit_data); |
bfd_put_32 (abfd, insn, hit_data); |
170 |
break; |
break; |
171 |
|
|
172 |
case R_IHIHALF: |
case R_IHIHALF: |
173 |
insn = bfd_get_32 (abfd, hit_data); |
insn = bfd_get_32 (abfd, hit_data); |
174 |
|
|
175 |
/* consth, part 1 |
/* consth, part 1 |
176 |
Just get the symbol value that is referenced. */ |
Just get the symbol value that is referenced. */ |
177 |
part1_consth_active = true; |
part1_consth_active = TRUE; |
178 |
part1_consth_value = sym_value + reloc_entry->addend; |
part1_consth_value = sym_value + reloc_entry->addend; |
179 |
|
|
180 |
/* Don't modify insn until R_IHCONST. */ |
/* Don't modify insn until R_IHCONST. */ |
181 |
break; |
break; |
182 |
|
|
183 |
case R_IHCONST: |
case R_IHCONST: |
184 |
insn = bfd_get_32 (abfd, hit_data); |
insn = bfd_get_32 (abfd, hit_data); |
185 |
|
|
186 |
/* consth, part 2 |
/* consth, part 2 |
187 |
Now relocate the reference. */ |
Now relocate the reference. */ |
188 |
if (! part1_consth_active) |
if (! part1_consth_active) |
189 |
{ |
{ |
190 |
*error_message = (char *) "Missing IHIHALF"; |
*error_message = (char *) "Missing IHIHALF"; |
191 |
return bfd_reloc_dangerous; |
return bfd_reloc_dangerous; |
197 |
unsigned_value += part1_consth_value; |
unsigned_value += part1_consth_value; |
198 |
unsigned_value = unsigned_value >> 16; |
unsigned_value = unsigned_value >> 16; |
199 |
insn = INSERT_HWORD (insn, unsigned_value); |
insn = INSERT_HWORD (insn, unsigned_value); |
200 |
part1_consth_active = false; |
part1_consth_active = FALSE; |
201 |
bfd_put_32 (abfd, insn, hit_data); |
bfd_put_32 (abfd, insn, hit_data); |
202 |
break; |
break; |
203 |
|
|
204 |
case R_BYTE: |
case R_BYTE: |
205 |
insn = bfd_get_8 (abfd, hit_data); |
insn = bfd_get_8 (abfd, hit_data); |
206 |
unsigned_value = insn + sym_value + reloc_entry->addend; |
unsigned_value = insn + sym_value + reloc_entry->addend; |
207 |
if (unsigned_value & 0xffffff00) |
if (unsigned_value & 0xffffff00) |
208 |
return bfd_reloc_overflow; |
return bfd_reloc_overflow; |
209 |
bfd_put_8 (abfd, unsigned_value, hit_data); |
bfd_put_8 (abfd, unsigned_value, hit_data); |
210 |
break; |
break; |
211 |
|
|
212 |
case R_HWORD: |
case R_HWORD: |
213 |
insn = bfd_get_16 (abfd, hit_data); |
insn = bfd_get_16 (abfd, hit_data); |
214 |
unsigned_value = insn + sym_value + reloc_entry->addend; |
unsigned_value = insn + sym_value + reloc_entry->addend; |
215 |
if (unsigned_value & 0xffff0000) |
if (unsigned_value & 0xffff0000) |
216 |
return bfd_reloc_overflow; |
return bfd_reloc_overflow; |
217 |
bfd_put_16 (abfd, insn, hit_data); |
bfd_put_16 (abfd, insn, hit_data); |
218 |
break; |
break; |
219 |
|
|
220 |
case R_WORD: |
case R_WORD: |
221 |
insn = bfd_get_32 (abfd, hit_data); |
insn = bfd_get_32 (abfd, hit_data); |
222 |
insn += sym_value + reloc_entry->addend; |
insn += sym_value + reloc_entry->addend; |
223 |
bfd_put_32 (abfd, insn, hit_data); |
bfd_put_32 (abfd, insn, hit_data); |
224 |
break; |
break; |
225 |
|
|
240 |
complain_on_overflow |
complain_on_overflow |
241 |
special_function |
special_function |
242 |
relocation name |
relocation name |
243 |
partial_inplace |
partial_inplace |
244 |
src_mask |
src_mask |
245 |
*/ |
*/ |
246 |
|
|
247 |
/* FIXME: I'm not real sure about this table. */ |
/* FIXME: I'm not real sure about this table. */ |
248 |
static reloc_howto_type howto_table[] = |
static reloc_howto_type howto_table[] = |
249 |
{ |
{ |
250 |
{ R_ABS, 0, 3, 32, false, 0, complain_overflow_bitfield, or32_reloc, "ABS", true, 0xffffffff,0xffffffff, false }, |
{ R_ABS, 0, 3, 32, FALSE, 0, complain_overflow_bitfield, or32_reloc, "ABS", TRUE, 0xffffffff,0xffffffff, FALSE }, |
251 |
EMPTY_HOWTO (1), |
EMPTY_HOWTO (1), |
252 |
EMPTY_HOWTO (2), |
EMPTY_HOWTO (2), |
253 |
EMPTY_HOWTO (3), |
EMPTY_HOWTO (3), |
271 |
EMPTY_HOWTO (21), |
EMPTY_HOWTO (21), |
272 |
EMPTY_HOWTO (22), |
EMPTY_HOWTO (22), |
273 |
EMPTY_HOWTO (23), |
EMPTY_HOWTO (23), |
274 |
{ R_IREL, 0, 3, 32, true, 0, complain_overflow_signed, or32_reloc, "IREL", true, 0xffffffff,0xffffffff, false }, |
{ R_IREL, 0, 3, 32, TRUE, 0, complain_overflow_signed, or32_reloc, "IREL", TRUE, 0xffffffff,0xffffffff, FALSE }, |
275 |
{ R_IABS, 0, 3, 32, false, 0, complain_overflow_bitfield, or32_reloc, "IABS", true, 0xffffffff,0xffffffff, false }, |
{ R_IABS, 0, 3, 32, FALSE, 0, complain_overflow_bitfield, or32_reloc, "IABS", TRUE, 0xffffffff,0xffffffff, FALSE }, |
276 |
{ R_ILOHALF, 0, 3, 16, true, 0, complain_overflow_signed, or32_reloc, "ILOHALF", true, 0x0000ffff,0x0000ffff, false }, |
{ R_ILOHALF, 0, 3, 16, TRUE, 0, complain_overflow_signed, or32_reloc, "ILOHALF", TRUE, 0x0000ffff,0x0000ffff, FALSE }, |
277 |
{ R_IHIHALF, 0, 3, 16, true, 16,complain_overflow_signed, or32_reloc, "IHIHALF", true, 0xffff0000,0xffff0000, false }, |
{ R_IHIHALF, 0, 3, 16, TRUE, 16,complain_overflow_signed, or32_reloc, "IHIHALF", TRUE, 0xffff0000,0xffff0000, FALSE }, |
278 |
{ R_IHCONST, 0, 3, 16, true, 0, complain_overflow_signed, or32_reloc, "IHCONST", true, 0xffff0000,0xffff0000, false }, |
{ R_IHCONST, 0, 3, 16, TRUE, 0, complain_overflow_signed, or32_reloc, "IHCONST", TRUE, 0xffff0000,0xffff0000, FALSE }, |
279 |
{ R_BYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, or32_reloc, "BYTE", true, 0x000000ff,0x000000ff, false }, |
{ R_BYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, or32_reloc, "BYTE", TRUE, 0x000000ff,0x000000ff, FALSE }, |
280 |
{ R_HWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, or32_reloc, "HWORD", true, 0x0000ffff,0x0000ffff, false }, |
{ R_HWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, or32_reloc, "HWORD", TRUE, 0x0000ffff,0x0000ffff, FALSE }, |
281 |
{ R_WORD, 0, 2, 32, false, 0, complain_overflow_bitfield, or32_reloc, "WORD", true, 0xffffffff,0xffffffff, false }, |
{ R_WORD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, or32_reloc, "WORD", TRUE, 0xffffffff,0xffffffff, FALSE }, |
282 |
}; |
}; |
283 |
|
|
284 |
#define BADMAG(x) OR32BADMAG (x) |
#define BADMAG(x) OR32BADMAG (x) |
296 |
{ |
{ |
297 |
static bfd_vma ihihalf_vaddr = (bfd_vma) -1; |
static bfd_vma ihihalf_vaddr = (bfd_vma) -1; |
298 |
|
|
299 |
relent->address = reloc->r_vaddr; |
relent->address = reloc->r_vaddr; |
300 |
relent->howto = howto_table + reloc->r_type; |
relent->howto = howto_table + reloc->r_type; |
301 |
|
|
302 |
if (reloc->r_type == R_IHCONST) |
if (reloc->r_type == R_IHCONST) |
303 |
{ |
{ |
304 |
/* The address of an R_IHCONST should always be the address of |
/* The address of an R_IHCONST should always be the address of |
305 |
the immediately preceding R_IHIHALF. relocs generated by gas |
the immediately preceding R_IHIHALF. relocs generated by gas |
306 |
are correct, but relocs generated by High C are different (I |
are correct, but relocs generated by High C are different (I |
334 |
|
|
335 |
/* The reloc processing routine for the optimized COFF linker. */ |
/* The reloc processing routine for the optimized COFF linker. */ |
336 |
|
|
337 |
static boolean |
static bfd_boolean |
338 |
coff_or32_relocate_section (output_bfd, info, input_bfd, input_section, |
coff_or32_relocate_section (output_bfd, info, input_bfd, input_section, |
339 |
contents, relocs, syms, sections) |
contents, relocs, syms, sections) |
340 |
bfd *output_bfd ATTRIBUTE_UNUSED; |
bfd *output_bfd ATTRIBUTE_UNUSED; |
348 |
{ |
{ |
349 |
struct internal_reloc *rel; |
struct internal_reloc *rel; |
350 |
struct internal_reloc *relend; |
struct internal_reloc *relend; |
351 |
boolean hihalf; |
bfd_boolean hihalf; |
352 |
bfd_vma hihalf_val; |
bfd_vma hihalf_val; |
353 |
|
|
354 |
/* If we are performing a relocateable link, we don't need to do a |
/* If we are performing a relocatable link, we don't need to do a |
355 |
thing. The caller will take care of adjusting the reloc |
thing. The caller will take care of adjusting the reloc |
356 |
addresses and symbol indices. */ |
addresses and symbol indices. */ |
357 |
if (info->relocateable) |
if (info->relocatable) |
358 |
return true; |
return TRUE; |
359 |
|
|
360 |
hihalf = false; |
hihalf = FALSE; |
361 |
hihalf_val = 0; |
hihalf_val = 0; |
362 |
|
|
363 |
rel = relocs; |
rel = relocs; |
371 |
struct internal_syment *sym; |
struct internal_syment *sym; |
372 |
asection *sec; |
asection *sec; |
373 |
bfd_vma val; |
bfd_vma val; |
374 |
boolean overflow; |
bfd_boolean overflow; |
375 |
unsigned long insn; |
unsigned long insn; |
376 |
long signed_value; |
long signed_value; |
377 |
unsigned long unsigned_value; |
unsigned long unsigned_value; |
422 |
{ |
{ |
423 |
if (! ((*info->callbacks->undefined_symbol) |
if (! ((*info->callbacks->undefined_symbol) |
424 |
(info, h->root.root.string, input_bfd, input_section, |
(info, h->root.root.string, input_bfd, input_section, |
425 |
rel->r_vaddr - input_section->vma, true))) |
rel->r_vaddr - input_section->vma, TRUE))) |
426 |
return false; |
return FALSE; |
427 |
} |
} |
428 |
} |
} |
429 |
|
|
432 |
if (! ((*info->callbacks->reloc_dangerous) |
if (! ((*info->callbacks->reloc_dangerous) |
433 |
(info, "missing IHCONST reloc", input_bfd, |
(info, "missing IHCONST reloc", input_bfd, |
434 |
input_section, rel->r_vaddr - input_section->vma))) |
input_section, rel->r_vaddr - input_section->vma))) |
435 |
return false; |
return FALSE; |
436 |
hihalf = false; |
hihalf = FALSE; |
437 |
} |
} |
438 |
} |
} |
439 |
|
|
440 |
overflow = false; |
overflow = FALSE; |
441 |
|
|
442 |
switch (rel->r_type) |
switch (rel->r_type) |
443 |
{ |
{ |
444 |
default: |
default: |
445 |
bfd_set_error (bfd_error_bad_value); |
bfd_set_error (bfd_error_bad_value); |
446 |
return false; |
return FALSE; |
447 |
|
|
448 |
case R_IREL: |
case R_IREL: |
449 |
insn = bfd_get_32 (input_bfd, loc); |
insn = bfd_get_32 (input_bfd, loc); |
456 |
/* Determine the destination of the jump. */ |
/* Determine the destination of the jump. */ |
457 |
signed_value += val; |
signed_value += val; |
458 |
|
|
459 |
#if 0 |
/* Make the destination PC relative. */ |
460 |
if ((signed_value & ~0x3ffff) == 0) |
signed_value -= (input_section->output_section->vma |
461 |
{ |
+ input_section->output_offset |
462 |
/* We can use an absolute jump. */ |
+ (rel->r_vaddr - input_section->vma)); |
463 |
insn |= (1 << 24); |
if (signed_value > 0x7ffffff || signed_value < - 0x8000000) |
464 |
} |
{ |
465 |
else |
overflow = TRUE; |
466 |
#endif |
signed_value = 0; |
467 |
{ |
} |
|
/* Make the destination PC relative. */ |
|
|
signed_value -= (input_section->output_section->vma |
|
|
+ input_section->output_offset |
|
|
+ (rel->r_vaddr - input_section->vma)); |
|
|
if (signed_value > 0x7ffffff || signed_value < - 0x8000000) |
|
|
{ |
|
|
overflow = true; |
|
|
signed_value = 0; |
|
|
} |
|
|
} |
|
468 |
|
|
469 |
/* Put the adjusted value back into the instruction. */ |
/* Put the adjusted value back into the instruction. */ |
470 |
signed_value >>= 2; |
signed_value >>= 2; |
483 |
|
|
484 |
case R_IHIHALF: |
case R_IHIHALF: |
485 |
/* Save the value for the R_IHCONST reloc. */ |
/* Save the value for the R_IHCONST reloc. */ |
486 |
hihalf = true; |
hihalf = TRUE; |
487 |
hihalf_val = val; |
hihalf_val = val; |
488 |
break; |
break; |
489 |
|
|
493 |
if (! ((*info->callbacks->reloc_dangerous) |
if (! ((*info->callbacks->reloc_dangerous) |
494 |
(info, "missing IHIHALF reloc", input_bfd, |
(info, "missing IHIHALF reloc", input_bfd, |
495 |
input_section, rel->r_vaddr - input_section->vma))) |
input_section, rel->r_vaddr - input_section->vma))) |
496 |
return false; |
return FALSE; |
497 |
hihalf_val = 0; |
hihalf_val = 0; |
498 |
} |
} |
499 |
|
|
503 |
insn = INSERT_HWORD (insn, unsigned_value); |
insn = INSERT_HWORD (insn, unsigned_value); |
504 |
bfd_put_32 (input_bfd, (bfd_vma) insn, loc); |
bfd_put_32 (input_bfd, (bfd_vma) insn, loc); |
505 |
|
|
506 |
hihalf = false; |
hihalf = FALSE; |
507 |
break; |
break; |
508 |
|
|
509 |
case R_BYTE: |
case R_BYTE: |
512 |
rstat = _bfd_relocate_contents (howto_table + rel->r_type, |
rstat = _bfd_relocate_contents (howto_table + rel->r_type, |
513 |
input_bfd, val, loc); |
input_bfd, val, loc); |
514 |
if (rstat == bfd_reloc_overflow) |
if (rstat == bfd_reloc_overflow) |
515 |
overflow = true; |
overflow = TRUE; |
516 |
else if (rstat != bfd_reloc_ok) |
else if (rstat != bfd_reloc_ok) |
517 |
abort (); |
abort (); |
518 |
break; |
break; |
526 |
if (symndx == -1) |
if (symndx == -1) |
527 |
name = "*ABS*"; |
name = "*ABS*"; |
528 |
else if (h != NULL) |
else if (h != NULL) |
529 |
name = h->root.root.string; |
name = NULL; |
530 |
else if (sym == NULL) |
else if (sym == NULL) |
531 |
name = "*unknown*"; |
name = "*unknown*"; |
532 |
else if (sym->_n._n_n._n_zeroes == 0 |
else if (sym->_n._n_n._n_zeroes == 0 |
540 |
} |
} |
541 |
|
|
542 |
if (! ((*info->callbacks->reloc_overflow) |
if (! ((*info->callbacks->reloc_overflow) |
543 |
(info, name, howto_table[rel->r_type].name, (bfd_vma) 0, |
(info, (h ? &h->root : NULL), name, |
544 |
input_bfd, input_section, |
howto_table[rel->r_type].name, (bfd_vma) 0, input_bfd, |
545 |
rel->r_vaddr - input_section->vma))) |
input_section, rel->r_vaddr - input_section->vma))) |
546 |
return false; |
return FALSE; |
547 |
} |
} |
548 |
} |
} |
549 |
|
|
550 |
return true; |
return TRUE; |
551 |
} |
} |
552 |
|
|
553 |
#define coff_relocate_section coff_or32_relocate_section |
#define coff_relocate_section coff_or32_relocate_section |
555 |
/* We don't want to change the symndx of a R_IHCONST reloc, since it |
/* We don't want to change the symndx of a R_IHCONST reloc, since it |
556 |
is actually an addend, not a symbol index at all. */ |
is actually an addend, not a symbol index at all. */ |
557 |
|
|
558 |
static boolean |
static bfd_boolean |
559 |
coff_or32_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) |
coff_or32_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) |
560 |
bfd *obfd ATTRIBUTE_UNUSED; |
bfd *obfd ATTRIBUTE_UNUSED; |
561 |
struct bfd_link_info *info ATTRIBUTE_UNUSED; |
struct bfd_link_info *info ATTRIBUTE_UNUSED; |
562 |
bfd *ibfd ATTRIBUTE_UNUSED; |
bfd *ibfd ATTRIBUTE_UNUSED; |
563 |
asection *sec ATTRIBUTE_UNUSED; |
asection *sec ATTRIBUTE_UNUSED; |
564 |
struct internal_reloc *irel; |
struct internal_reloc *irel; |
565 |
boolean *adjustedp; |
bfd_boolean *adjustedp; |
566 |
{ |
{ |
567 |
if (irel->r_type == R_IHCONST) |
if (irel->r_type == R_IHCONST) |
568 |
*adjustedp = true; |
*adjustedp = TRUE; |
569 |
else |
else |
570 |
*adjustedp = false; |
*adjustedp = FALSE; |
571 |
return true; |
return TRUE; |
572 |
} |
} |
573 |
|
|
574 |
#define coff_adjust_symndx coff_or32_adjust_symndx |
#define coff_adjust_symndx coff_or32_adjust_symndx |
587 |
HAS_SYMS | HAS_LOCALS | WP_TEXT), |
HAS_SYMS | HAS_LOCALS | WP_TEXT), |
588 |
|
|
589 |
(SEC_HAS_CONTENTS | SEC_ALLOC | /* Section flags. */ |
(SEC_HAS_CONTENTS | SEC_ALLOC | /* Section flags. */ |
590 |
SEC_LOAD | SEC_RELOC | |
SEC_LOAD | SEC_RELOC | |
591 |
SEC_READONLY ), |
SEC_READONLY ), |
592 |
'_', /* Leading underscore. */ |
'_', /* Leading underscore. */ |
593 |
'/', /* ar_pad_char. */ |
'/', /* ar_pad_char. */ |
603 |
bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
604 |
bfd_getb16, bfd_getb_signed_16, bfd_putb16, |
bfd_getb16, bfd_getb_signed_16, bfd_putb16, |
605 |
|
|
606 |
{ |
{ |
607 |
_bfd_dummy_target, |
_bfd_dummy_target, |
608 |
coff_object_p, |
coff_object_p, |
609 |
bfd_generic_archive_p, |
bfd_generic_archive_p, |
631 |
BFD_JUMP_TABLE_WRITE (coff), |
BFD_JUMP_TABLE_WRITE (coff), |
632 |
BFD_JUMP_TABLE_LINK (coff), |
BFD_JUMP_TABLE_LINK (coff), |
633 |
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
634 |
|
|
635 |
/* Alternative_target. */ |
/* Alternative_target. */ |
636 |
#ifdef TARGET_LITTLE_SYM |
#ifdef TARGET_LITTLE_SYM |
637 |
& TARGET_LITTLE_SYM, |
& TARGET_LITTLE_SYM, |