2004-11-03 Randolph Chung <tausq@debian.org>
[deliverable/binutils-gdb.git] / bfd / elfarm-nabi.c
CommitLineData
252b5132 1/* 32-bit ELF support for ARM new abi option.
acf8aed4 2 Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
252b5132
RH
3
4 This file is part of BFD, the Binary File Descriptor library.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20#include "elf/arm.h"
21#include "bfd.h"
22#include "sysdep.h"
23#include "libbfd.h"
24#include "elf-bfd.h"
25
26#ifndef NUM_ELEM
27#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
28#endif
29
acf8aed4 30#define USE_REL 1
252b5132 31
252b5132 32#define elf_info_to_howto 0
ba96a88f 33#define elf_info_to_howto_rel elf32_arm_info_to_howto
252b5132 34
ba96a88f
NC
35#define ARM_ELF_ABI_VERSION 0
36#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM
252b5132
RH
37
38static reloc_howto_type * elf32_arm_reloc_type_lookup
39 PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
b34976b6 40static bfd_boolean elf32_arm_nabi_grok_prstatus
2e67030c 41 PARAMS ((bfd *abfd, Elf_Internal_Note *note));
b34976b6 42static bfd_boolean elf32_arm_nabi_grok_psinfo
2e67030c 43 PARAMS ((bfd *abfd, Elf_Internal_Note *note));
252b5132 44
dfc5f959 45/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
3e932841
KH
46 R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
47 in that slot. */
dfc5f959 48
252b5132
RH
49static reloc_howto_type elf32_arm_howto_table[] =
50{
51 /* No relocation */
52 HOWTO (R_ARM_NONE, /* type */
53 0, /* rightshift */
54 0, /* size (0 = byte, 1 = short, 2 = long) */
55 0, /* bitsize */
b34976b6 56 FALSE, /* pc_relative */
252b5132
RH
57 0, /* bitpos */
58 complain_overflow_dont,/* complain_on_overflow */
59 bfd_elf_generic_reloc, /* special_function */
60 "R_ARM_NONE", /* name */
b34976b6 61 FALSE, /* partial_inplace */
252b5132
RH
62 0, /* src_mask */
63 0, /* dst_mask */
b34976b6 64 FALSE), /* pcrel_offset */
252b5132
RH
65
66 HOWTO (R_ARM_PC24, /* type */
67 2, /* rightshift */
68 2, /* size (0 = byte, 1 = short, 2 = long) */
69 24, /* bitsize */
b34976b6 70 TRUE, /* pc_relative */
252b5132
RH
71 0, /* bitpos */
72 complain_overflow_signed,/* complain_on_overflow */
73 bfd_elf_generic_reloc, /* special_function */
74 "R_ARM_PC24", /* name */
b34976b6 75 FALSE, /* partial_inplace */
252b5132
RH
76 0x00ffffff, /* src_mask */
77 0x00ffffff, /* dst_mask */
b34976b6 78 TRUE), /* pcrel_offset */
252b5132
RH
79
80 /* 32 bit absolute */
81 HOWTO (R_ARM_ABS32, /* type */
82 0, /* rightshift */
83 2, /* size (0 = byte, 1 = short, 2 = long) */
84 32, /* bitsize */
b34976b6 85 FALSE, /* pc_relative */
252b5132
RH
86 0, /* bitpos */
87 complain_overflow_bitfield,/* complain_on_overflow */
88 bfd_elf_generic_reloc, /* special_function */
89 "R_ARM_ABS32", /* name */
b34976b6 90 FALSE, /* partial_inplace */
252b5132
RH
91 0xffffffff, /* src_mask */
92 0xffffffff, /* dst_mask */
b34976b6 93 FALSE), /* pcrel_offset */
252b5132
RH
94
95 /* standard 32bit pc-relative reloc */
96 HOWTO (R_ARM_REL32, /* type */
97 0, /* rightshift */
98 2, /* size (0 = byte, 1 = short, 2 = long) */
99 32, /* bitsize */
b34976b6 100 TRUE, /* pc_relative */
252b5132
RH
101 0, /* bitpos */
102 complain_overflow_bitfield,/* complain_on_overflow */
103 bfd_elf_generic_reloc, /* special_function */
104 "R_ARM_REL32", /* name */
b34976b6 105 FALSE, /* partial_inplace */
252b5132
RH
106 0xffffffff, /* src_mask */
107 0xffffffff, /* dst_mask */
b34976b6 108 TRUE), /* pcrel_offset */
252b5132
RH
109
110 /* 8 bit absolute */
111 HOWTO (R_ARM_PC13, /* type */
112 0, /* rightshift */
113 0, /* size (0 = byte, 1 = short, 2 = long) */
114 8, /* bitsize */
b34976b6 115 FALSE, /* pc_relative */
252b5132
RH
116 0, /* bitpos */
117 complain_overflow_bitfield,/* complain_on_overflow */
118 bfd_elf_generic_reloc, /* special_function */
119 "R_ARM_PC13", /* name */
b34976b6 120 FALSE, /* partial_inplace */
252b5132
RH
121 0x000000ff, /* src_mask */
122 0x000000ff, /* dst_mask */
b34976b6 123 FALSE), /* pcrel_offset */
252b5132
RH
124
125 /* 16 bit absolute */
126 HOWTO (R_ARM_ABS16, /* type */
127 0, /* rightshift */
128 1, /* size (0 = byte, 1 = short, 2 = long) */
129 16, /* bitsize */
b34976b6 130 FALSE, /* pc_relative */
252b5132
RH
131 0, /* bitpos */
132 complain_overflow_bitfield,/* complain_on_overflow */
133 bfd_elf_generic_reloc, /* special_function */
134 "R_ARM_ABS16", /* name */
b34976b6 135 FALSE, /* partial_inplace */
8d0da3c2
DD
136 0x0000ffff, /* src_mask */
137 0x0000ffff, /* dst_mask */
b34976b6 138 FALSE), /* pcrel_offset */
252b5132
RH
139
140 /* 12 bit absolute */
141 HOWTO (R_ARM_ABS12, /* type */
142 0, /* rightshift */
143 2, /* size (0 = byte, 1 = short, 2 = long) */
144 12, /* bitsize */
b34976b6 145 FALSE, /* pc_relative */
252b5132
RH
146 0, /* bitpos */
147 complain_overflow_bitfield,/* complain_on_overflow */
148 bfd_elf_generic_reloc, /* special_function */
149 "R_ARM_ABS12", /* name */
b34976b6 150 FALSE, /* partial_inplace */
252b5132
RH
151 0x000008ff, /* src_mask */
152 0x000008ff, /* dst_mask */
b34976b6 153 FALSE), /* pcrel_offset */
252b5132
RH
154
155 HOWTO (R_ARM_THM_ABS5, /* type */
156 6, /* rightshift */
157 1, /* size (0 = byte, 1 = short, 2 = long) */
158 5, /* bitsize */
b34976b6 159 FALSE, /* pc_relative */
252b5132
RH
160 0, /* bitpos */
161 complain_overflow_bitfield,/* complain_on_overflow */
162 bfd_elf_generic_reloc, /* special_function */
163 "R_ARM_THM_ABS5", /* name */
b34976b6 164 FALSE, /* partial_inplace */
252b5132
RH
165 0x000007e0, /* src_mask */
166 0x000007e0, /* dst_mask */
b34976b6 167 FALSE), /* pcrel_offset */
252b5132
RH
168
169 /* 8 bit absolute */
170 HOWTO (R_ARM_ABS8, /* type */
171 0, /* rightshift */
172 0, /* size (0 = byte, 1 = short, 2 = long) */
173 8, /* bitsize */
b34976b6 174 FALSE, /* pc_relative */
252b5132
RH
175 0, /* bitpos */
176 complain_overflow_bitfield,/* complain_on_overflow */
177 bfd_elf_generic_reloc, /* special_function */
178 "R_ARM_ABS8", /* name */
b34976b6 179 FALSE, /* partial_inplace */
252b5132
RH
180 0x000000ff, /* src_mask */
181 0x000000ff, /* dst_mask */
b34976b6 182 FALSE), /* pcrel_offset */
252b5132
RH
183
184 HOWTO (R_ARM_SBREL32, /* type */
185 0, /* rightshift */
db6579d4
PB
186 2, /* size (0 = byte, 1 = short, 2 = long) */
187 32, /* bitsize */
b34976b6 188 FALSE, /* pc_relative */
252b5132
RH
189 0, /* bitpos */
190 complain_overflow_dont,/* complain_on_overflow */
191 bfd_elf_generic_reloc, /* special_function */
192 "R_ARM_SBREL32", /* name */
b34976b6 193 FALSE, /* partial_inplace */
db6579d4
PB
194 0xffffffff, /* src_mask */
195 0xffffffff, /* dst_mask */
b34976b6 196 FALSE), /* pcrel_offset */
252b5132
RH
197
198 HOWTO (R_ARM_THM_PC22, /* type */
199 1, /* rightshift */
200 2, /* size (0 = byte, 1 = short, 2 = long) */
201 23, /* bitsize */
b34976b6 202 TRUE, /* pc_relative */
252b5132
RH
203 0, /* bitpos */
204 complain_overflow_signed,/* complain_on_overflow */
205 bfd_elf_generic_reloc, /* special_function */
206 "R_ARM_THM_PC22", /* name */
b34976b6 207 FALSE, /* partial_inplace */
252b5132
RH
208 0x07ff07ff, /* src_mask */
209 0x07ff07ff, /* dst_mask */
b34976b6 210 TRUE), /* pcrel_offset */
252b5132
RH
211
212 HOWTO (R_ARM_THM_PC8, /* type */
213 1, /* rightshift */
214 1, /* size (0 = byte, 1 = short, 2 = long) */
215 8, /* bitsize */
b34976b6 216 TRUE, /* pc_relative */
252b5132
RH
217 0, /* bitpos */
218 complain_overflow_signed,/* complain_on_overflow */
219 bfd_elf_generic_reloc, /* special_function */
220 "R_ARM_THM_PC8", /* name */
b34976b6 221 FALSE, /* partial_inplace */
252b5132
RH
222 0x000000ff, /* src_mask */
223 0x000000ff, /* dst_mask */
b34976b6 224 TRUE), /* pcrel_offset */
252b5132
RH
225
226 HOWTO (R_ARM_AMP_VCALL9, /* type */
227 1, /* rightshift */
228 1, /* size (0 = byte, 1 = short, 2 = long) */
229 8, /* bitsize */
b34976b6 230 TRUE, /* pc_relative */
252b5132
RH
231 0, /* bitpos */
232 complain_overflow_signed,/* complain_on_overflow */
233 bfd_elf_generic_reloc, /* special_function */
234 "R_ARM_AMP_VCALL9", /* name */
b34976b6 235 FALSE, /* partial_inplace */
252b5132
RH
236 0x000000ff, /* src_mask */
237 0x000000ff, /* dst_mask */
b34976b6 238 TRUE), /* pcrel_offset */
252b5132
RH
239
240 HOWTO (R_ARM_SWI24, /* type */
241 0, /* rightshift */
242 0, /* size (0 = byte, 1 = short, 2 = long) */
243 0, /* bitsize */
b34976b6 244 FALSE, /* pc_relative */
252b5132
RH
245 0, /* bitpos */
246 complain_overflow_signed,/* complain_on_overflow */
247 bfd_elf_generic_reloc, /* special_function */
248 "R_ARM_SWI24", /* name */
b34976b6 249 FALSE, /* partial_inplace */
252b5132
RH
250 0x00000000, /* src_mask */
251 0x00000000, /* dst_mask */
b34976b6 252 FALSE), /* pcrel_offset */
252b5132
RH
253
254 HOWTO (R_ARM_THM_SWI8, /* type */
255 0, /* rightshift */
256 0, /* size (0 = byte, 1 = short, 2 = long) */
257 0, /* bitsize */
b34976b6 258 FALSE, /* pc_relative */
252b5132
RH
259 0, /* bitpos */
260 complain_overflow_signed,/* complain_on_overflow */
261 bfd_elf_generic_reloc, /* special_function */
262 "R_ARM_SWI8", /* name */
b34976b6 263 FALSE, /* partial_inplace */
252b5132
RH
264 0x00000000, /* src_mask */
265 0x00000000, /* dst_mask */
b34976b6 266 FALSE), /* pcrel_offset */
252b5132 267
dfc5f959 268 /* BLX instruction for the ARM. */
252b5132 269 HOWTO (R_ARM_XPC25, /* type */
dfc5f959
NC
270 2, /* rightshift */
271 2, /* size (0 = byte, 1 = short, 2 = long) */
272 25, /* bitsize */
b34976b6 273 TRUE, /* pc_relative */
252b5132
RH
274 0, /* bitpos */
275 complain_overflow_signed,/* complain_on_overflow */
276 bfd_elf_generic_reloc, /* special_function */
277 "R_ARM_XPC25", /* name */
b34976b6 278 FALSE, /* partial_inplace */
dfc5f959
NC
279 0x00ffffff, /* src_mask */
280 0x00ffffff, /* dst_mask */
b34976b6 281 TRUE), /* pcrel_offset */
3e932841 282
dfc5f959 283 /* BLX instruction for the Thumb. */
252b5132 284 HOWTO (R_ARM_THM_XPC22, /* type */
dfc5f959
NC
285 2, /* rightshift */
286 2, /* size (0 = byte, 1 = short, 2 = long) */
287 22, /* bitsize */
b34976b6 288 TRUE, /* pc_relative */
252b5132
RH
289 0, /* bitpos */
290 complain_overflow_signed,/* complain_on_overflow */
291 bfd_elf_generic_reloc, /* special_function */
292 "R_ARM_THM_XPC22", /* name */
b34976b6 293 FALSE, /* partial_inplace */
dfc5f959
NC
294 0x07ff07ff, /* src_mask */
295 0x07ff07ff, /* dst_mask */
b34976b6 296 TRUE), /* pcrel_offset */
3e932841 297
252b5132
RH
298 /* These next three relocs are not defined, but we need to fill the space. */
299
300 HOWTO (R_ARM_NONE, /* type */
301 0, /* rightshift */
302 0, /* size (0 = byte, 1 = short, 2 = long) */
303 0, /* bitsize */
b34976b6 304 FALSE, /* pc_relative */
252b5132
RH
305 0, /* bitpos */
306 complain_overflow_dont,/* complain_on_overflow */
307 bfd_elf_generic_reloc, /* special_function */
308 "R_ARM_unknown_17", /* name */
b34976b6 309 FALSE, /* partial_inplace */
252b5132
RH
310 0, /* src_mask */
311 0, /* dst_mask */
b34976b6 312 FALSE), /* pcrel_offset */
252b5132
RH
313
314 HOWTO (R_ARM_NONE, /* type */
315 0, /* rightshift */
316 0, /* size (0 = byte, 1 = short, 2 = long) */
317 0, /* bitsize */
b34976b6 318 FALSE, /* pc_relative */
252b5132
RH
319 0, /* bitpos */
320 complain_overflow_dont,/* complain_on_overflow */
321 bfd_elf_generic_reloc, /* special_function */
322 "R_ARM_unknown_18", /* name */
b34976b6 323 FALSE, /* partial_inplace */
252b5132
RH
324 0, /* src_mask */
325 0, /* dst_mask */
b34976b6 326 FALSE), /* pcrel_offset */
252b5132
RH
327
328 HOWTO (R_ARM_NONE, /* type */
329 0, /* rightshift */
330 0, /* size (0 = byte, 1 = short, 2 = long) */
331 0, /* bitsize */
b34976b6 332 FALSE, /* pc_relative */
252b5132
RH
333 0, /* bitpos */
334 complain_overflow_dont,/* complain_on_overflow */
335 bfd_elf_generic_reloc, /* special_function */
336 "R_ARM_unknown_19", /* name */
b34976b6 337 FALSE, /* partial_inplace */
252b5132
RH
338 0, /* src_mask */
339 0, /* dst_mask */
b34976b6 340 FALSE), /* pcrel_offset */
252b5132
RH
341
342 /* Relocs used in ARM Linux */
3e932841 343
252b5132
RH
344 HOWTO (R_ARM_COPY, /* type */
345 0, /* rightshift */
346 2, /* size (0 = byte, 1 = short, 2 = long) */
347 32, /* bitsize */
b34976b6 348 FALSE, /* pc_relative */
252b5132
RH
349 0, /* bitpos */
350 complain_overflow_bitfield,/* complain_on_overflow */
351 bfd_elf_generic_reloc, /* special_function */
352 "R_ARM_COPY", /* name */
b34976b6 353 TRUE, /* partial_inplace */
252b5132
RH
354 0xffffffff, /* src_mask */
355 0xffffffff, /* dst_mask */
b34976b6 356 FALSE), /* pcrel_offset */
252b5132
RH
357
358 HOWTO (R_ARM_GLOB_DAT, /* type */
359 0, /* rightshift */
360 2, /* size (0 = byte, 1 = short, 2 = long) */
361 32, /* bitsize */
b34976b6 362 FALSE, /* pc_relative */
252b5132
RH
363 0, /* bitpos */
364 complain_overflow_bitfield,/* complain_on_overflow */
365 bfd_elf_generic_reloc, /* special_function */
366 "R_ARM_GLOB_DAT", /* name */
b34976b6 367 TRUE, /* partial_inplace */
252b5132
RH
368 0xffffffff, /* src_mask */
369 0xffffffff, /* dst_mask */
b34976b6 370 FALSE), /* pcrel_offset */
3e932841 371
252b5132
RH
372 HOWTO (R_ARM_JUMP_SLOT, /* type */
373 0, /* rightshift */
374 2, /* size (0 = byte, 1 = short, 2 = long) */
375 32, /* bitsize */
b34976b6 376 FALSE, /* pc_relative */
252b5132
RH
377 0, /* bitpos */
378 complain_overflow_bitfield,/* complain_on_overflow */
379 bfd_elf_generic_reloc, /* special_function */
380 "R_ARM_JUMP_SLOT", /* name */
b34976b6 381 TRUE, /* partial_inplace */
252b5132
RH
382 0xffffffff, /* src_mask */
383 0xffffffff, /* dst_mask */
b34976b6 384 FALSE), /* pcrel_offset */
3e932841 385
252b5132
RH
386 HOWTO (R_ARM_RELATIVE, /* type */
387 0, /* rightshift */
388 2, /* size (0 = byte, 1 = short, 2 = long) */
389 32, /* bitsize */
b34976b6 390 FALSE, /* pc_relative */
252b5132
RH
391 0, /* bitpos */
392 complain_overflow_bitfield,/* complain_on_overflow */
393 bfd_elf_generic_reloc, /* special_function */
394 "R_ARM_RELATIVE", /* name */
b34976b6 395 TRUE, /* partial_inplace */
252b5132
RH
396 0xffffffff, /* src_mask */
397 0xffffffff, /* dst_mask */
b34976b6 398 FALSE), /* pcrel_offset */
3e932841 399
252b5132
RH
400 HOWTO (R_ARM_GOTOFF, /* type */
401 0, /* rightshift */
402 2, /* size (0 = byte, 1 = short, 2 = long) */
403 32, /* bitsize */
b34976b6 404 FALSE, /* pc_relative */
252b5132
RH
405 0, /* bitpos */
406 complain_overflow_bitfield,/* complain_on_overflow */
407 bfd_elf_generic_reloc, /* special_function */
408 "R_ARM_GOTOFF", /* name */
b34976b6 409 TRUE, /* partial_inplace */
252b5132
RH
410 0xffffffff, /* src_mask */
411 0xffffffff, /* dst_mask */
b34976b6 412 FALSE), /* pcrel_offset */
3e932841 413
252b5132
RH
414 HOWTO (R_ARM_GOTPC, /* type */
415 0, /* rightshift */
416 2, /* size (0 = byte, 1 = short, 2 = long) */
417 32, /* bitsize */
b34976b6 418 TRUE, /* pc_relative */
252b5132
RH
419 0, /* bitpos */
420 complain_overflow_bitfield,/* complain_on_overflow */
421 bfd_elf_generic_reloc, /* special_function */
422 "R_ARM_GOTPC", /* name */
b34976b6 423 TRUE, /* partial_inplace */
252b5132
RH
424 0xffffffff, /* src_mask */
425 0xffffffff, /* dst_mask */
b34976b6 426 TRUE), /* pcrel_offset */
3e932841 427
252b5132
RH
428 HOWTO (R_ARM_GOT32, /* type */
429 0, /* rightshift */
430 2, /* size (0 = byte, 1 = short, 2 = long) */
431 32, /* bitsize */
b34976b6 432 FALSE, /* pc_relative */
252b5132
RH
433 0, /* bitpos */
434 complain_overflow_bitfield,/* complain_on_overflow */
435 bfd_elf_generic_reloc, /* special_function */
436 "R_ARM_GOT32", /* name */
b34976b6 437 TRUE, /* partial_inplace */
252b5132
RH
438 0xffffffff, /* src_mask */
439 0xffffffff, /* dst_mask */
b34976b6 440 FALSE), /* pcrel_offset */
3e932841 441
252b5132
RH
442 HOWTO (R_ARM_PLT32, /* type */
443 2, /* rightshift */
444 2, /* size (0 = byte, 1 = short, 2 = long) */
445 26, /* bitsize */
b34976b6 446 TRUE, /* pc_relative */
252b5132
RH
447 0, /* bitpos */
448 complain_overflow_bitfield,/* complain_on_overflow */
449 bfd_elf_generic_reloc, /* special_function */
450 "R_ARM_PLT32", /* name */
b34976b6 451 TRUE, /* partial_inplace */
252b5132
RH
452 0x00ffffff, /* src_mask */
453 0x00ffffff, /* dst_mask */
b34976b6 454 TRUE), /* pcrel_offset */
3e932841 455
5b5bb741
PB
456 HOWTO (R_ARM_CALL, /* type */
457 2, /* rightshift */
458 2, /* size (0 = byte, 1 = short, 2 = long) */
459 24, /* bitsize */
460 TRUE, /* pc_relative */
252b5132 461 0, /* bitpos */
5b5bb741 462 complain_overflow_signed,/* complain_on_overflow */
252b5132 463 bfd_elf_generic_reloc, /* special_function */
5b5bb741 464 "R_ARM_CALL", /* name */
b34976b6 465 FALSE, /* partial_inplace */
5b5bb741
PB
466 0x00ffffff, /* src_mask */
467 0x00ffffff, /* dst_mask */
468 TRUE), /* pcrel_offset */
252b5132 469
5b5bb741
PB
470 HOWTO (R_ARM_JUMP24, /* type */
471 2, /* rightshift */
472 2, /* size (0 = byte, 1 = short, 2 = long) */
473 24, /* bitsize */
474 TRUE, /* pc_relative */
252b5132 475 0, /* bitpos */
5b5bb741 476 complain_overflow_signed,/* complain_on_overflow */
252b5132 477 bfd_elf_generic_reloc, /* special_function */
5b5bb741 478 "R_ARM_JUMP24", /* name */
b34976b6 479 FALSE, /* partial_inplace */
5b5bb741
PB
480 0x00ffffff, /* src_mask */
481 0x00ffffff, /* dst_mask */
482 TRUE), /* pcrel_offset */
252b5132 483
5b5bb741 484 HOWTO (R_ARM_NONE, /* type */
252b5132
RH
485 0, /* rightshift */
486 0, /* size (0 = byte, 1 = short, 2 = long) */
487 0, /* bitsize */
b34976b6 488 FALSE, /* pc_relative */
252b5132
RH
489 0, /* bitpos */
490 complain_overflow_dont,/* complain_on_overflow */
491 bfd_elf_generic_reloc, /* special_function */
5b5bb741 492 "R_ARM_unknown_30", /* name */
b34976b6 493 FALSE, /* partial_inplace */
252b5132
RH
494 0, /* src_mask */
495 0, /* dst_mask */
b34976b6 496 FALSE), /* pcrel_offset */
252b5132 497
5b5bb741 498 HOWTO (R_ARM_NONE, /* type */
252b5132
RH
499 0, /* rightshift */
500 0, /* size (0 = byte, 1 = short, 2 = long) */
501 0, /* bitsize */
b34976b6 502 FALSE, /* pc_relative */
252b5132
RH
503 0, /* bitpos */
504 complain_overflow_dont,/* complain_on_overflow */
505 bfd_elf_generic_reloc, /* special_function */
5b5bb741 506 "R_ARM_unknown_31", /* name */
b34976b6 507 FALSE, /* partial_inplace */
252b5132
RH
508 0, /* src_mask */
509 0, /* dst_mask */
b34976b6 510 FALSE), /* pcrel_offset */
252b5132 511
8375c36b
PB
512 HOWTO (R_ARM_ALU_PCREL7_0, /* type */
513 0, /* rightshift */
514 2, /* size (0 = byte, 1 = short, 2 = long) */
515 12, /* bitsize */
516 TRUE, /* pc_relative */
517 0, /* bitpos */
518 complain_overflow_dont,/* complain_on_overflow */
519 bfd_elf_generic_reloc, /* special_function */
520 "R_ARM_ALU_PCREL_7_0", /* name */
521 FALSE, /* partial_inplace */
522 0x00000fff, /* src_mask */
523 0x00000fff, /* dst_mask */
524 TRUE), /* pcrel_offset */
525
526 HOWTO (R_ARM_ALU_PCREL15_8, /* type */
527 0, /* rightshift */
528 2, /* size (0 = byte, 1 = short, 2 = long) */
529 12, /* bitsize */
530 TRUE, /* pc_relative */
531 8, /* bitpos */
532 complain_overflow_dont,/* complain_on_overflow */
533 bfd_elf_generic_reloc, /* special_function */
534 "R_ARM_ALU_PCREL_15_8",/* name */
535 FALSE, /* partial_inplace */
536 0x00000fff, /* src_mask */
537 0x00000fff, /* dst_mask */
538 TRUE), /* pcrel_offset */
539
540 HOWTO (R_ARM_ALU_PCREL23_15, /* type */
541 0, /* rightshift */
542 2, /* size (0 = byte, 1 = short, 2 = long) */
543 12, /* bitsize */
544 TRUE, /* pc_relative */
545 16, /* bitpos */
546 complain_overflow_dont,/* complain_on_overflow */
547 bfd_elf_generic_reloc, /* special_function */
548 "R_ARM_ALU_PCREL_23_15",/* name */
549 FALSE, /* partial_inplace */
550 0x00000fff, /* src_mask */
551 0x00000fff, /* dst_mask */
552 TRUE), /* pcrel_offset */
db6579d4
PB
553
554 HOWTO (R_ARM_LDR_SBREL_11_0, /* type */
555 0, /* rightshift */
556 2, /* size (0 = byte, 1 = short, 2 = long) */
557 12, /* bitsize */
558 FALSE, /* pc_relative */
559 0, /* bitpos */
560 complain_overflow_dont,/* complain_on_overflow */
561 bfd_elf_generic_reloc, /* special_function */
562 "R_ARM_LDR_SBREL_11_0",/* name */
563 FALSE, /* partial_inplace */
564 0x00000fff, /* src_mask */
565 0x00000fff, /* dst_mask */
566 FALSE), /* pcrel_offset */
567
568 HOWTO (R_ARM_ALU_SBREL_19_12, /* type */
569 0, /* rightshift */
570 2, /* size (0 = byte, 1 = short, 2 = long) */
571 8, /* bitsize */
572 FALSE, /* pc_relative */
573 12, /* bitpos */
574 complain_overflow_dont,/* complain_on_overflow */
575 bfd_elf_generic_reloc, /* special_function */
576 "R_ARM_ALU_SBREL_19_12",/* name */
577 FALSE, /* partial_inplace */
578 0x000ff000, /* src_mask */
579 0x000ff000, /* dst_mask */
580 FALSE), /* pcrel_offset */
581
582 HOWTO (R_ARM_ALU_SBREL_27_20, /* type */
583 0, /* rightshift */
584 2, /* size (0 = byte, 1 = short, 2 = long) */
585 8, /* bitsize */
586 FALSE, /* pc_relative */
587 20, /* bitpos */
588 complain_overflow_dont,/* complain_on_overflow */
589 bfd_elf_generic_reloc, /* special_function */
590 "R_ARM_ALU_SBREL_27_20",/* name */
591 FALSE, /* partial_inplace */
592 0x0ff00000, /* src_mask */
593 0x0ff00000, /* dst_mask */
594 FALSE), /* pcrel_offset */
595
9c504268 596 HOWTO (R_ARM_TARGET1, /* type */
db6579d4
PB
597 0, /* rightshift */
598 2, /* size (0 = byte, 1 = short, 2 = long) */
599 32, /* bitsize */
600 FALSE, /* pc_relative */
601 0, /* bitpos */
602 complain_overflow_dont,/* complain_on_overflow */
603 bfd_elf_generic_reloc, /* special_function */
9c504268 604 "R_ARM_TARGET1", /* name */
db6579d4
PB
605 FALSE, /* partial_inplace */
606 0xffffffff, /* src_mask */
607 0xffffffff, /* dst_mask */
608 FALSE), /* pcrel_offset */
609
610 HOWTO (R_ARM_ROSEGREL32, /* type */
611 0, /* rightshift */
612 2, /* size (0 = byte, 1 = short, 2 = long) */
613 32, /* bitsize */
614 FALSE, /* pc_relative */
615 0, /* bitpos */
616 complain_overflow_dont,/* complain_on_overflow */
617 bfd_elf_generic_reloc, /* special_function */
618 "R_ARM_ROSEGREL32", /* name */
619 FALSE, /* partial_inplace */
620 0xffffffff, /* src_mask */
621 0xffffffff, /* dst_mask */
622 FALSE), /* pcrel_offset */
623
624 HOWTO (R_ARM_V4BX, /* type */
625 0, /* rightshift */
626 2, /* size (0 = byte, 1 = short, 2 = long) */
627 32, /* bitsize */
628 FALSE, /* pc_relative */
629 0, /* bitpos */
630 complain_overflow_dont,/* complain_on_overflow */
631 bfd_elf_generic_reloc, /* special_function */
632 "R_ARM_V4BX", /* name */
633 FALSE, /* partial_inplace */
634 0xffffffff, /* src_mask */
635 0xffffffff, /* dst_mask */
636 FALSE), /* pcrel_offset */
eb043451
PB
637
638 HOWTO (R_ARM_TARGET2, /* type */
639 0, /* rightshift */
640 2, /* size (0 = byte, 1 = short, 2 = long) */
641 32, /* bitsize */
642 FALSE, /* pc_relative */
643 0, /* bitpos */
644 complain_overflow_signed,/* complain_on_overflow */
645 bfd_elf_generic_reloc, /* special_function */
646 "R_ARM_TARGET2", /* name */
647 FALSE, /* partial_inplace */
648 0xffffffff, /* src_mask */
649 0xffffffff, /* dst_mask */
650 TRUE), /* pcrel_offset */
651
652 HOWTO (R_ARM_PREL31, /* type */
653 0, /* rightshift */
654 2, /* size (0 = byte, 1 = short, 2 = long) */
655 31, /* bitsize */
656 TRUE, /* pc_relative */
657 0, /* bitpos */
658 complain_overflow_signed,/* complain_on_overflow */
659 bfd_elf_generic_reloc, /* special_function */
660 "R_ARM_PREL31", /* name */
661 FALSE, /* partial_inplace */
662 0x7fffffff, /* src_mask */
663 0x7fffffff, /* dst_mask */
664 TRUE), /* pcrel_offset */
252b5132
RH
665};
666
667 /* GNU extension to record C++ vtable hierarchy */
668static reloc_howto_type elf32_arm_vtinherit_howto =
669 HOWTO (R_ARM_GNU_VTINHERIT, /* type */
670 0, /* rightshift */
671 2, /* size (0 = byte, 1 = short, 2 = long) */
672 0, /* bitsize */
b34976b6 673 FALSE, /* pc_relative */
252b5132
RH
674 0, /* bitpos */
675 complain_overflow_dont, /* complain_on_overflow */
676 NULL, /* special_function */
677 "R_ARM_GNU_VTINHERIT", /* name */
b34976b6 678 FALSE, /* partial_inplace */
252b5132
RH
679 0, /* src_mask */
680 0, /* dst_mask */
b34976b6 681 FALSE); /* pcrel_offset */
252b5132
RH
682
683 /* GNU extension to record C++ vtable member usage */
684static reloc_howto_type elf32_arm_vtentry_howto =
685 HOWTO (R_ARM_GNU_VTENTRY, /* type */
686 0, /* rightshift */
687 2, /* size (0 = byte, 1 = short, 2 = long) */
688 0, /* bitsize */
b34976b6 689 FALSE, /* pc_relative */
252b5132
RH
690 0, /* bitpos */
691 complain_overflow_dont, /* complain_on_overflow */
692 _bfd_elf_rel_vtable_reloc_fn, /* special_function */
693 "R_ARM_GNU_VTENTRY", /* name */
b34976b6 694 FALSE, /* partial_inplace */
252b5132
RH
695 0, /* src_mask */
696 0, /* dst_mask */
b34976b6 697 FALSE); /* pcrel_offset */
252b5132
RH
698
699 /* 12 bit pc relative */
700static reloc_howto_type elf32_arm_thm_pc11_howto =
701 HOWTO (R_ARM_THM_PC11, /* type */
702 1, /* rightshift */
703 1, /* size (0 = byte, 1 = short, 2 = long) */
704 11, /* bitsize */
b34976b6 705 TRUE, /* pc_relative */
252b5132
RH
706 0, /* bitpos */
707 complain_overflow_signed, /* complain_on_overflow */
708 bfd_elf_generic_reloc, /* special_function */
709 "R_ARM_THM_PC11", /* name */
b34976b6 710 FALSE, /* partial_inplace */
252b5132
RH
711 0x000007ff, /* src_mask */
712 0x000007ff, /* dst_mask */
b34976b6 713 TRUE); /* pcrel_offset */
252b5132
RH
714
715 /* 12 bit pc relative */
716static reloc_howto_type elf32_arm_thm_pc9_howto =
717 HOWTO (R_ARM_THM_PC9, /* type */
718 1, /* rightshift */
719 1, /* size (0 = byte, 1 = short, 2 = long) */
720 8, /* bitsize */
b34976b6 721 TRUE, /* pc_relative */
252b5132
RH
722 0, /* bitpos */
723 complain_overflow_signed, /* complain_on_overflow */
724 bfd_elf_generic_reloc, /* special_function */
725 "R_ARM_THM_PC9", /* name */
b34976b6 726 FALSE, /* partial_inplace */
252b5132
RH
727 0x000000ff, /* src_mask */
728 0x000000ff, /* dst_mask */
b34976b6 729 TRUE); /* pcrel_offset */
252b5132 730
eb043451
PB
731/* Place relative GOT-indirect. */
732static reloc_howto_type elf32_arm_got_prel =
733 HOWTO (R_ARM_GOT_PREL, /* type */
734 0, /* rightshift */
735 2, /* size (0 = byte, 1 = short, 2 = long) */
736 32, /* bitsize */
737 TRUE, /* pc_relative */
738 0, /* bitpos */
739 complain_overflow_dont, /* complain_on_overflow */
740 bfd_elf_generic_reloc, /* special_function */
741 "R_ARM_GOT_PREL", /* name */
742 FALSE, /* partial_inplace */
743 0xffffffff, /* src_mask */
744 0xffffffff, /* dst_mask */
745 TRUE); /* pcrel_offset */
917583ad 746
5b5bb741
PB
747/* Currently unused relocations. */
748static reloc_howto_type elf32_arm_r_howto[4] =
749{
750 HOWTO (R_ARM_RREL32, /* type */
751 0, /* rightshift */
752 0, /* size (0 = byte, 1 = short, 2 = long) */
753 0, /* bitsize */
754 FALSE, /* pc_relative */
755 0, /* bitpos */
756 complain_overflow_dont,/* complain_on_overflow */
757 bfd_elf_generic_reloc, /* special_function */
758 "R_ARM_RREL32", /* name */
759 FALSE, /* partial_inplace */
760 0, /* src_mask */
761 0, /* dst_mask */
762 FALSE), /* pcrel_offset */
763
764 HOWTO (R_ARM_RABS32, /* type */
765 0, /* rightshift */
766 0, /* size (0 = byte, 1 = short, 2 = long) */
767 0, /* bitsize */
768 FALSE, /* pc_relative */
769 0, /* bitpos */
770 complain_overflow_dont,/* complain_on_overflow */
771 bfd_elf_generic_reloc, /* special_function */
772 "R_ARM_RABS32", /* name */
773 FALSE, /* partial_inplace */
774 0, /* src_mask */
775 0, /* dst_mask */
776 FALSE), /* pcrel_offset */
777
778 HOWTO (R_ARM_RPC24, /* type */
779 0, /* rightshift */
780 0, /* size (0 = byte, 1 = short, 2 = long) */
781 0, /* bitsize */
782 FALSE, /* pc_relative */
783 0, /* bitpos */
784 complain_overflow_dont,/* complain_on_overflow */
785 bfd_elf_generic_reloc, /* special_function */
786 "R_ARM_RPC24", /* name */
787 FALSE, /* partial_inplace */
788 0, /* src_mask */
789 0, /* dst_mask */
790 FALSE), /* pcrel_offset */
791
792 HOWTO (R_ARM_RBASE, /* type */
793 0, /* rightshift */
794 0, /* size (0 = byte, 1 = short, 2 = long) */
795 0, /* bitsize */
796 FALSE, /* pc_relative */
797 0, /* bitpos */
798 complain_overflow_dont,/* complain_on_overflow */
799 bfd_elf_generic_reloc, /* special_function */
800 "R_ARM_RBASE", /* name */
801 FALSE, /* partial_inplace */
802 0, /* src_mask */
803 0, /* dst_mask */
804 FALSE) /* pcrel_offset */
805};
806
eb043451
PB
807static reloc_howto_type *
808elf32_arm_howto_from_type (unsigned int r_type)
252b5132 809{
eb043451
PB
810 if (r_type < NUM_ELEM (elf32_arm_howto_table))
811 return &elf32_arm_howto_table[r_type];
812
252b5132
RH
813 switch (r_type)
814 {
eb043451
PB
815 case R_ARM_GOT_PREL:
816 return &elf32_arm_got_prel;
817
252b5132 818 case R_ARM_GNU_VTINHERIT:
eb043451 819 return &elf32_arm_vtinherit_howto;
3e932841 820
252b5132 821 case R_ARM_GNU_VTENTRY:
eb043451 822 return &elf32_arm_vtentry_howto;
3e932841 823
252b5132 824 case R_ARM_THM_PC11:
eb043451 825 return &elf32_arm_thm_pc11_howto;
3e932841 826
252b5132 827 case R_ARM_THM_PC9:
eb043451 828 return &elf32_arm_thm_pc9_howto;
3e932841 829
5b5bb741
PB
830 case R_ARM_RREL32:
831 case R_ARM_RABS32:
832 case R_ARM_RPC24:
833 case R_ARM_RBASE:
834 return &elf32_arm_r_howto[r_type - R_ARM_RREL32];
835
252b5132 836 default:
eb043451 837 return NULL;
252b5132
RH
838 }
839}
3e932841 840
eb043451
PB
841static void
842elf32_arm_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED, arelent * bfd_reloc,
843 Elf_Internal_Rela * elf_reloc)
844{
845 unsigned int r_type;
846
847 r_type = ELF32_R_TYPE (elf_reloc->r_info);
848 bfd_reloc->howto = elf32_arm_howto_from_type (r_type);
849}
850
252b5132
RH
851struct elf32_arm_reloc_map
852 {
853 bfd_reloc_code_real_type bfd_reloc_val;
854 unsigned char elf_reloc_val;
855 };
856
eb043451 857/* All entries in this list must also be present in elf32_arm_howto_table. */
252b5132 858static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
917583ad
NC
859 {
860 {BFD_RELOC_NONE, R_ARM_NONE},
861 {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24},
862 {BFD_RELOC_ARM_PCREL_BLX, R_ARM_XPC25},
863 {BFD_RELOC_THUMB_PCREL_BLX, R_ARM_THM_XPC22},
864 {BFD_RELOC_32, R_ARM_ABS32},
865 {BFD_RELOC_32_PCREL, R_ARM_REL32},
866 {BFD_RELOC_8, R_ARM_ABS8},
867 {BFD_RELOC_16, R_ARM_ABS16},
868 {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12},
869 {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5},
870 {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22},
871 {BFD_RELOC_ARM_COPY, R_ARM_COPY},
872 {BFD_RELOC_ARM_GLOB_DAT, R_ARM_GLOB_DAT},
873 {BFD_RELOC_ARM_JUMP_SLOT, R_ARM_JUMP_SLOT},
874 {BFD_RELOC_ARM_RELATIVE, R_ARM_RELATIVE},
875 {BFD_RELOC_ARM_GOTOFF, R_ARM_GOTOFF},
876 {BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC},
877 {BFD_RELOC_ARM_GOT32, R_ARM_GOT32},
db6579d4 878 {BFD_RELOC_ARM_PLT32, R_ARM_PLT32},
9c504268 879 {BFD_RELOC_ARM_TARGET1, R_ARM_TARGET1},
db6579d4 880 {BFD_RELOC_ARM_ROSEGREL32, R_ARM_ROSEGREL32},
eb043451
PB
881 {BFD_RELOC_ARM_SBREL32, R_ARM_SBREL32},
882 {BFD_RELOC_ARM_PREL31, R_ARM_PREL31},
883 {BFD_RELOC_ARM_TARGET2, R_ARM_TARGET2}
917583ad 884 };
252b5132
RH
885
886static reloc_howto_type *
887elf32_arm_reloc_type_lookup (abfd, code)
5f771d47 888 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
889 bfd_reloc_code_real_type code;
890{
891 unsigned int i;
892
893 switch (code)
894 {
895 case BFD_RELOC_VTABLE_INHERIT:
896 return & elf32_arm_vtinherit_howto;
897
898 case BFD_RELOC_VTABLE_ENTRY:
899 return & elf32_arm_vtentry_howto;
900
901 case BFD_RELOC_THUMB_PCREL_BRANCH12:
902 return & elf32_arm_thm_pc11_howto;
903
904 case BFD_RELOC_THUMB_PCREL_BRANCH9:
905 return & elf32_arm_thm_pc9_howto;
906
907 default:
908 for (i = 0; i < NUM_ELEM (elf32_arm_reloc_map); i ++)
909 if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
910 return & elf32_arm_howto_table[elf32_arm_reloc_map[i].elf_reloc_val];
3e932841 911
252b5132
RH
912 return NULL;
913 }
914}
915
c5fccbec 916/* Support for core dump NOTE sections */
b34976b6 917static bfd_boolean
c5fccbec
DJ
918elf32_arm_nabi_grok_prstatus (abfd, note)
919 bfd *abfd;
920 Elf_Internal_Note *note;
921{
922 int offset;
eea6121a 923 size_t size;
c5fccbec
DJ
924
925 switch (note->descsz)
926 {
927 default:
b34976b6 928 return FALSE;
c5fccbec
DJ
929
930 case 148: /* Linux/ARM 32-bit*/
931 /* pr_cursig */
932 elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
933
934 /* pr_pid */
935 elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
936
937 /* pr_reg */
938 offset = 72;
eea6121a 939 size = 72;
c5fccbec
DJ
940
941 break;
942 }
943
944 /* Make a ".reg/999" section. */
945 return _bfd_elfcore_make_pseudosection (abfd, ".reg",
eea6121a 946 size, note->descpos + offset);
c5fccbec
DJ
947}
948
b34976b6 949static bfd_boolean
c5fccbec
DJ
950elf32_arm_nabi_grok_psinfo (abfd, note)
951 bfd *abfd;
952 Elf_Internal_Note *note;
953{
954 switch (note->descsz)
955 {
956 default:
b34976b6 957 return FALSE;
c5fccbec
DJ
958
959 case 124: /* Linux/ARM elf_prpsinfo */
960 elf_tdata (abfd)->core_program
961 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
962 elf_tdata (abfd)->core_command
963 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
964 }
965
966 /* Note that for some reason, a spurious space is tacked
967 onto the end of the args in some (at least one anyway)
968 implementations, so strip it off if it exists. */
969
970 {
971 char *command = elf_tdata (abfd)->core_command;
972 int n = strlen (command);
973
974 if (0 < n && command[n - 1] == ' ')
975 command[n - 1] = '\0';
976 }
977
b34976b6 978 return TRUE;
c5fccbec
DJ
979}
980
e5a52504
MM
981#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec
982#define TARGET_LITTLE_NAME "elf32-littlearm"
983#define TARGET_BIG_SYM bfd_elf32_bigarm_vec
984#define TARGET_BIG_NAME "elf32-bigarm"
985
c5fccbec
DJ
986#define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus
987#define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo
988
252b5132 989#include "elf32-arm.h"
e5a52504
MM
990
991/* Symbian OS Targets */
992
993#undef TARGET_LITTLE_SYM
994#define TARGET_LITTLE_SYM bfd_elf32_littlearm_symbian_vec
995#undef TARGET_LITTLE_NAME
996#define TARGET_LITTLE_NAME "elf32-littlearm-symbian"
997#undef TARGET_BIG_SYM
998#define TARGET_BIG_SYM bfd_elf32_bigarm_symbian_vec
999#undef TARGET_BIG_NAME
1000#define TARGET_BIG_NAME "elf32-bigarm-symbian"
1001
1002/* Like elf32_arm_link_hash_table_create -- but overrides
1003 appropriately for Symbian OS. */
1004static struct bfd_link_hash_table *
1005elf32_arm_symbian_link_hash_table_create (bfd *abfd)
1006{
1007 struct bfd_link_hash_table *ret;
1008
1009 ret = elf32_arm_link_hash_table_create (abfd);
1010 if (ret)
1011 {
1012 struct elf32_arm_link_hash_table *htab
1013 = (struct elf32_arm_link_hash_table *)ret;
1014 /* There is no PLT header for Symbian OS. */
1015 htab->plt_header_size = 0;
1016 /* The PLT entries are each three instructions. */
1017 htab->plt_entry_size = 4 * NUM_ELEM (elf32_arm_symbian_plt_entry);
1018 htab->symbian_p = 1;
1019 }
1020 return ret;
1021}
1022
1023/* In a BPABI executable, the dynamic linking sections do not go in
1024 the loadable read-only segment. The post-linker may wish to refer
1025 to these sections, but they are not part of the final program
1026 image. */
1027static struct bfd_elf_special_section const
1028 elf32_arm_symbian_special_sections[]=
1029{
1030 { ".dynamic", 8, 0, SHT_DYNAMIC, 0 },
1031 { ".dynstr", 7, 0, SHT_STRTAB, 0 },
1032 { ".dynsym", 7, 0, SHT_DYNSYM, 0 },
1033 { ".got", 4, 0, SHT_PROGBITS, 0 },
1034 { ".hash", 5, 0, SHT_HASH, 0 },
1035 { NULL, 0, 0, 0, 0 }
1036};
1037
1038static bfd_boolean
1039elf32_arm_symbian_modify_segment_map
1040 PARAMS ((bfd *, struct bfd_link_info *));
1041
1042static bfd_boolean
1043elf32_arm_symbian_modify_segment_map (abfd, info)
1044 bfd *abfd;
1045 struct bfd_link_info *info ATTRIBUTE_UNUSED;
1046{
1047 struct elf_segment_map *m;
229fcec5 1048 asection *dynsec;
e5a52504
MM
1049
1050 /* The first PT_LOAD segment will have the program headers and file
1051 headers in it by default -- but BPABI object files should not
1052 include these headers in any loadable segment. */
1053 for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
1054 if (m->p_type == PT_LOAD)
1055 {
1056 m->includes_filehdr = 0;
1057 m->includes_phdrs = 0;
1058 }
229fcec5
MM
1059
1060 /* BPABI shared libraries and executables should have a PT_DYNAMIC
1061 segment. However, because the .dynamic section is not marked
1062 with SEC_LOAD, the generic ELF code will not create such a
1063 segment. */
1064 dynsec = bfd_get_section_by_name (abfd, ".dynamic");
1065 if (dynsec)
1066 {
1067 m = _bfd_elf_make_dynamic_segment (abfd, dynsec);
1068 m->next = elf_tdata (abfd)->segment_map;
1069 elf_tdata (abfd)->segment_map = m;
1070 }
1071
e5a52504
MM
1072 return TRUE;
1073}
1074
1075#undef elf32_bed
1076#define elf32_bed elf32_arm_symbian_bed
1077
6df4d94c
MM
1078/* The dynamic sections are not allocated on SymbianOS; the postlinker
1079 will process them and then discard them. */
e5a52504
MM
1080#undef ELF_DYNAMIC_SEC_FLAGS
1081#define ELF_DYNAMIC_SEC_FLAGS \
1082 (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED)
1083
1084#undef bfd_elf32_bfd_link_hash_table_create
1085#define bfd_elf32_bfd_link_hash_table_create \
1086 elf32_arm_symbian_link_hash_table_create
1087
1088#undef elf_backend_special_sections
1089#define elf_backend_special_sections elf32_arm_symbian_special_sections
1090
1091#undef elf_backend_modify_segment_map
1092#define elf_backend_modify_segment_map elf32_arm_symbian_modify_segment_map
1093
1094/* There is no .got section for BPABI objects, and hence no header. */
1095#undef elf_backend_got_header_size
1096#define elf_backend_got_header_size 0
1097
229fcec5
MM
1098/* Similarly, there is no .got.plt section. */
1099#undef elf_backend_want_got_plt
1100#define elf_backend_want_got_plt 0
1101
e5a52504
MM
1102#include "elf32-target.h"
1103
This page took 0.346106 seconds and 4 git commands to generate.