1 |
/* DLX specific support for 32-bit ELF |
/* DLX specific support for 32-bit ELF |
2 |
Copyright 2002 Free Software Foundation, Inc. |
Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of BFD, the Binary File Descriptor library. |
This file is part of BFD, the Binary File Descriptor library. |
5 |
|
|
25 |
|
|
26 |
int set_dlx_skip_hi16_flag PARAMS ((int)); |
int set_dlx_skip_hi16_flag PARAMS ((int)); |
27 |
|
|
28 |
static boolean elf32_dlx_check_relocs |
static bfd_boolean elf32_dlx_check_relocs |
29 |
PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); |
PARAMS ((bfd *, struct bfd_link_info *, asection *, |
30 |
|
const Elf_Internal_Rela *)); |
31 |
static void elf32_dlx_info_to_howto |
static void elf32_dlx_info_to_howto |
32 |
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); |
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); |
33 |
static void elf32_dlx_info_to_howto_rel |
static void elf32_dlx_info_to_howto_rel |
34 |
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); |
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); |
35 |
static bfd_reloc_status_type elf32_dlx_relocate16 |
static bfd_reloc_status_type elf32_dlx_relocate16 |
36 |
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); |
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); |
37 |
static bfd_reloc_status_type elf32_dlx_relocate26 |
static bfd_reloc_status_type elf32_dlx_relocate26 |
58 |
0, /* rightshift */ |
0, /* rightshift */ |
59 |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
60 |
0, /* bitsize */ |
0, /* bitsize */ |
61 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
62 |
0, /* bitpos */ |
0, /* bitpos */ |
63 |
complain_overflow_dont,/* complain_on_overflow */ |
complain_overflow_dont,/* complain_on_overflow */ |
64 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
65 |
"R_DLX_NONE", /* name */ |
"R_DLX_NONE", /* name */ |
66 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
67 |
0, /* src_mask */ |
0, /* src_mask */ |
68 |
0, /* dst_mask */ |
0, /* dst_mask */ |
69 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
70 |
|
|
71 |
/* 8 bit relocation. */ |
/* 8 bit relocation. */ |
72 |
HOWTO (R_DLX_RELOC_8, /* type */ |
HOWTO (R_DLX_RELOC_8, /* type */ |
73 |
0, /* rightshift */ |
0, /* rightshift */ |
74 |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
75 |
8, /* bitsize */ |
8, /* bitsize */ |
76 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
77 |
0, /* bitpos */ |
0, /* bitpos */ |
78 |
complain_overflow_dont,/* complain_on_overflow */ |
complain_overflow_dont,/* complain_on_overflow */ |
79 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
80 |
"R_DLX_RELOC_8", /* name */ |
"R_DLX_RELOC_8", /* name */ |
81 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
82 |
0xff, /* src_mask */ |
0xff, /* src_mask */ |
83 |
0xff, /* dst_mask */ |
0xff, /* dst_mask */ |
84 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
85 |
|
|
86 |
/* 16 bit relocation. */ |
/* 16 bit relocation. */ |
87 |
HOWTO (R_DLX_RELOC_16, /* type */ |
HOWTO (R_DLX_RELOC_16, /* 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_dont,/* complain_on_overflow */ |
complain_overflow_dont,/* complain_on_overflow */ |
94 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
95 |
"R_DLX_RELOC_16", /* name */ |
"R_DLX_RELOC_16", /* name */ |
96 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
97 |
0xffff, /* src_mask */ |
0xffff, /* src_mask */ |
98 |
0xffff, /* dst_mask */ |
0xffff, /* dst_mask */ |
99 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
|
|
|
|
#if 0 |
|
|
/* 26 bit jump address. */ |
|
|
HOWTO (R_DLX_RELOC_26, /* type */ |
|
|
0, /* rightshift */ |
|
|
2, /* size (0 = byte, 1 = short, 2 = long) */ |
|
|
26, /* bitsize */ |
|
|
false, /* pc_relative */ |
|
|
0, /* bitpos */ |
|
|
complain_overflow_dont,/* complain_on_overflow */ |
|
|
/* This needs complex overflow detection, because the upper four |
|
|
bits must match the PC + 4. */ |
|
|
bfd_elf_generic_reloc, /* special_function */ |
|
|
"R_DLX_RELOC_26", /* name */ |
|
|
true, /* partial_inplace */ |
|
|
0x3ffffff, /* src_mask */ |
|
|
0x3ffffff, /* dst_mask */ |
|
|
false), /* pcrel_offset */ |
|
|
#endif |
|
100 |
|
|
101 |
/* 32 bit relocation. */ |
/* 32 bit relocation. */ |
102 |
HOWTO (R_DLX_RELOC_32, /* type */ |
HOWTO (R_DLX_RELOC_32, /* type */ |
103 |
0, /* rightshift */ |
0, /* rightshift */ |
104 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
105 |
32, /* bitsize */ |
32, /* bitsize */ |
106 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
107 |
0, /* bitpos */ |
0, /* bitpos */ |
108 |
complain_overflow_dont,/* complain_on_overflow */ |
complain_overflow_dont,/* complain_on_overflow */ |
109 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
110 |
"R_DLX_RELOC_32", /* name */ |
"R_DLX_RELOC_32", /* name */ |
111 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
112 |
0xffffffff, /* src_mask */ |
0xffffffff, /* src_mask */ |
113 |
0xffffffff, /* dst_mask */ |
0xffffffff, /* dst_mask */ |
114 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
115 |
|
|
116 |
/* GNU extension to record C++ vtable hierarchy */ |
/* GNU extension to record C++ vtable hierarchy */ |
117 |
HOWTO (R_DLX_GNU_VTINHERIT, /* type */ |
HOWTO (R_DLX_GNU_VTINHERIT, /* type */ |
118 |
0, /* rightshift */ |
0, /* rightshift */ |
119 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
120 |
0, /* bitsize */ |
0, /* bitsize */ |
121 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
122 |
0, /* bitpos */ |
0, /* bitpos */ |
123 |
complain_overflow_dont,/* complain_on_overflow */ |
complain_overflow_dont,/* complain_on_overflow */ |
124 |
NULL, /* special_function */ |
NULL, /* special_function */ |
125 |
"R_DLX_GNU_VTINHERIT", /* name */ |
"R_DLX_GNU_VTINHERIT", /* name */ |
126 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
127 |
0, /* src_mask */ |
0, /* src_mask */ |
128 |
0, /* dst_mask */ |
0, /* dst_mask */ |
129 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
130 |
|
|
131 |
/* GNU extension to record C++ vtable member usage */ |
/* GNU extension to record C++ vtable member usage */ |
132 |
HOWTO (R_DLX_GNU_VTENTRY, /* type */ |
HOWTO (R_DLX_GNU_VTENTRY, /* type */ |
133 |
0, /* rightshift */ |
0, /* rightshift */ |
134 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
135 |
0, /* bitsize */ |
0, /* bitsize */ |
136 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
137 |
0, /* bitpos */ |
0, /* bitpos */ |
138 |
complain_overflow_dont,/* complain_on_overflow */ |
complain_overflow_dont,/* complain_on_overflow */ |
139 |
_bfd_elf_rel_vtable_reloc_fn,/* special_function */ |
_bfd_elf_rel_vtable_reloc_fn,/* special_function */ |
140 |
"R_DLX_GNU_VTENTRY", /* name */ |
"R_DLX_GNU_VTENTRY", /* name */ |
141 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
142 |
0, /* src_mask */ |
0, /* src_mask */ |
143 |
0, /* dst_mask */ |
0, /* dst_mask */ |
144 |
false) /* pcrel_offset */ |
FALSE) /* pcrel_offset */ |
145 |
}; |
}; |
146 |
|
|
147 |
/* 16 bit offset for pc-relative branches. */ |
/* 16 bit offset for pc-relative branches. */ |
150 |
0, /* rightshift */ |
0, /* rightshift */ |
151 |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
152 |
16, /* bitsize */ |
16, /* bitsize */ |
153 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
154 |
0, /* bitpos */ |
0, /* bitpos */ |
155 |
complain_overflow_signed, /* complain_on_overflow */ |
complain_overflow_signed, /* complain_on_overflow */ |
156 |
elf32_dlx_relocate16, /* special_function */ |
elf32_dlx_relocate16, /* special_function */ |
157 |
"R_DLX_RELOC_16_PCREL",/* name */ |
"R_DLX_RELOC_16_PCREL",/* name */ |
158 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
159 |
0xffff, /* src_mask */ |
0xffff, /* src_mask */ |
160 |
0xffff, /* dst_mask */ |
0xffff, /* dst_mask */ |
161 |
true); /* pcrel_offset */ |
TRUE); /* pcrel_offset */ |
162 |
|
|
163 |
/* 26 bit offset for pc-relative branches. */ |
/* 26 bit offset for pc-relative branches. */ |
164 |
static reloc_howto_type elf_dlx_gnu_rel26_s2 = |
static reloc_howto_type elf_dlx_gnu_rel26_s2 = |
166 |
0, /* rightshift */ |
0, /* rightshift */ |
167 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
168 |
26, /* bitsize */ |
26, /* bitsize */ |
169 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
170 |
0, /* bitpos */ |
0, /* bitpos */ |
171 |
complain_overflow_dont,/* complain_on_overflow */ |
complain_overflow_dont,/* complain_on_overflow */ |
172 |
elf32_dlx_relocate26, /* special_function */ |
elf32_dlx_relocate26, /* special_function */ |
173 |
"R_DLX_RELOC_26_PCREL",/* name */ |
"R_DLX_RELOC_26_PCREL",/* name */ |
174 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
175 |
0xffff, /* src_mask */ |
0xffff, /* src_mask */ |
176 |
0xffff, /* dst_mask */ |
0xffff, /* dst_mask */ |
177 |
true); /* pcrel_offset */ |
TRUE); /* pcrel_offset */ |
178 |
|
|
179 |
/* High 16 bits of symbol value. */ |
/* High 16 bits of symbol value. */ |
180 |
static reloc_howto_type elf_dlx_reloc_16_hi = |
static reloc_howto_type elf_dlx_reloc_16_hi = |
182 |
16, /* rightshift */ |
16, /* rightshift */ |
183 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
184 |
32, /* bitsize */ |
32, /* bitsize */ |
185 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
186 |
0, /* bitpos */ |
0, /* bitpos */ |
187 |
complain_overflow_dont, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
188 |
_bfd_dlx_elf_hi16_reloc,/* special_function */ |
_bfd_dlx_elf_hi16_reloc,/* special_function */ |
189 |
"R_DLX_RELOC_16_HI", /* name */ |
"R_DLX_RELOC_16_HI", /* name */ |
190 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
191 |
0xFFFF, /* src_mask */ |
0xFFFF, /* src_mask */ |
192 |
0xffff, /* dst_mask */ |
0xffff, /* dst_mask */ |
193 |
false); /* pcrel_offset */ |
FALSE); /* pcrel_offset */ |
194 |
|
|
195 |
/* Low 16 bits of symbol value. */ |
/* Low 16 bits of symbol value. */ |
196 |
static reloc_howto_type elf_dlx_reloc_16_lo = |
static reloc_howto_type elf_dlx_reloc_16_lo = |
198 |
0, /* rightshift */ |
0, /* rightshift */ |
199 |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
200 |
16, /* bitsize */ |
16, /* bitsize */ |
201 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
202 |
0, /* bitpos */ |
0, /* bitpos */ |
203 |
complain_overflow_dont,/* complain_on_overflow */ |
complain_overflow_dont,/* complain_on_overflow */ |
204 |
bfd_elf_generic_reloc, /* special_function */ |
bfd_elf_generic_reloc, /* special_function */ |
205 |
"R_DLX_RELOC_16_LO", /* name */ |
"R_DLX_RELOC_16_LO", /* name */ |
206 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
207 |
0xffff, /* src_mask */ |
0xffff, /* src_mask */ |
208 |
0xffff, /* dst_mask */ |
0xffff, /* dst_mask */ |
209 |
false); /* pcrel_offset */ |
FALSE); /* pcrel_offset */ |
210 |
|
|
211 |
|
|
212 |
/* The gas default beheaver is not to preform the %hi modifier so that the |
/* The gas default behavior is not to preform the %hi modifier so that the |
213 |
GNU assembler can have the lower 16 bits offset placed in the insn, BUT |
GNU assembler can have the lower 16 bits offset placed in the insn, BUT |
214 |
we do like the gas to indicate it is %hi reloc type so when we in the link |
we do like the gas to indicate it is %hi reloc type so when we in the link |
215 |
loader phase we can have the corrected hi16 vale replace the buggous lo16 |
loader phase we can have the corrected hi16 vale replace the buggous lo16 |
242 |
/* If the skip flag is set then we simply do the generic relocating, this |
/* If the skip flag is set then we simply do the generic relocating, this |
243 |
is more of a hack for dlx gas/gld, so we do not need to do the %hi/%lo |
is more of a hack for dlx gas/gld, so we do not need to do the %hi/%lo |
244 |
fixup like mips gld did. */ |
fixup like mips gld did. */ |
|
#if 0 |
|
|
printf ("DEBUG: skip_dlx_elf_hi16_reloc = 0x%08x\n", skip_dlx_elf_hi16_reloc); |
|
|
#endif |
|
245 |
if (skip_dlx_elf_hi16_reloc) |
if (skip_dlx_elf_hi16_reloc) |
246 |
return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, |
return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, |
247 |
input_section, output_bfd, error_message); |
input_section, output_bfd, error_message); |
262 |
&& output_bfd == (bfd *) NULL) |
&& output_bfd == (bfd *) NULL) |
263 |
ret = bfd_reloc_undefined; |
ret = bfd_reloc_undefined; |
264 |
|
|
|
#if 0 |
|
|
{ |
|
|
unsigned long vallo, val; |
|
|
|
|
|
vallo = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); |
|
|
printf ("DEBUG: The relocation address = 0x%08x\n", reloc_entry->address); |
|
|
printf ("DEBUG: The symbol = 0x%08x\n", vallo); |
|
|
printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); |
|
|
printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); |
|
|
printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); |
|
|
printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); |
|
|
printf ("DEBUG: The input_offset = 0x%08x\n", input_section->output_offset); |
|
|
printf ("DEBUG: The input_vma = 0x%08x\n", input_section->vma); |
|
|
printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); |
|
|
} |
|
|
#endif |
|
|
|
|
265 |
relocation = (bfd_is_com_section (symbol->section)) ? 0 : symbol->value; |
relocation = (bfd_is_com_section (symbol->section)) ? 0 : symbol->value; |
266 |
relocation += symbol->section->output_section->vma; |
relocation += symbol->section->output_section->vma; |
267 |
relocation += symbol->section->output_offset; |
relocation += symbol->section->output_offset; |
268 |
relocation += reloc_entry->addend; |
relocation += reloc_entry->addend; |
269 |
relocation += bfd_get_16 (abfd, (bfd_byte *)data + reloc_entry->address); |
relocation += bfd_get_16 (abfd, (bfd_byte *)data + reloc_entry->address); |
270 |
|
|
271 |
if (reloc_entry->address > input_section->_cooked_size) |
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) |
272 |
return bfd_reloc_outofrange; |
return bfd_reloc_outofrange; |
273 |
|
|
|
#if 0 |
|
|
printf ("DEBUG: The finial relocation value = 0x%08x\n", relocation); |
|
|
#endif |
|
|
|
|
274 |
bfd_put_16 (abfd, (short)((relocation >> 16) & 0xFFFF), |
bfd_put_16 (abfd, (short)((relocation >> 16) & 0xFFFF), |
275 |
(bfd_byte *)data + reloc_entry->address); |
(bfd_byte *)data + reloc_entry->address); |
276 |
|
|
277 |
return ret; |
return ret; |
278 |
} |
} |
279 |
|
|
280 |
/* ELF relocs are against symbols. If we are producing relocateable |
/* ELF relocs are against symbols. If we are producing relocatable |
281 |
output, and the reloc is against an external symbol, and nothing |
output, and the reloc is against an external symbol, and nothing |
282 |
has given us any additional addend, the resulting reloc will also |
has given us any additional addend, the resulting reloc will also |
283 |
be against the same symbol. In such a case, we don't want to |
be against the same symbol. In such a case, we don't want to |
285 |
all be done at final link time. Rather than put special case code |
all be done at final link time. Rather than put special case code |
286 |
into bfd_perform_relocation, all the reloc types use this howto |
into bfd_perform_relocation, all the reloc types use this howto |
287 |
function. It just short circuits the reloc if producing |
function. It just short circuits the reloc if producing |
288 |
relocateable output against an external symbol. */ |
relocatable output against an external symbol. */ |
289 |
|
|
290 |
static bfd_reloc_status_type |
static bfd_reloc_status_type |
291 |
elf32_dlx_relocate16 (abfd, reloc_entry, symbol, data, |
elf32_dlx_relocate16 (abfd, reloc_entry, symbol, data, |
340 |
val = (symbol->section->output_offset + |
val = (symbol->section->output_offset + |
341 |
symbol->section->output_section->vma + |
symbol->section->output_section->vma + |
342 |
symbol->value) - vallo; |
symbol->value) - vallo; |
|
#if 0 |
|
|
printf ("DEBUG elf32_dlx_relocate: We are here\n"); |
|
|
printf ("DEBUG: The insn = 0x%08x\n", insn); |
|
|
printf ("DEBUG: The vallo = 0x%08x\n", vallo); |
|
|
printf ("DEBUG: The val = 0x%08x\n", val); |
|
|
printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); |
|
|
printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); |
|
|
printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); |
|
|
printf ("DEBUG: The lma = 0x%08x\n", symbol->section->output_section->lma); |
|
|
printf ("DEBUG: The alignment_power = 0x%08x\n", symbol->section->output_section->alignment_power); |
|
|
printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); |
|
|
printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); |
|
|
#endif |
|
343 |
|
|
344 |
if (abs ((int) val) > 0x00007FFF) |
if (abs ((int) val) > 0x00007FFF) |
345 |
return bfd_reloc_outofrange; |
return bfd_reloc_outofrange; |
405 |
val = (symbol->section->output_offset + |
val = (symbol->section->output_offset + |
406 |
symbol->section->output_section->vma + symbol->value) |
symbol->section->output_section->vma + symbol->value) |
407 |
- vallo; |
- vallo; |
|
#if 0 |
|
|
printf ("DEBUG elf32_dlx_relocate26: We are here\n"); |
|
|
printf ("DEBUG: The insn = 0x%08x\n", insn); |
|
|
printf ("DEBUG: The vallo = 0x%08x\n", vallo); |
|
|
printf ("DEBUG: The val = 0x%08x\n", val); |
|
|
printf ("DEBUG: The abs(val) = 0x%08x\n", abs (val)); |
|
|
printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); |
|
|
printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); |
|
|
printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); |
|
|
printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); |
|
|
printf ("DEBUG: The input_vma = 0x%08x\n", input_section->output_section->vma); |
|
|
printf ("DEBUG: The input_offset = 0x%08x\n", input_section->output_offset); |
|
|
printf ("DEBUG: The input_name = %s\n", input_section->name); |
|
|
printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); |
|
|
#endif |
|
408 |
|
|
409 |
if (abs ((int) val) > 0x01FFFFFF) |
if (abs ((int) val) > 0x01FFFFFF) |
410 |
return bfd_reloc_outofrange; |
return bfd_reloc_outofrange; |
422 |
More about this table - for dlx elf relocation we do not really |
More about this table - for dlx elf relocation we do not really |
423 |
need this table, if we have a rtype defined in this table will |
need this table, if we have a rtype defined in this table will |
424 |
caused tc_gen_relocate confused and die on us, but if we remove |
caused tc_gen_relocate confused and die on us, but if we remove |
425 |
this table it will caused more problem, so for now simple soulation |
this table it will caused more problem, so for now simple solution |
426 |
is to remove those entries which may cause problem. */ |
is to remove those entries which may cause problem. */ |
427 |
struct elf_reloc_map |
struct elf_reloc_map |
428 |
{ |
{ |
434 |
{ |
{ |
435 |
{ BFD_RELOC_NONE, R_DLX_NONE }, |
{ BFD_RELOC_NONE, R_DLX_NONE }, |
436 |
{ BFD_RELOC_16, R_DLX_RELOC_16 }, |
{ BFD_RELOC_16, R_DLX_RELOC_16 }, |
|
#if 0 |
|
|
{ BFD_RELOC_DLX_JMP26, R_DLX_RELOC_26_PCREL }, |
|
|
#endif |
|
437 |
{ BFD_RELOC_32, R_DLX_RELOC_32 }, |
{ BFD_RELOC_32, R_DLX_RELOC_32 }, |
438 |
{ BFD_RELOC_DLX_HI16_S, R_DLX_RELOC_16_HI }, |
{ BFD_RELOC_DLX_HI16_S, R_DLX_RELOC_16_HI }, |
439 |
{ BFD_RELOC_DLX_LO16, R_DLX_RELOC_16_LO }, |
{ BFD_RELOC_DLX_LO16, R_DLX_RELOC_16_LO }, |
446 |
Since we don't do .gots or .plts, we just need to consider the |
Since we don't do .gots or .plts, we just need to consider the |
447 |
virtual table relocs for gc. */ |
virtual table relocs for gc. */ |
448 |
|
|
449 |
static boolean |
static bfd_boolean |
450 |
elf32_dlx_check_relocs (abfd, info, sec, relocs) |
elf32_dlx_check_relocs (abfd, info, sec, relocs) |
451 |
bfd *abfd; |
bfd *abfd; |
452 |
struct bfd_link_info *info; |
struct bfd_link_info *info; |
458 |
const Elf_Internal_Rela *rel; |
const Elf_Internal_Rela *rel; |
459 |
const Elf_Internal_Rela *rel_end; |
const Elf_Internal_Rela *rel_end; |
460 |
|
|
461 |
if (info->relocateable) |
if (info->relocatable) |
462 |
return true; |
return TRUE; |
463 |
|
|
464 |
symtab_hdr = &elf_tdata (abfd)->symtab_hdr; |
symtab_hdr = &elf_tdata (abfd)->symtab_hdr; |
465 |
sym_hashes = elf_sym_hashes (abfd); |
sym_hashes = elf_sym_hashes (abfd); |
484 |
/* This relocation describes the C++ object vtable hierarchy. |
/* This relocation describes the C++ object vtable hierarchy. |
485 |
Reconstruct it for later use during GC. */ |
Reconstruct it for later use during GC. */ |
486 |
case R_DLX_GNU_VTINHERIT: |
case R_DLX_GNU_VTINHERIT: |
487 |
if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) |
if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) |
488 |
return false; |
return FALSE; |
489 |
break; |
break; |
490 |
|
|
491 |
/* This relocation describes which C++ vtable entries are actually |
/* This relocation describes which C++ vtable entries are actually |
492 |
used. Record for later use during GC. */ |
used. Record for later use during GC. */ |
493 |
case R_DLX_GNU_VTENTRY: |
case R_DLX_GNU_VTENTRY: |
494 |
if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) |
if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) |
495 |
return false; |
return FALSE; |
496 |
break; |
break; |
497 |
} |
} |
498 |
} |
} |
499 |
|
|
500 |
return true; |
return TRUE; |
501 |
} |
} |
502 |
|
|
503 |
/* Given a BFD reloc type, return a howto structure. */ |
/* Given a BFD reloc type, return a howto structure. */ |
559 |
elf32_dlx_info_to_howto (abfd, cache_ptr, dst) |
elf32_dlx_info_to_howto (abfd, cache_ptr, dst) |
560 |
bfd * abfd ATTRIBUTE_UNUSED; |
bfd * abfd ATTRIBUTE_UNUSED; |
561 |
arelent * cache_ptr ATTRIBUTE_UNUSED; |
arelent * cache_ptr ATTRIBUTE_UNUSED; |
562 |
Elf32_Internal_Rela * dst ATTRIBUTE_UNUSED; |
Elf_Internal_Rela * dst ATTRIBUTE_UNUSED; |
563 |
{ |
{ |
564 |
abort (); |
abort (); |
565 |
} |
} |
568 |
elf32_dlx_info_to_howto_rel (abfd, cache_ptr, dst) |
elf32_dlx_info_to_howto_rel (abfd, cache_ptr, dst) |
569 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
570 |
arelent *cache_ptr; |
arelent *cache_ptr; |
571 |
Elf32_Internal_Rel *dst; |
Elf_Internal_Rela *dst; |
572 |
{ |
{ |
573 |
unsigned int r_type; |
unsigned int r_type; |
574 |
|
|