Changeset 609 for branches/GNU/src/binutils/bfd/elf32-arm.h
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/elf32-arm.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* 32-bit ELF support for ARM 2 Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.2 Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 3 3 4 4 This file is part of BFD, the Binary File Descriptor library. … … 18 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 19 19 20 #ifndef USE_REL 21 #define USE_REL 0 22 #endif 23 20 24 typedef unsigned long int insn32; 21 25 typedef unsigned short int insn16; 22 26 23 static b oolean elf32_arm_set_private_flags27 static bfd_boolean elf32_arm_set_private_flags 24 28 PARAMS ((bfd *, flagword)); 25 static b oolean elf32_arm_copy_private_bfd_data29 static bfd_boolean elf32_arm_copy_private_bfd_data 26 30 PARAMS ((bfd *, bfd *)); 27 static b oolean elf32_arm_merge_private_bfd_data31 static bfd_boolean elf32_arm_merge_private_bfd_data 28 32 PARAMS ((bfd *, bfd *)); 29 static b oolean elf32_arm_print_private_bfd_data33 static bfd_boolean elf32_arm_print_private_bfd_data 30 34 PARAMS ((bfd *, PTR)); 31 35 static int elf32_arm_get_symbol_type … … 36 40 PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, 37 41 Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *, 38 const char *, unsigned char, struct elf_link_hash_entry *));42 const char *, int, struct elf_link_hash_entry *)); 39 43 static insn32 insert_thumb_branch 40 44 PARAMS ((insn32, int)); 41 45 static struct elf_link_hash_entry *find_thumb_glue 42 PARAMS ((struct bfd_link_info *, CONSTchar *, bfd *));46 PARAMS ((struct bfd_link_info *, const char *, bfd *)); 43 47 static struct elf_link_hash_entry *find_arm_glue 44 PARAMS ((struct bfd_link_info *, CONST char *, bfd *)); 45 static void record_arm_to_thumb_glue 46 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); 47 static void record_thumb_to_arm_glue 48 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); 48 PARAMS ((struct bfd_link_info *, const char *, bfd *)); 49 49 static void elf32_arm_post_process_headers 50 50 PARAMS ((bfd *, struct bfd_link_info *)); … … 55 55 PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *, 56 56 bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma)); 57 58 #define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_INTERWORK) 57 static bfd_boolean elf32_arm_relocate_section 58 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 59 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); 60 static asection * elf32_arm_gc_mark_hook 61 PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, 62 struct elf_link_hash_entry *, Elf_Internal_Sym *)); 63 static bfd_boolean elf32_arm_gc_sweep_hook 64 PARAMS ((bfd *, struct bfd_link_info *, asection *, 65 const Elf_Internal_Rela *)); 66 static bfd_boolean elf32_arm_check_relocs 67 PARAMS ((bfd *, struct bfd_link_info *, asection *, 68 const Elf_Internal_Rela *)); 69 static bfd_boolean elf32_arm_find_nearest_line 70 PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, 71 const char **, unsigned int *)); 72 static bfd_boolean elf32_arm_adjust_dynamic_symbol 73 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); 74 static bfd_boolean elf32_arm_size_dynamic_sections 75 PARAMS ((bfd *, struct bfd_link_info *)); 76 static bfd_boolean elf32_arm_finish_dynamic_symbol 77 PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, 78 Elf_Internal_Sym *)); 79 static bfd_boolean elf32_arm_finish_dynamic_sections 80 PARAMS ((bfd *, struct bfd_link_info *)); 81 static struct bfd_hash_entry * elf32_arm_link_hash_newfunc 82 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); 83 #if USE_REL 84 static void arm_add_to_rel 85 PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma)); 86 #endif 87 static enum elf_reloc_type_class elf32_arm_reloc_type_class 88 PARAMS ((const Elf_Internal_Rela *)); 89 static bfd_boolean elf32_arm_object_p 90 PARAMS ((bfd *)); 91 92 #ifndef ELFARM_NABI_C_INCLUDED 93 static void record_arm_to_thumb_glue 94 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); 95 static void record_thumb_to_arm_glue 96 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); 97 bfd_boolean bfd_elf32_arm_allocate_interworking_sections 98 PARAMS ((struct bfd_link_info *)); 99 bfd_boolean bfd_elf32_arm_get_bfd_for_interworking 100 PARAMS ((bfd *, struct bfd_link_info *)); 101 bfd_boolean bfd_elf32_arm_process_before_allocation 102 PARAMS ((bfd *, struct bfd_link_info *, int)); 103 #endif 104 105 106 #define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK) 59 107 60 108 /* The linker script knows the section names for placement. … … 79 127 called before the relocation has been set up calls the dynamic 80 128 linker first. */ 81 static const unsigned longelf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] =82 {83 0xe52de004, /* str lr, [sp, #-4]! */84 0xe59fe010, /* ldr lr, [pc, #16] */85 0xe08fe00e, /* add lr, pc, lr */86 0xe5bef008 /* ldr pc, [lr, #8]! */87 };129 static const bfd_vma elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] = 130 { 131 0xe52de004, /* str lr, [sp, #-4]! */ 132 0xe59fe010, /* ldr lr, [pc, #16] */ 133 0xe08fe00e, /* add lr, pc, lr */ 134 0xe5bef008 /* ldr pc, [lr, #8]! */ 135 }; 88 136 89 137 /* Subsequent entries in a procedure linkage table look like 90 138 this. */ 91 static const unsigned longelf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =92 {93 0xe59fc004, /* ldr ip, [pc, #4] */94 0xe08fc00c, /* add ip, pc, ip */95 0xe59cf000, /* ldr pc, [ip] */96 0x00000000 /* offset to symbol in got */97 };139 static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = 140 { 141 0xe59fc004, /* ldr ip, [pc, #4] */ 142 0xe08fc00c, /* add ip, pc, ip */ 143 0xe59cf000, /* ldr pc, [ip] */ 144 0x00000000 /* offset to symbol in got */ 145 }; 98 146 99 147 /* The ARM linker needs to keep track of the number of relocs that it … … 106 154 have copied for a given symbol. */ 107 155 struct elf32_arm_pcrel_relocs_copied 108 {109 /* Next section. */110 struct elf32_arm_pcrel_relocs_copied * next;111 /* A section in dynobj. */112 asection * section;113 /* Number of relocs copied in this section. */114 bfd_size_type count;115 };156 { 157 /* Next section. */ 158 struct elf32_arm_pcrel_relocs_copied * next; 159 /* A section in dynobj. */ 160 asection * section; 161 /* Number of relocs copied in this section. */ 162 bfd_size_type count; 163 }; 116 164 117 165 /* Arm ELF linker hash entry. */ 118 166 struct elf32_arm_link_hash_entry 119 {120 struct elf_link_hash_entry root;121 122 /* Number of PC relative relocs copied for this symbol. */123 struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied;124 };167 { 168 struct elf_link_hash_entry root; 169 170 /* Number of PC relative relocs copied for this symbol. */ 171 struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied; 172 }; 125 173 126 174 /* Declare this now that the above structures are defined. */ 127 static b oolean elf32_arm_discard_copies175 static bfd_boolean elf32_arm_discard_copies 128 176 PARAMS ((struct elf32_arm_link_hash_entry *, PTR)); 129 177 … … 132 180 (elf_link_hash_traverse \ 133 181 (&(table)->root, \ 134 (b oolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func),\182 (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ 135 183 (info))) 136 184 … … 141 189 /* ARM ELF linker hash table. */ 142 190 struct elf32_arm_link_hash_table 143 {144 /* The main hash table. */145 struct elf_link_hash_table root;146 147 /* The size in bytes of the section containg the Thumb-to-ARM glue. */148 long intthumb_glue_size;149 150 /* The size in bytes of the section containg the ARM-to-Thumb glue. */151 long intarm_glue_size;152 153 /* An arbitary input BFD chosen to hold the glue sections. */154 bfd * bfd_of_glue_owner;155 156 /* A boolean indicating whether knowledge of the ARM's pipeline157 length should be applied by the linker. */158 int no_pipeline_knowledge;159 };191 { 192 /* The main hash table. */ 193 struct elf_link_hash_table root; 194 195 /* The size in bytes of the section containg the Thumb-to-ARM glue. */ 196 bfd_size_type thumb_glue_size; 197 198 /* The size in bytes of the section containg the ARM-to-Thumb glue. */ 199 bfd_size_type arm_glue_size; 200 201 /* An arbitary input BFD chosen to hold the glue sections. */ 202 bfd * bfd_of_glue_owner; 203 204 /* A boolean indicating whether knowledge of the ARM's pipeline 205 length should be applied by the linker. */ 206 int no_pipeline_knowledge; 207 }; 160 208 161 209 /* Create an entry in an ARM ELF linker hash table. */ … … 196 244 { 197 245 struct elf32_arm_link_hash_table *ret; 198 199 ret = ((struct elf32_arm_link_hash_table *) 200 bfd_alloc (abfd, sizeof (struct elf32_arm_link_hash_table)));246 bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table); 247 248 ret = (struct elf32_arm_link_hash_table *) bfd_malloc (amt); 201 249 if (ret == (struct elf32_arm_link_hash_table *) NULL) 202 250 return NULL; … … 205 253 elf32_arm_link_hash_newfunc)) 206 254 { 207 bfd_release (abfd,ret);255 free (ret); 208 256 return NULL; 209 257 } … … 222 270 find_thumb_glue (link_info, name, input_bfd) 223 271 struct bfd_link_info *link_info; 224 CONSTchar *name;272 const char *name; 225 273 bfd *input_bfd; 226 274 { … … 232 280 hash_table = elf32_arm_hash_table (link_info); 233 281 234 tmp_name = ( (char *)235 bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1));282 tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) 283 + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); 236 284 237 285 BFD_ASSERT (tmp_name); … … 240 288 241 289 hash = elf_link_hash_lookup 242 (&(hash_table)->root, tmp_name, false, false, true);290 (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); 243 291 244 292 if (hash == NULL) 245 293 /* xgettext:c-format */ 246 _bfd_error_handler(_("%s: unable to find THUMB glue '%s' for `%s'"),247 bfd_get_filename (input_bfd), tmp_name, name);294 (*_bfd_error_handler) (_("%s: unable to find THUMB glue '%s' for `%s'"), 295 bfd_archive_filename (input_bfd), tmp_name, name); 248 296 249 297 free (tmp_name); … … 257 305 find_arm_glue (link_info, name, input_bfd) 258 306 struct bfd_link_info *link_info; 259 CONSTchar *name;307 const char *name; 260 308 bfd *input_bfd; 261 309 { … … 267 315 hash_table = elf32_arm_hash_table (link_info); 268 316 269 tmp_name = ( (char *)270 bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1));317 tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) 318 + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1); 271 319 272 320 BFD_ASSERT (tmp_name); … … 275 323 276 324 myh = elf_link_hash_lookup 277 (&(hash_table)->root, tmp_name, false, false, true);325 (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); 278 326 279 327 if (myh == NULL) 280 328 /* xgettext:c-format */ 281 _bfd_error_handler(_("%s: unable to find ARM glue '%s' for `%s'"),282 bfd_get_filename (input_bfd), tmp_name, name);329 (*_bfd_error_handler) (_("%s: unable to find ARM glue '%s' for `%s'"), 330 bfd_archive_filename (input_bfd), tmp_name, name); 283 331 284 332 free (tmp_name); … … 322 370 static const insn32 t2a3_b_insn = 0xea000000; 323 371 324 static const insn16 t2a1_push_insn = 0xb540; 325 static const insn16 t2a2_ldr_insn = 0x4e03; 326 static const insn16 t2a3_mov_insn = 0x46fe; 327 static const insn16 t2a4_bx_insn = 0x4730; 328 static const insn32 t2a5_pop_insn = 0xe8bd4040; 329 static const insn32 t2a6_bx_insn = 0xe12fff1e; 330 331 boolean 372 #ifndef ELFARM_NABI_C_INCLUDED 373 bfd_boolean 332 374 bfd_elf32_arm_allocate_interworking_sections (info) 333 375 struct bfd_link_info * info; … … 345 387 BFD_ASSERT (globals->bfd_of_glue_owner != NULL); 346 388 347 s = bfd_get_section_by_name 348 (globals->bfd_of_glue_owner,ARM2THUMB_GLUE_SECTION_NAME);389 s = bfd_get_section_by_name (globals->bfd_of_glue_owner, 390 ARM2THUMB_GLUE_SECTION_NAME); 349 391 350 392 BFD_ASSERT (s != NULL); 351 393 352 foo = (bfd_byte *) bfd_alloc 353 (globals->bfd_of_glue_owner,globals->arm_glue_size);394 foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, 395 globals->arm_glue_size); 354 396 355 397 s->_raw_size = s->_cooked_size = globals->arm_glue_size; … … 366 408 BFD_ASSERT (s != NULL); 367 409 368 foo = (bfd_byte *) bfd_alloc 369 (globals->bfd_of_glue_owner,globals->thumb_glue_size);410 foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, 411 globals->thumb_glue_size); 370 412 371 413 s->_raw_size = s->_cooked_size = globals->thumb_glue_size; … … 373 415 } 374 416 375 return true;417 return TRUE; 376 418 } 377 419 … … 382 424 { 383 425 const char * name = h->root.root.string; 384 registerasection * s;426 asection * s; 385 427 char * tmp_name; 386 428 struct elf_link_hash_entry * myh; 429 struct bfd_link_hash_entry * bh; 387 430 struct elf32_arm_link_hash_table * globals; 431 bfd_vma val; 388 432 389 433 globals = elf32_arm_hash_table (link_info); … … 397 441 BFD_ASSERT (s != NULL); 398 442 399 tmp_name = ( (char *)400 bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1));443 tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) 444 + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1); 401 445 402 446 BFD_ASSERT (tmp_name); … … 405 449 406 450 myh = elf_link_hash_lookup 407 (&(globals)->root, tmp_name, false, false, true);451 (&(globals)->root, tmp_name, FALSE, FALSE, TRUE); 408 452 409 453 if (myh != NULL) … … 417 461 though the section isn't allocated yet, this is where we will be putting 418 462 it. */ 419 _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner, tmp_name,420 BSF_GLOBAL, 421 s, globals->arm_glue_size + 1,422 NULL, true, false,423 (struct bfd_link_hash_entry **) &myh);463 bh = NULL; 464 val = globals->arm_glue_size + 1; 465 _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner, 466 tmp_name, BSF_GLOBAL, s, val, 467 NULL, TRUE, FALSE, &bh); 424 468 425 469 free (tmp_name); … … 436 480 { 437 481 const char *name = h->root.root.string; 438 registerasection *s;482 asection *s; 439 483 char *tmp_name; 440 484 struct elf_link_hash_entry *myh; 485 struct bfd_link_hash_entry *bh; 441 486 struct elf32_arm_link_hash_table *hash_table; 442 487 char bind; 488 bfd_vma val; 443 489 444 490 hash_table = elf32_arm_hash_table (link_info); … … 452 498 BFD_ASSERT (s != NULL); 453 499 454 tmp_name = (char *) bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); 500 tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) 501 + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); 455 502 456 503 BFD_ASSERT (tmp_name); … … 459 506 460 507 myh = elf_link_hash_lookup 461 (&(hash_table)->root, tmp_name, false, false, true);508 (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); 462 509 463 510 if (myh != NULL) … … 468 515 } 469 516 470 _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, tmp_name, 471 BSF_GLOBAL, s, hash_table->thumb_glue_size + 1, 472 NULL, true, false, 473 (struct bfd_link_hash_entry **) &myh); 517 bh = NULL; 518 val = hash_table->thumb_glue_size + 1; 519 _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, 520 tmp_name, BSF_GLOBAL, s, val, 521 NULL, TRUE, FALSE, &bh); 474 522 475 523 /* If we mark it 'Thumb', the disassembler will do a better job. */ 524 myh = (struct elf_link_hash_entry *) bh; 476 525 bind = ELF_ST_BIND (myh->type); 477 526 myh->type = ELF_ST_INFO (bind, STT_ARM_TFUNC); … … 483 532 484 533 /* Allocate another symbol to mark where we switch to Arm mode. */ 485 tmp_name = (char *) bfd_malloc (strlen (name) + strlen (CHANGE_TO_ARM) + 1); 534 tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) 535 + strlen (CHANGE_TO_ARM) + 1); 486 536 487 537 BFD_ASSERT (tmp_name); … … 489 539 sprintf (tmp_name, CHANGE_TO_ARM, name); 490 540 491 myh = NULL; 492 493 _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, tmp_name, 494 BSF_LOCAL, s, hash_table->thumb_glue_size + 4, 495 NULL, true, false, 496 (struct bfd_link_hash_entry **) &myh); 541 bh = NULL; 542 val = hash_table->thumb_glue_size + 4, 543 _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, 544 tmp_name, BSF_LOCAL, s, val, 545 NULL, TRUE, FALSE, &bh); 497 546 498 547 free (tmp_name); … … 501 550 502 551 return; 552 } 553 554 /* Add the glue sections to ABFD. This function is called from the 555 linker scripts in ld/emultempl/{armelf}.em. */ 556 557 bfd_boolean 558 bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info) 559 bfd *abfd; 560 struct bfd_link_info *info; 561 { 562 flagword flags; 563 asection *sec; 564 565 /* If we are only performing a partial 566 link do not bother adding the glue. */ 567 if (info->relocateable) 568 return TRUE; 569 570 sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME); 571 572 if (sec == NULL) 573 { 574 /* Note: we do not include the flag SEC_LINKER_CREATED, as this 575 will prevent elf_link_input_bfd() from processing the contents 576 of this section. */ 577 flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; 578 579 sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME); 580 581 if (sec == NULL 582 || !bfd_set_section_flags (abfd, sec, flags) 583 || !bfd_set_section_alignment (abfd, sec, 2)) 584 return FALSE; 585 586 /* Set the gc mark to prevent the section from being removed by garbage 587 collection, despite the fact that no relocs refer to this section. */ 588 sec->gc_mark = 1; 589 } 590 591 sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME); 592 593 if (sec == NULL) 594 { 595 flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; 596 597 sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME); 598 599 if (sec == NULL 600 || !bfd_set_section_flags (abfd, sec, flags) 601 || !bfd_set_section_alignment (abfd, sec, 2)) 602 return FALSE; 603 604 sec->gc_mark = 1; 605 } 606 607 return TRUE; 503 608 } 504 609 … … 507 612 {armelf/pe}.em */ 508 613 509 b oolean614 bfd_boolean 510 615 bfd_elf32_arm_get_bfd_for_interworking (abfd, info) 511 616 bfd *abfd; … … 513 618 { 514 619 struct elf32_arm_link_hash_table *globals; 515 flagword flags; 516 asection *sec; 517 518 /* If we are only performing a partial link do not bother 519 getting a bfd to hold the glue. */ 620 621 /* If we are only performing a partial link 622 do not bother getting a bfd to hold the glue. */ 520 623 if (info->relocateable) 521 return true;624 return TRUE; 522 625 523 626 globals = elf32_arm_hash_table (info); … … 526 629 527 630 if (globals->bfd_of_glue_owner != NULL) 528 return true; 529 530 sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME); 531 532 if (sec == NULL) 533 { 534 /* Note: we do not include the flag SEC_LINKER_CREATED, as this 535 will prevent elf_link_input_bfd() from processing the contents 536 of this section. */ 537 flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; 538 539 sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME); 540 541 if (sec == NULL 542 || !bfd_set_section_flags (abfd, sec, flags) 543 || !bfd_set_section_alignment (abfd, sec, 2)) 544 return false; 545 546 /* Set the gc mark to prevent the section from being removed by garbage 547 collection, despite the fact that no relocs refer to this section. */ 548 sec->gc_mark = 1; 549 } 550 551 sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME); 552 553 if (sec == NULL) 554 { 555 flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; 556 557 sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME); 558 559 if (sec == NULL 560 || !bfd_set_section_flags (abfd, sec, flags) 561 || !bfd_set_section_alignment (abfd, sec, 2)) 562 return false; 563 564 sec->gc_mark = 1; 565 } 631 return TRUE; 566 632 567 633 /* Save the bfd for later use. */ 568 634 globals->bfd_of_glue_owner = abfd; 569 635 570 return true;636 return TRUE; 571 637 } 572 638 573 b oolean639 bfd_boolean 574 640 bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge) 575 641 bfd *abfd; … … 578 644 { 579 645 Elf_Internal_Shdr *symtab_hdr; 580 Elf_Internal_Rela * free_relocs = NULL;646 Elf_Internal_Rela *internal_relocs = NULL; 581 647 Elf_Internal_Rela *irel, *irelend; 582 648 bfd_byte *contents = NULL; 583 bfd_byte *free_contents = NULL;584 Elf32_External_Sym *extsyms = NULL;585 Elf32_External_Sym *free_extsyms = NULL;586 649 587 650 asection *sec; … … 591 654 to construct any glue. */ 592 655 if (link_info->relocateable) 593 return true;656 return TRUE; 594 657 595 658 /* Here we have a bfd that is to be included on the link. We have a hook … … 606 669 607 670 if (sec == NULL) 608 return true;671 return TRUE; 609 672 610 673 for (; sec != NULL; sec = sec->next) … … 616 679 617 680 /* Load the relocs. */ 618 irel = (_bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL, 619 (Elf_Internal_Rela *) NULL, false)); 620 621 BFD_ASSERT (irel != 0); 622 623 irelend = irel + sec->reloc_count; 624 for (; irel < irelend; irel++) 681 internal_relocs 682 = _bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL, 683 (Elf_Internal_Rela *) NULL, FALSE); 684 685 if (internal_relocs == NULL) 686 goto error_return; 687 688 irelend = internal_relocs + sec->reloc_count; 689 for (irel = internal_relocs; irel < irelend; irel++) 625 690 { 626 691 long r_type; … … 650 715 goto error_return; 651 716 652 free_contents = contents;653 654 717 if (!bfd_get_section_contents (abfd, sec, contents, 655 (file_ptr) 0, sec->_raw_size)) 656 goto error_return; 657 } 658 } 659 660 /* Read this BFD's symbols if we haven't done so already. */ 661 if (extsyms == NULL) 662 { 663 /* Get cached copy if it exists. */ 664 if (symtab_hdr->contents != NULL) 665 extsyms = (Elf32_External_Sym *) symtab_hdr->contents; 666 else 667 { 668 /* Go get them off disk. */ 669 extsyms = ((Elf32_External_Sym *) 670 bfd_malloc (symtab_hdr->sh_size)); 671 if (extsyms == NULL) 672 goto error_return; 673 674 free_extsyms = extsyms; 675 676 if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 677 || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) 678 != symtab_hdr->sh_size)) 718 (file_ptr) 0, sec->_raw_size)) 679 719 goto error_return; 680 720 } … … 720 760 } 721 761 } 722 } 723 724 return true; 762 763 if (contents != NULL 764 && elf_section_data (sec)->this_hdr.contents != contents) 765 free (contents); 766 contents = NULL; 767 768 if (internal_relocs != NULL 769 && elf_section_data (sec)->relocs != internal_relocs) 770 free (internal_relocs); 771 internal_relocs = NULL; 772 } 773 774 return TRUE; 725 775 726 776 error_return: 727 if ( free_relocs != NULL)728 free (free_relocs);729 if (free_contents != NULL)730 free (free_contents);731 if (free_extsyms != NULL)732 free ( free_extsyms);733 734 return false;777 if (contents != NULL 778 && elf_section_data (sec)->this_hdr.contents != contents) 779 free (contents); 780 if (internal_relocs != NULL 781 && elf_section_data (sec)->relocs != internal_relocs) 782 free (internal_relocs); 783 784 return FALSE; 735 785 } 786 #endif 736 787 737 788 /* The thumb form of a long branch is a bit finicky, because the offset … … 808 859 { 809 860 asection * s = 0; 810 long intmy_offset;861 bfd_vma my_offset; 811 862 unsigned long int tmp; 812 863 long int ret_offset; … … 816 867 myh = find_thumb_glue (info, name, input_bfd); 817 868 if (myh == NULL) 818 return false;869 return FALSE; 819 870 820 871 globals = elf32_arm_hash_table (info); … … 838 889 && !INTERWORK_FLAG (sym_sec->owner)) 839 890 { 840 _bfd_error_handler891 (*_bfd_error_handler) 841 892 (_("%s(%s): warning: interworking not enabled."), 842 bfd_ get_filename (sym_sec->owner), name);843 _bfd_error_handler893 bfd_archive_filename (sym_sec->owner), name); 894 (*_bfd_error_handler) 844 895 (_(" first occurrence: %s: thumb call to arm"), 845 bfd_ get_filename (input_bfd));846 847 return false;896 bfd_archive_filename (input_bfd)); 897 898 return FALSE; 848 899 } 849 900 … … 851 902 myh->root.u.def.value = my_offset; 852 903 853 bfd_put_16 (output_bfd, t2a1_bx_pc_insn,904 bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn, 854 905 s->contents + my_offset); 855 906 856 bfd_put_16 (output_bfd, t2a2_noop_insn,907 bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn, 857 908 s->contents + my_offset + 2); 858 909 … … 873 924 874 925 bfd_put_32 (output_bfd, 875 t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),926 (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), 876 927 s->contents + my_offset + 4); 877 928 } … … 879 930 BFD_ASSERT (my_offset <= globals->thumb_glue_size); 880 931 881 /* Now go back and fix up the original BL insn to point 882 to here. */ 932 /* Now go back and fix up the original BL insn to point to here. */ 883 933 ret_offset = 884 s->output_offset 885 + my_offset 886 - (input_section->output_offset 887 + offset + addend) 934 /* Address of where the stub is located. */ 935 (s->output_section->vma + s->output_offset + my_offset) 936 /* Address of where the BL is located. */ 937 - (input_section->output_section->vma + input_section->output_offset + offset) 938 /* Addend in the relocation. */ 939 - addend 940 /* Biassing for PC-relative addressing. */ 888 941 - 8; 889 942 … … 892 945 893 946 bfd_put_32 (output_bfd, 894 insert_thumb_branch (tmp, ret_offset),947 (bfd_vma) insert_thumb_branch (tmp, ret_offset), 895 948 hit_data - input_section->vma); 896 949 897 return true;950 return TRUE; 898 951 } 899 952 … … 915 968 { 916 969 unsigned long int tmp; 917 long intmy_offset;970 bfd_vma my_offset; 918 971 asection * s; 919 972 long int ret_offset; … … 923 976 myh = find_arm_glue (info, name, input_bfd); 924 977 if (myh == NULL) 925 return false;978 return FALSE; 926 979 927 980 globals = elf32_arm_hash_table (info); … … 943 996 && !INTERWORK_FLAG (sym_sec->owner)) 944 997 { 945 _bfd_error_handler998 (*_bfd_error_handler) 946 999 (_("%s(%s): warning: interworking not enabled."), 947 bfd_ get_filename (sym_sec->owner), name);948 _bfd_error_handler1000 bfd_archive_filename (sym_sec->owner), name); 1001 (*_bfd_error_handler) 949 1002 (_(" first occurrence: %s: arm call to thumb"), 950 bfd_ get_filename (input_bfd));1003 bfd_archive_filename (input_bfd)); 951 1004 } 952 1005 … … 954 1007 myh->root.u.def.value = my_offset; 955 1008 956 bfd_put_32 (output_bfd, a2t1_ldr_insn,1009 bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn, 957 1010 s->contents + my_offset); 958 1011 959 bfd_put_32 (output_bfd, a2t2_bx_r12_insn,1012 bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn, 960 1013 s->contents + my_offset + 4); 961 1014 … … 971 1024 972 1025 /* Somehow these are both 4 too far, so subtract 8. */ 973 ret_offset = s->output_offset974 975 976 977 978 979 - 8;1026 ret_offset = (s->output_offset 1027 + my_offset 1028 + s->output_section->vma 1029 - (input_section->output_offset 1030 + input_section->output_section->vma 1031 + offset + addend) 1032 - 8); 980 1033 981 1034 tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF); 982 1035 983 bfd_put_32 (output_bfd, tmp, hit_data 984 - input_section->vma); 985 986 return true; 1036 bfd_put_32 (output_bfd, (bfd_vma) tmp, hit_data - input_section->vma); 1037 1038 return TRUE; 987 1039 } 988 1040 … … 1003 1055 asection * sym_sec; 1004 1056 const char * sym_name; 1005 unsigned charsym_flags;1057 int sym_flags; 1006 1058 struct elf_link_hash_entry * h; 1007 1059 { … … 1023 1075 flag. Setting this more than once is redundant, but the cost is 1024 1076 not too high, and it keeps the code simple. 1025 1077 1026 1078 The test is done here, rather than somewhere else, because the 1027 1079 start address is only set just before the final link commences. … … 1031 1083 if (bfd_get_start_address (output_bfd) != 0) 1032 1084 elf_elfheader (output_bfd)->e_flags |= EF_ARM_HASENTRY; 1033 1085 1034 1086 globals = elf32_arm_hash_table (info); 1035 1087 … … 1045 1097 r_symndx = ELF32_R_SYM (rel->r_info); 1046 1098 1047 #if defUSE_REL1099 #if USE_REL 1048 1100 addend = bfd_get_32 (input_bfd, hit_data) & howto->src_mask; 1049 1101 … … 1074 1126 into the output file to be resolved at run time. */ 1075 1127 if (info->shared 1128 && r_symndx != 0 1076 1129 && (r_type != R_ARM_PC24 1077 1130 || (h != NULL 1078 1131 && h->dynindx != -1 1079 1132 && (! info->symbolic … … 1081 1134 & ELF_LINK_HASH_DEF_REGULAR) == 0)))) 1082 1135 { 1083 Elf_Internal_Rel outrel; 1084 boolean skip, relocate; 1136 Elf_Internal_Rela outrel; 1137 bfd_byte *loc; 1138 bfd_boolean skip, relocate; 1085 1139 1086 1140 if (sreloc == NULL) … … 1104 1158 } 1105 1159 1106 skip = false; 1107 1108 if (elf_section_data (input_section)->stab_info == NULL) 1109 outrel.r_offset = rel->r_offset; 1110 else 1111 { 1112 bfd_vma off; 1113 1114 off = (_bfd_stab_section_offset 1115 (output_bfd, &elf_hash_table (info)->stab_info, 1116 input_section, 1117 & elf_section_data (input_section)->stab_info, 1118 rel->r_offset)); 1119 if (off == (bfd_vma) -1) 1120 skip = true; 1121 outrel.r_offset = off; 1122 } 1123 1160 skip = FALSE; 1161 relocate = FALSE; 1162 1163 outrel.r_offset = 1164 _bfd_elf_section_offset (output_bfd, info, input_section, 1165 rel->r_offset); 1166 if (outrel.r_offset == (bfd_vma) -1) 1167 skip = TRUE; 1168 else if (outrel.r_offset == (bfd_vma) -2) 1169 skip = TRUE, relocate = TRUE; 1124 1170 outrel.r_offset += (input_section->output_section->vma 1125 1171 + input_section->output_offset); 1126 1172 1127 1173 if (skip) 1128 { 1129 memset (&outrel, 0, sizeof outrel); 1130 relocate = false; 1131 } 1174 memset (&outrel, 0, sizeof outrel); 1132 1175 else if (r_type == R_ARM_PC24) 1133 1176 { 1134 1177 BFD_ASSERT (h != NULL && h->dynindx != -1); 1135 if ((input_section->flags & SEC_ALLOC) != 0) 1136 relocate = false; 1137 else 1138 relocate = true; 1178 if ((input_section->flags & SEC_ALLOC) == 0) 1179 relocate = TRUE; 1139 1180 outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_PC24); 1140 1181 } … … 1146 1187 & ELF_LINK_HASH_DEF_REGULAR) != 0)) 1147 1188 { 1148 relocate = true;1189 relocate = TRUE; 1149 1190 outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); 1150 1191 } … … 1152 1193 { 1153 1194 BFD_ASSERT (h->dynindx != -1); 1154 if ((input_section->flags & SEC_ALLOC) != 0) 1155 relocate = false; 1156 else 1157 relocate = true; 1195 if ((input_section->flags & SEC_ALLOC) == 0) 1196 relocate = TRUE; 1158 1197 outrel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_ABS32); 1159 1198 } 1160 1199 } 1161 1200 1162 bfd_elf32_swap_reloc_out (output_bfd, &outrel, 1163 (((Elf32_External_Rel *) 1164 sreloc->contents) 1165 + sreloc->reloc_count)); 1166 ++sreloc->reloc_count; 1201 loc = sreloc->contents; 1202 loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel); 1203 bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); 1167 1204 1168 1205 /* If this reloc is against an external symbol, we do not want to … … 1189 1226 instruction instead ? */ 1190 1227 if (sym_flags != STT_ARM_TFUNC) 1191 _bfd_error_handler(_("\1228 (*_bfd_error_handler) (_("\ 1192 1229 %s: Warning: Arm BLX instruction targets Arm function '%s'."), 1193 bfd_get_filename (input_bfd),1194 h ? h->root.root.string : "(local)");1230 bfd_archive_filename (input_bfd), 1231 h ? h->root.root.string : "(local)"); 1195 1232 } 1196 1233 else … … 1296 1333 case R_ARM_REL32: 1297 1334 value -= (input_section->output_section->vma 1298 + input_section->output_offset );1335 + input_section->output_offset + rel->r_offset); 1299 1336 value += addend; 1300 1337 break; … … 1335 1372 case R_ARM_THM_ABS5: 1336 1373 /* Support ldr and str instructions for the thumb. */ 1337 #if defUSE_REL1374 #if USE_REL 1338 1375 /* Need to refetch addend. */ 1339 1376 addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask; … … 1358 1395 /* Thumb BL (branch long instruction). */ 1359 1396 { 1360 bfd_vma 1361 b oolean overflow = false;1362 bfd_vma 1363 bfd_vma 1364 bfd_signed_vma reloc_signed_max = ( 1 << (howto->bitsize - 1)) - 1;1397 bfd_vma relocation; 1398 bfd_boolean overflow = FALSE; 1399 bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data); 1400 bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2); 1401 bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift; 1365 1402 bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; 1366 bfd_vma 1403 bfd_vma check; 1367 1404 bfd_signed_vma signed_check; 1368 1405 1369 #if defUSE_REL1406 #if USE_REL 1370 1407 /* Need to refetch the addend and squish the two 11 bit pieces 1371 1408 together. */ … … 1385 1422 instruction instead ? */ 1386 1423 if (sym_flags == STT_ARM_TFUNC) 1387 _bfd_error_handler(_("\1424 (*_bfd_error_handler) (_("\ 1388 1425 %s: Warning: Thumb BLX instruction targets thumb function '%s'."), 1389 bfd_get_filename (input_bfd),1390 h ? h->root.root.string : "(local)");1426 bfd_archive_filename (input_bfd), 1427 h ? h->root.root.string : "(local)"); 1391 1428 } 1392 1429 else … … 1441 1478 /* Assumes two's complement. */ 1442 1479 if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) 1443 overflow = true; 1444 1480 overflow = TRUE; 1481 1482 #ifndef OLD_ARM_ABI 1483 if (r_type == R_ARM_THM_XPC22 1484 && ((lower_insn & 0x1800) == 0x0800)) 1485 /* For a BLX instruction, make sure that the relocation is rounded up 1486 to a word boundary. This follows the semantics of the instruction 1487 which specifies that bit 1 of the target address will come from bit 1488 1 of the base address. */ 1489 relocation = (relocation + 2) & ~ 3; 1490 #endif 1445 1491 /* Put RELOCATION back into the insn. */ 1446 1492 upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff); 1447 1493 lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff); 1448 1494 1449 #ifndef OLD_ARM_ABI1450 if (r_type == R_ARM_THM_XPC221451 && ((lower_insn & 0x1800) == 0x0800))1452 /* Remove bit zero of the adjusted offset. Bit zero can only be1453 set if the upper insn is at a half-word boundary, since the1454 destination address, an ARM instruction, must always be on a1455 word boundary. The semantics of the BLX (1) instruction, however,1456 are that bit zero in the offset must always be zero, and the1457 corresponding bit one in the target address will be set from bit1458 one of the source address. */1459 lower_insn &= ~1;1460 #endif1461 1495 /* Put the relocated value back in the object file: */ 1462 1496 bfd_put_16 (input_bfd, upper_insn, hit_data); … … 1467 1501 break; 1468 1502 1503 case R_ARM_THM_PC11: 1504 /* Thumb B (branch) instruction). */ 1505 { 1506 bfd_signed_vma relocation; 1507 bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; 1508 bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; 1509 bfd_signed_vma signed_check; 1510 1511 #if USE_REL 1512 /* Need to refetch addend. */ 1513 addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask; 1514 if (addend & ((howto->src_mask + 1) >> 1)) 1515 { 1516 signed_addend = -1; 1517 signed_addend &= ~ howto->src_mask; 1518 signed_addend |= addend; 1519 } 1520 else 1521 signed_addend = addend; 1522 /* The value in the insn has been right shifted. We need to 1523 undo this, so that we can perform the address calculation 1524 in terms of bytes. */ 1525 signed_addend <<= howto->rightshift; 1526 #endif 1527 relocation = value + signed_addend; 1528 1529 relocation -= (input_section->output_section->vma 1530 + input_section->output_offset 1531 + rel->r_offset); 1532 1533 relocation >>= howto->rightshift; 1534 signed_check = relocation; 1535 relocation &= howto->dst_mask; 1536 relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask)); 1537 1538 bfd_put_16 (input_bfd, relocation, hit_data); 1539 1540 /* Assumes two's complement. */ 1541 if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) 1542 return bfd_reloc_overflow; 1543 1544 return bfd_reloc_ok; 1545 } 1546 1469 1547 case R_ARM_GNU_VTINHERIT: 1470 1548 case R_ARM_GNU_VTENTRY: … … 1490 1568 if (sgot == NULL) 1491 1569 return bfd_reloc_notsupported; 1570 1571 /* If we are addressing a Thumb function, we need to adjust the 1572 address by one, so that attempts to call the function pointer will 1573 correctly interpret it as Thumb code. */ 1574 if (sym_flags == STT_ARM_TFUNC) 1575 value += 1; 1492 1576 1493 1577 /* Note that sgot->output_offset is not involved in this … … 1498 1582 value -= sgot->output_section->vma; 1499 1583 return _bfd_final_link_relocate (howto, input_bfd, input_section, 1500 1501 1584 contents, rel->r_offset, value, 1585 (bfd_vma) 0); 1502 1586 1503 1587 case R_ARM_GOTPC: … … 1510 1594 value = sgot->output_section->vma; 1511 1595 return _bfd_final_link_relocate (howto, input_bfd, input_section, 1512 1513 1596 contents, rel->r_offset, value, 1597 (bfd_vma) 0); 1514 1598 1515 1599 case R_ARM_GOT32: … … 1543 1627 else 1544 1628 { 1629 /* If we are addressing a Thumb function, we need to 1630 adjust the address by one, so that attempts to 1631 call the function pointer will correctly 1632 interpret it as Thumb code. */ 1633 if (sym_flags == STT_ARM_TFUNC) 1634 value |= 1; 1635 1545 1636 bfd_put_32 (output_bfd, value, sgot->contents + off); 1546 1637 h->got.offset |= 1; … … 1571 1662 { 1572 1663 asection * srelgot; 1573 Elf_Internal_Rel outrel; 1664 Elf_Internal_Rela outrel; 1665 bfd_byte *loc; 1574 1666 1575 1667 srelgot = bfd_get_section_by_name (dynobj, ".rel.got"); … … 1580 1672 + off); 1581 1673 outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); 1582 bfd_elf32_swap_reloc_out (output_bfd, &outrel, 1583 (((Elf32_External_Rel *) 1584 srelgot->contents) 1585 + srelgot->reloc_count)); 1586 ++srelgot->reloc_count; 1674 loc = srelgot->contents; 1675 loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rel); 1676 bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); 1587 1677 } 1588 1678 … … 1594 1684 1595 1685 return _bfd_final_link_relocate (howto, input_bfd, input_section, 1596 1597 1686 contents, rel->r_offset, value, 1687 (bfd_vma) 0); 1598 1688 1599 1689 case R_ARM_PLT32: … … 1605 1695 if (h == NULL) 1606 1696 return _bfd_final_link_relocate (howto, input_bfd, input_section, 1607 1608 1697 contents, rel->r_offset, value, 1698 (bfd_vma) 0); 1609 1699 1610 1700 if (h->plt.offset == (bfd_vma) -1) … … 1624 1714 + h->plt.offset); 1625 1715 return _bfd_final_link_relocate (howto, input_bfd, input_section, 1626 1627 1716 contents, rel->r_offset, value, 1717 (bfd_vma) 0); 1628 1718 1629 1719 case R_ARM_SBREL32: … … 1656 1746 } 1657 1747 1658 #if defUSE_REL1748 #if USE_REL 1659 1749 /* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */ 1660 1750 static void … … 1684 1774 lower_insn = (lower_insn & 0xf800) | (addend & 0x7ff); 1685 1775 1686 bfd_put_16 (abfd, upper_insn, address);1687 bfd_put_16 (abfd, lower_insn, address + 2);1776 bfd_put_16 (abfd, (bfd_vma) upper_insn, address); 1777 bfd_put_16 (abfd, (bfd_vma) lower_insn, address + 2); 1688 1778 } 1689 1779 else … … 1713 1803 case R_ARM_PC24: 1714 1804 addend <<= howto->size; 1715 addend += 1805 addend += increment; 1716 1806 1717 1807 /* Should we check for overflow here ? */ … … 1730 1820 1731 1821 /* Relocate an ARM ELF section. */ 1732 static b oolean1822 static bfd_boolean 1733 1823 elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, 1734 1824 contents, relocs, local_syms, local_sections) 1735 bfd * 1736 struct bfd_link_info * 1737 bfd * 1738 asection * 1739 bfd_byte * 1740 Elf_Internal_Rela * 1741 Elf_Internal_Sym * 1742 asection ** 1825 bfd *output_bfd; 1826 struct bfd_link_info *info; 1827 bfd *input_bfd; 1828 asection *input_section; 1829 bfd_byte *contents; 1830 Elf_Internal_Rela *relocs; 1831 Elf_Internal_Sym *local_syms; 1832 asection **local_sections; 1743 1833 { 1744 Elf_Internal_Shdr * symtab_hdr; 1745 struct elf_link_hash_entry ** sym_hashes; 1746 Elf_Internal_Rela * rel; 1747 Elf_Internal_Rela * relend; 1748 const char * name; 1834 Elf_Internal_Shdr *symtab_hdr; 1835 struct elf_link_hash_entry **sym_hashes; 1836 Elf_Internal_Rela *rel; 1837 Elf_Internal_Rela *relend; 1838 const char *name; 1839 1840 #if !USE_REL 1841 if (info->relocateable) 1842 return TRUE; 1843 #endif 1749 1844 1750 1845 symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; … … 1775 1870 howto = bfd_reloc.howto; 1776 1871 1872 #if USE_REL 1777 1873 if (info->relocateable) 1778 1874 { … … 1787 1883 { 1788 1884 sec = local_sections[r_symndx]; 1789 #ifdef USE_REL1790 1885 arm_add_to_rel (input_bfd, contents + rel->r_offset, 1791 howto, sec->output_offset + sym->st_value); 1792 #else 1793 rel->r_addend += (sec->output_offset + sym->st_value) 1794 >> howto->rightshift; 1795 #endif 1886 howto, 1887 (bfd_signed_vma) (sec->output_offset 1888 + sym->st_value)); 1796 1889 } 1797 1890 } … … 1799 1892 continue; 1800 1893 } 1894 #endif 1801 1895 1802 1896 /* This is a final link. */ … … 1809 1903 sym = local_syms + r_symndx; 1810 1904 sec = local_sections[r_symndx]; 1905 #if USE_REL 1811 1906 relocation = (sec->output_section->vma 1812 1907 + sec->output_offset 1813 1908 + sym->st_value); 1909 if ((sec->flags & SEC_MERGE) 1910 && ELF_ST_TYPE (sym->st_info) == STT_SECTION) 1911 { 1912 asection *msec; 1913 bfd_vma addend, value; 1914 1915 if (howto->rightshift) 1916 { 1917 (*_bfd_error_handler) 1918 (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"), 1919 bfd_archive_filename (input_bfd), 1920 bfd_get_section_name (input_bfd, input_section), 1921 (long) rel->r_offset, howto->name); 1922 return FALSE; 1923 } 1924 1925 value = bfd_get_32 (input_bfd, contents + rel->r_offset); 1926 1927 /* Get the (signed) value from the instruction. */ 1928 addend = value & howto->src_mask; 1929 if (addend & ((howto->src_mask + 1) >> 1)) 1930 { 1931 bfd_signed_vma mask; 1932 1933 mask = -1; 1934 mask &= ~ howto->src_mask; 1935 addend |= mask; 1936 } 1937 msec = sec; 1938 addend = 1939 _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) 1940 - relocation; 1941 addend += msec->output_section->vma + msec->output_offset; 1942 value = (value & ~ howto->dst_mask) | (addend & howto->dst_mask); 1943 bfd_put_32 (input_bfd, value, contents + rel->r_offset); 1944 } 1945 #else 1946 relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); 1947 #endif 1814 1948 } 1815 1949 else … … 1835 1969 case R_ARM_PC24: 1836 1970 case R_ARM_ABS32: 1971 case R_ARM_THM_PC22: 1837 1972 if (info->shared 1838 1973 && ( 1839 1974 (!info->symbolic && h->dynindx != -1) 1840 1975 || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 1841 1976 ) … … 1875 2010 { 1876 2011 (*_bfd_error_handler) 1877 (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), 1878 bfd_get_filename (input_bfd), h->root.root.string, 2012 (_("%s: warning: unresolvable relocation %d against symbol `%s' from %s section"), 2013 bfd_archive_filename (input_bfd), 2014 r_type, 2015 h->root.root.string, 1879 2016 bfd_get_section_name (input_bfd, input_section)); 1880 2017 relocation_needed = 0; … … 1902 2039 (!info->shared || info->no_undefined 1903 2040 || ELF_ST_VISIBILITY (h->other))))) 1904 return false;2041 return FALSE; 1905 2042 relocation = 0; 1906 2043 } … … 1938 2075 (info, name, howto->name, (bfd_vma) 0, 1939 2076 input_bfd, input_section, rel->r_offset)))) 1940 return false;2077 return FALSE; 1941 2078 break; 1942 2079 … … 1944 2081 if (!((*info->callbacks->undefined_symbol) 1945 2082 (info, name, input_bfd, input_section, 1946 rel->r_offset, true)))1947 return false;2083 rel->r_offset, TRUE))) 2084 return FALSE; 1948 2085 break; 1949 2086 … … 1968 2105 (info, msg, name, input_bfd, input_section, 1969 2106 rel->r_offset))) 1970 return false;2107 return FALSE; 1971 2108 break; 1972 2109 } … … 1974 2111 } 1975 2112 1976 return true;2113 return TRUE; 1977 2114 } 1978 2115 2116 /* Set the right machine number. */ 2117 2118 static bfd_boolean 2119 elf32_arm_object_p (abfd) 2120 bfd *abfd; 2121 { 2122 unsigned int mach; 2123 2124 mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); 2125 2126 if (mach != bfd_mach_arm_unknown) 2127 bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); 2128 2129 else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT) 2130 bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312); 2131 2132 else 2133 bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); 2134 2135 return TRUE; 2136 } 2137 1979 2138 /* Function to keep ARM specific flags in the ELF header. */ 1980 static b oolean2139 static bfd_boolean 1981 2140 elf32_arm_set_private_flags (abfd, flags) 1982 2141 bfd *abfd; … … 1988 2147 if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN) 1989 2148 { 1990 if (flags & EF_ INTERWORK)1991 _bfd_error_handler(_("\1992 Warning: Not setting interwork flag of %s since it has already been specified as non-interworking"),1993 bfd_get_filename (abfd));2149 if (flags & EF_ARM_INTERWORK) 2150 (*_bfd_error_handler) (_("\ 2151 Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"), 2152 bfd_archive_filename (abfd)); 1994 2153 else 1995 2154 _bfd_error_handler (_("\ 1996 Warning: Clearing the interwork flag of %s due to outside request"),1997 bfd_ get_filename (abfd));2155 Warning: Clearing the interworking flag of %s due to outside request"), 2156 bfd_archive_filename (abfd)); 1998 2157 } 1999 2158 } … … 2001 2160 { 2002 2161 elf_elfheader (abfd)->e_flags = flags; 2003 elf_flags_init (abfd) = true;2004 } 2005 2006 return true;2162 elf_flags_init (abfd) = TRUE; 2163 } 2164 2165 return TRUE; 2007 2166 } 2008 2167 2009 2168 /* Copy backend specific data from one object module to another. */ 2010 2169 2011 static b oolean2170 static bfd_boolean 2012 2171 elf32_arm_copy_private_bfd_data (ibfd, obfd) 2013 2172 bfd *ibfd; … … 2019 2178 if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour 2020 2179 || bfd_get_flavour (obfd) != bfd_target_elf_flavour) 2021 return true;2180 return TRUE; 2022 2181 2023 2182 in_flags = elf_elfheader (ibfd)->e_flags; … … 2029 2188 { 2030 2189 /* Cannot mix APCS26 and APCS32 code. */ 2031 if ((in_flags & EF_A PCS_26) != (out_flags & EF_APCS_26))2032 return false;2190 if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26)) 2191 return FALSE; 2033 2192 2034 2193 /* Cannot mix float APCS and non-float APCS code. */ 2035 if ((in_flags & EF_A PCS_FLOAT) != (out_flags & EF_APCS_FLOAT))2036 return false;2194 if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT)) 2195 return FALSE; 2037 2196 2038 2197 /* If the src and dest have different interworking flags 2039 2198 then turn off the interworking bit. */ 2040 if ((in_flags & EF_ INTERWORK) != (out_flags & EF_INTERWORK))2041 { 2042 if (out_flags & EF_ INTERWORK)2199 if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK)) 2200 { 2201 if (out_flags & EF_ARM_INTERWORK) 2043 2202 _bfd_error_handler (_("\ 2044 Warning: Clearing the interwork flag in %s because non-interworking code in %s has been linked with it"), 2045 bfd_get_filename (obfd), bfd_get_filename (ibfd)); 2046 2047 in_flags &= ~EF_INTERWORK; 2203 Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"), 2204 bfd_get_filename (obfd), 2205 bfd_archive_filename (ibfd)); 2206 2207 in_flags &= ~EF_ARM_INTERWORK; 2048 2208 } 2049 2209 2050 2210 /* Likewise for PIC, though don't warn for this case. */ 2051 if ((in_flags & EF_ PIC) != (out_flags & EF_PIC))2052 in_flags &= ~EF_ PIC;2211 if ((in_flags & EF_ARM_PIC) != (out_flags & EF_ARM_PIC)) 2212 in_flags &= ~EF_ARM_PIC; 2053 2213 } 2054 2214 2055 2215 elf_elfheader (obfd)->e_flags = in_flags; 2056 elf_flags_init (obfd) = true;2057 2058 return true;2216 elf_flags_init (obfd) = TRUE; 2217 2218 return TRUE; 2059 2219 } 2060 2220 … … 2062 2222 object file when linking. */ 2063 2223 2064 static b oolean2224 static bfd_boolean 2065 2225 elf32_arm_merge_private_bfd_data (ibfd, obfd) 2066 2226 bfd * ibfd; … … 2069 2229 flagword out_flags; 2070 2230 flagword in_flags; 2071 b oolean flags_compatible = true;2072 b oolean null_input_bfd = true;2231 bfd_boolean flags_compatible = TRUE; 2232 bfd_boolean null_input_bfd = TRUE; 2073 2233 asection *sec; 2074 2234 2075 2235 /* Check if we have the same endianess. */ 2076 if ( _bfd_generic_verify_endian_match (ibfd, obfd) == false)2077 return false;2236 if (! _bfd_generic_verify_endian_match (ibfd, obfd)) 2237 return FALSE; 2078 2238 2079 2239 if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour 2080 2240 || bfd_get_flavour (obfd) != bfd_target_elf_flavour) 2081 return true;2241 return TRUE; 2082 2242 2083 2243 /* The input BFD must have had its flags initialised. */ … … 2100 2260 if (bfd_get_arch_info (ibfd)->the_default 2101 2261 && elf_elfheader (ibfd)->e_flags == 0) 2102 return true;2103 2104 elf_flags_init (obfd) = true;2262 return TRUE; 2263 2264 elf_flags_init (obfd) = TRUE; 2105 2265 elf_elfheader (obfd)->e_flags = in_flags; 2106 2266 … … 2109 2269 return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); 2110 2270 2111 return true; 2112 } 2271 return TRUE; 2272 } 2273 2274 /* Determine what should happen if the input ARM architecture 2275 does not match the output ARM architecture. */ 2276 if (! bfd_arm_merge_machines (ibfd, obfd)) 2277 return FALSE; 2113 2278 2114 2279 /* Identical flags must be compatible. */ 2115 2280 if (in_flags == out_flags) 2116 return true;2281 return TRUE; 2117 2282 2118 2283 /* Check to see if the input BFD actually contains any sections. … … 2125 2290 && strcmp (sec->name, ".glue_7t")) 2126 2291 { 2127 null_input_bfd = false;2292 null_input_bfd = FALSE; 2128 2293 break; 2129 2294 } 2130 2295 } 2131 2296 if (null_input_bfd) 2132 return true;2297 return TRUE; 2133 2298 2134 2299 /* Complain about various flag mismatches. */ … … 2136 2301 { 2137 2302 _bfd_error_handler (_("\ 2138 E rror: %s compiled for EABI version %d, whereas %s is compiled for version %d"),2139 bfd_get_filename (ibfd),2140 (in_flags & EF_ARM_EABIMASK) >> 24,2141 bfd_get_filename (obfd),2142 (out_flags & EF_ARM_EABIMASK) >> 24);2143 return false;2303 ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d"), 2304 bfd_archive_filename (ibfd), 2305 (in_flags & EF_ARM_EABIMASK) >> 24, 2306 bfd_get_filename (obfd), 2307 (out_flags & EF_ARM_EABIMASK) >> 24); 2308 return FALSE; 2144 2309 } 2145 2310 … … 2147 2312 if (EF_ARM_EABI_VERSION (in_flags) == EF_ARM_EABI_UNKNOWN) 2148 2313 { 2149 if ((in_flags & EF_A PCS_26) != (out_flags & EF_APCS_26))2314 if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26)) 2150 2315 { 2151 2316 _bfd_error_handler (_("\ 2152 Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d"), 2153 bfd_get_filename (ibfd), 2154 in_flags & EF_APCS_26 ? 26 : 32, 2155 bfd_get_filename (obfd), 2156 out_flags & EF_APCS_26 ? 26 : 32); 2157 flags_compatible = false; 2158 } 2159 2160 if ((in_flags & EF_APCS_FLOAT) != (out_flags & EF_APCS_FLOAT)) 2161 { 2162 _bfd_error_handler (_("\ 2163 Error: %s passes floats in %s registers, whereas %s passes them in %s registers"), 2164 bfd_get_filename (ibfd), 2165 in_flags & EF_APCS_FLOAT ? _("float") : _("integer"), 2166 bfd_get_filename (obfd), 2167 out_flags & EF_APCS_26 ? _("float") : _("integer")); 2168 flags_compatible = false; 2169 } 2170 2171 #ifdef EF_SOFT_FLOAT 2172 if ((in_flags & EF_SOFT_FLOAT) != (out_flags & EF_SOFT_FLOAT)) 2173 { 2174 _bfd_error_handler (_ ("\ 2175 Error: %s uses %s floating point, whereas %s uses %s floating point"), 2176 bfd_get_filename (ibfd), 2177 in_flags & EF_SOFT_FLOAT ? _("soft") : _("hard"), 2317 ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"), 2318 bfd_archive_filename (ibfd), 2319 in_flags & EF_ARM_APCS_26 ? 26 : 32, 2178 2320 bfd_get_filename (obfd), 2179 out_flags & EF_SOFT_FLOAT ? _("soft") : _("hard")); 2180 flags_compatible = false; 2321 out_flags & EF_ARM_APCS_26 ? 26 : 32); 2322 flags_compatible = FALSE; 2323 } 2324 2325 if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT)) 2326 { 2327 if (in_flags & EF_ARM_APCS_FLOAT) 2328 _bfd_error_handler (_("\ 2329 ERROR: %s passes floats in float registers, whereas %s passes them in integer registers"), 2330 bfd_archive_filename (ibfd), 2331 bfd_get_filename (obfd)); 2332 else 2333 _bfd_error_handler (_("\ 2334 ERROR: %s passes floats in integer registers, whereas %s passes them in float registers"), 2335 bfd_archive_filename (ibfd), 2336 bfd_get_filename (obfd)); 2337 2338 flags_compatible = FALSE; 2339 } 2340 2341 if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT)) 2342 { 2343 if (in_flags & EF_ARM_VFP_FLOAT) 2344 _bfd_error_handler (_("\ 2345 ERROR: %s uses VFP instructions, whereas %s does not"), 2346 bfd_archive_filename (ibfd), 2347 bfd_get_filename (obfd)); 2348 else 2349 _bfd_error_handler (_("\ 2350 ERROR: %s uses FPA instructions, whereas %s does not"), 2351 bfd_archive_filename (ibfd), 2352 bfd_get_filename (obfd)); 2353 2354 flags_compatible = FALSE; 2355 } 2356 2357 if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT)) 2358 { 2359 if (in_flags & EF_ARM_MAVERICK_FLOAT) 2360 _bfd_error_handler (_("\ 2361 ERROR: %s uses Maverick instructions, whereas %s does not"), 2362 bfd_archive_filename (ibfd), 2363 bfd_get_filename (obfd)); 2364 else 2365 _bfd_error_handler (_("\ 2366 ERROR: %s uses Maverick instructions, whereas %s does not"), 2367 bfd_archive_filename (ibfd), 2368 bfd_get_filename (obfd)); 2369 2370 flags_compatible = FALSE; 2371 } 2372 2373 #ifdef EF_ARM_SOFT_FLOAT 2374 if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT)) 2375 { 2376 /* We can allow interworking between code that is VFP format 2377 layout, and uses either soft float or integer regs for 2378 passing floating point arguments and results. We already 2379 know that the APCS_FLOAT flags match; similarly for VFP 2380 flags. */ 2381 if ((in_flags & EF_ARM_APCS_FLOAT) != 0 2382 || (in_flags & EF_ARM_VFP_FLOAT) == 0) 2383 { 2384 if (in_flags & EF_ARM_SOFT_FLOAT) 2385 _bfd_error_handler (_("\ 2386 ERROR: %s uses software FP, whereas %s uses hardware FP"), 2387 bfd_archive_filename (ibfd), 2388 bfd_get_filename (obfd)); 2389 else 2390 _bfd_error_handler (_("\ 2391 ERROR: %s uses hardware FP, whereas %s uses software FP"), 2392 bfd_archive_filename (ibfd), 2393 bfd_get_filename (obfd)); 2394 2395 flags_compatible = FALSE; 2396 } 2181 2397 } 2182 2398 #endif 2183 2399 2184 2400 /* Interworking mismatch is only a warning. */ 2185 if ((in_flags & EF_INTERWORK) != (out_flags & EF_INTERWORK)) 2186 _bfd_error_handler (_("\ 2187 Warning: %s %s interworking, whereas %s %s"), 2188 bfd_get_filename (ibfd), 2189 in_flags & EF_INTERWORK ? _("supports") : _("does not support"), 2190 bfd_get_filename (obfd), 2191 out_flags & EF_INTERWORK ? _("does not") : _("does")); 2401 if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK)) 2402 { 2403 if (in_flags & EF_ARM_INTERWORK) 2404 { 2405 _bfd_error_handler (_("\ 2406 Warning: %s supports interworking, whereas %s does not"), 2407 bfd_archive_filename (ibfd), 2408 bfd_get_filename (obfd)); 2409 } 2410 else 2411 { 2412 _bfd_error_handler (_("\ 2413 Warning: %s does not support interworking, whereas %s does"), 2414 bfd_archive_filename (ibfd), 2415 bfd_get_filename (obfd)); 2416 } 2417 } 2192 2418 } 2193 2419 … … 2197 2423 /* Display the flags field. */ 2198 2424 2199 static b oolean2425 static bfd_boolean 2200 2426 elf32_arm_print_private_bfd_data (abfd, ptr) 2201 2427 bfd *abfd; … … 2223 2449 official ARM ELF extended ABI. Hence they are only decoded if 2224 2450 the EABI version is not set. */ 2225 if (flags & EF_ INTERWORK)2451 if (flags & EF_ARM_INTERWORK) 2226 2452 fprintf (file, _(" [interworking enabled]")); 2227 2453 2228 if (flags & EF_A PCS_26)2229 fprintf (file, _(" [APCS-26]"));2454 if (flags & EF_ARM_APCS_26) 2455 fprintf (file, " [APCS-26]"); 2230 2456 else 2231 fprintf (file, _(" [APCS-32]")); 2232 2233 if (flags & EF_APCS_FLOAT) 2457 fprintf (file, " [APCS-32]"); 2458 2459 if (flags & EF_ARM_VFP_FLOAT) 2460 fprintf (file, _(" [VFP float format]")); 2461 else if (flags & EF_ARM_MAVERICK_FLOAT) 2462 fprintf (file, _(" [Maverick float format]")); 2463 else 2464 fprintf (file, _(" [FPA float format]")); 2465 2466 if (flags & EF_ARM_APCS_FLOAT) 2234 2467 fprintf (file, _(" [floats passed in float registers]")); 2235 2468 2236 if (flags & EF_ PIC)2469 if (flags & EF_ARM_PIC) 2237 2470 fprintf (file, _(" [position independent]")); 2238 2471 2239 if (flags & EF_ NEW_ABI)2472 if (flags & EF_ARM_NEW_ABI) 2240 2473 fprintf (file, _(" [new ABI]")); 2241 2474 2242 if (flags & EF_ OLD_ABI)2475 if (flags & EF_ARM_OLD_ABI) 2243 2476 fprintf (file, _(" [old ABI]")); 2244 2477 2245 if (flags & EF_ SOFT_FLOAT)2478 if (flags & EF_ARM_SOFT_FLOAT) 2246 2479 fprintf (file, _(" [software FP]")); 2247 2480 2248 flags &= ~(EF_INTERWORK | EF_APCS_26 | EF_APCS_FLOAT | EF_PIC 2249 | EF_NEW_ABI | EF_OLD_ABI | EF_SOFT_FLOAT); 2481 flags &= ~(EF_ARM_INTERWORK | EF_ARM_APCS_26 | EF_ARM_APCS_FLOAT 2482 | EF_ARM_PIC | EF_ARM_NEW_ABI | EF_ARM_OLD_ABI 2483 | EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT 2484 | EF_ARM_MAVERICK_FLOAT); 2250 2485 break; 2251 2486 … … 2261 2496 break; 2262 2497 2498 case EF_ARM_EABI_VER2: 2499 fprintf (file, _(" [Version2 EABI]")); 2500 2501 if (flags & EF_ARM_SYMSARESORTED) 2502 fprintf (file, _(" [sorted symbol table]")); 2503 else 2504 fprintf (file, _(" [unsorted symbol table]")); 2505 2506 if (flags & EF_ARM_DYNSYMSUSESEGIDX) 2507 fprintf (file, _(" [dynamic symbols use segment index]")); 2508 2509 if (flags & EF_ARM_MAPSYMSFIRST) 2510 fprintf (file, _(" [mapping symbols precede others]")); 2511 2512 flags &= ~(EF_ARM_SYMSARESORTED | EF_ARM_DYNSYMSUSESEGIDX 2513 | EF_ARM_MAPSYMSFIRST); 2514 break; 2515 2263 2516 default: 2264 2517 fprintf (file, _(" <EABI version unrecognised>")); … … 2281 2534 fputc ('\n', file); 2282 2535 2283 return true;2536 return TRUE; 2284 2537 } 2285 2538 … … 2311 2564 2312 2565 static asection * 2313 elf32_arm_gc_mark_hook ( abfd, info, rel, h, sym)2314 bfd *abfd;2566 elf32_arm_gc_mark_hook (sec, info, rel, h, sym) 2567 asection *sec; 2315 2568 struct bfd_link_info *info ATTRIBUTE_UNUSED; 2316 2569 Elf_Internal_Rela *rel; … … 2342 2595 } 2343 2596 else 2344 { 2345 if (!(elf_bad_symtab (abfd) 2346 && ELF_ST_BIND (sym->st_info) != STB_LOCAL) 2347 && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) 2348 && sym->st_shndx != SHN_COMMON)) 2349 { 2350 return bfd_section_from_elf_index (abfd, sym->st_shndx); 2351 } 2352 } 2597 return bfd_section_from_elf_index (sec->owner, sym->st_shndx); 2598 2353 2599 return NULL; 2354 2600 } … … 2356 2602 /* Update the got entry reference counts for the section being removed. */ 2357 2603 2358 static b oolean2604 static bfd_boolean 2359 2605 elf32_arm_gc_sweep_hook (abfd, info, sec, relocs) 2360 2606 bfd *abfd ATTRIBUTE_UNUSED; … … 2364 2610 { 2365 2611 /* We don't support garbage collection of GOT and PLT relocs yet. */ 2366 return true;2612 return TRUE; 2367 2613 } 2368 2614 2369 2615 /* Look through the relocs for a section during the first phase. */ 2370 2616 2371 static b oolean2617 static bfd_boolean 2372 2618 elf32_arm_check_relocs (abfd, info, sec, relocs) 2373 bfd * 2374 struct bfd_link_info * 2375 asection * 2376 const Elf_Internal_Rela * 2619 bfd *abfd; 2620 struct bfd_link_info *info; 2621 asection *sec; 2622 const Elf_Internal_Rela *relocs; 2377 2623 { 2378 Elf_Internal_Shdr * 2379 struct elf_link_hash_entry ** 2380 struct elf_link_hash_entry ** 2381 const Elf_Internal_Rela * 2382 const Elf_Internal_Rela * 2383 bfd * 2384 asection * 2385 bfd_vma * 2624 Elf_Internal_Shdr *symtab_hdr; 2625 struct elf_link_hash_entry **sym_hashes; 2626 struct elf_link_hash_entry **sym_hashes_end; 2627 const Elf_Internal_Rela *rel; 2628 const Elf_Internal_Rela *rel_end; 2629 bfd *dynobj; 2630 asection *sgot, *srelgot, *sreloc; 2631 bfd_vma *local_got_offsets; 2386 2632 2387 2633 if (info->relocateable) 2388 return true;2634 return TRUE; 2389 2635 2390 2636 sgot = srelgot = sreloc = NULL; … … 2423 2669 elf_hash_table (info)->dynobj = dynobj = abfd; 2424 2670 if (! _bfd_elf_create_got_section (dynobj, info)) 2425 return false;2671 return FALSE; 2426 2672 break; 2427 2673 … … 2453 2699 if (srelgot == NULL 2454 2700 || ! bfd_set_section_flags (dynobj, srelgot, 2455 2701 (SEC_ALLOC 2456 2702 | SEC_LOAD 2457 2703 | SEC_HAS_CONTENTS … … 2460 2706 | SEC_READONLY)) 2461 2707 || ! bfd_set_section_alignment (dynobj, srelgot, 2)) 2462 return false;2708 return FALSE; 2463 2709 } 2464 2710 } … … 2475 2721 if (h->dynindx == -1) 2476 2722 if (! bfd_elf32_link_record_dynamic_symbol (info, h)) 2477 return false;2723 return FALSE; 2478 2724 2479 2725 srelgot->_raw_size += sizeof (Elf32_External_Rel); … … 2481 2727 else 2482 2728 { 2483 2729 /* This is a global offset table entry for a local 2484 2730 symbol. */ 2485 2731 if (local_got_offsets == NULL) 2486 2732 { 2487 size_t size; 2488 register unsigned int i; 2489 2490 size = symtab_hdr->sh_info * sizeof (bfd_vma); 2733 bfd_size_type size; 2734 unsigned int i; 2735 2736 size = symtab_hdr->sh_info; 2737 size *= sizeof (bfd_vma); 2491 2738 local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); 2492 2739 if (local_got_offsets == NULL) 2493 return false;2740 return FALSE; 2494 2741 elf_local_got_offsets (abfd) = local_got_offsets; 2495 2742 for (i = 0; i < symtab_hdr->sh_info; i++) … … 2513 2760 break; 2514 2761 2515 2762 case R_ARM_PLT32: 2516 2763 /* This symbol requires a procedure linkage table entry. We 2517 2764 actually build the entry in adjust_dynamic_symbol, … … 2563 2810 elf_section_data (sec)->rel_hdr.sh_name)); 2564 2811 if (name == NULL) 2565 return false;2812 return FALSE; 2566 2813 2567 2814 BFD_ASSERT (strncmp (name, ".rel", 4) == 0 2568 2815 && strcmp (bfd_get_section_name (abfd, sec), 2569 2816 name + 4) == 0); 2570 2817 … … 2582 2829 || ! bfd_set_section_flags (dynobj, sreloc, flags) 2583 2830 || ! bfd_set_section_alignment (dynobj, sreloc, 2)) 2584 return false;2831 return FALSE; 2585 2832 } 2833 if (sec->flags & SEC_READONLY) 2834 info->flags |= DF_TEXTREL; 2586 2835 } 2587 2836 … … 2610 2859 { 2611 2860 p = ((struct elf32_arm_pcrel_relocs_copied *) 2612 bfd_alloc (dynobj, sizeof * p)); 2613 2861 bfd_alloc (dynobj, (bfd_size_type) sizeof * p)); 2614 2862 if (p == NULL) 2615 return false;2863 return FALSE; 2616 2864 p->next = eh->pcrel_relocs_copied; 2617 2865 eh->pcrel_relocs_copied = p; … … 2629 2877 case R_ARM_GNU_VTINHERIT: 2630 2878 if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) 2631 return false;2879 return FALSE; 2632 2880 break; 2633 2881 … … 2636 2884 case R_ARM_GNU_VTENTRY: 2637 2885 if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset)) 2638 return false;2886 return FALSE; 2639 2887 break; 2640 2888 } 2641 2889 } 2642 2890 2643 return true;2891 return TRUE; 2644 2892 } 2645 2893 … … 2648 2896 that it also accepts STT_ARM_TFUNC as a symbol that names a function. */ 2649 2897 2650 static b oolean2898 static bfd_boolean 2651 2899 elf32_arm_find_nearest_line 2652 2900 (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr) 2653 bfd * 2654 asection * 2655 asymbol ** 2656 bfd_vma 2657 CONST char **filename_ptr;2658 CONST char **functionname_ptr;2659 unsigned int * 2901 bfd *abfd; 2902 asection *section; 2903 asymbol **symbols; 2904 bfd_vma offset; 2905 const char **filename_ptr; 2906 const char **functionname_ptr; 2907 unsigned int *line_ptr; 2660 2908 { 2661 b ooleanfound;2662 const char * 2663 asymbol * 2664 bfd_vma 2665 asymbol ** 2909 bfd_boolean found; 2910 const char *filename; 2911 asymbol *func; 2912 bfd_vma low_func; 2913 asymbol **p; 2666 2914 2667 2915 if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, … … 2669 2917 line_ptr, 0, 2670 2918 &elf_tdata (abfd)->dwarf2_find_line_info)) 2671 return true;2919 return TRUE; 2672 2920 2673 2921 if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, … … 2675 2923 functionname_ptr, line_ptr, 2676 2924 &elf_tdata (abfd)->line_info)) 2677 return false;2925 return FALSE; 2678 2926 2679 2927 if (found) 2680 return true;2928 return TRUE; 2681 2929 2682 2930 if (symbols == NULL) 2683 return false;2931 return FALSE; 2684 2932 2685 2933 filename = NULL; … … 2718 2966 2719 2967 if (func == NULL) 2720 return false;2968 return FALSE; 2721 2969 2722 2970 *filename_ptr = filename; … … 2724 2972 *line_ptr = 0; 2725 2973 2726 return true;2974 return TRUE; 2727 2975 } 2728 2976 … … 2733 2981 understand. */ 2734 2982 2735 static b oolean2983 static bfd_boolean 2736 2984 elf32_arm_adjust_dynamic_symbol (info, h) 2737 2985 struct bfd_link_info * info; … … 2761 3009 || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) 2762 3010 { 3011 /* If we link a program (not a DSO), we'll get rid of unnecessary 3012 PLT entries; we point to the actual symbols -- even for pic 3013 relocs, because a program built with -fpic should have the same 3014 result as one built without -fpic, specifically considering weak 3015 symbols. 3016 FIXME: m68k and i386 differ here, for unclear reasons. */ 2763 3017 if (! info->shared 2764 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 2765 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) 3018 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0) 2766 3019 { 2767 3020 /* This case can occur if we saw a PLT32 reloc in an input 2768 file, but the symbol was never referred to by a dynamic 2769 object. In such a case, we don't actually need to build 2770 a procedure linkage table, and we can just do a PC32 2771 relocinstead. */3021 file, but the symbol was not defined by a dynamic object. 3022 In such a case, we don't actually need to build a 3023 procedure linkage table, and we can just do a PC32 reloc 3024 instead. */ 2772 3025 BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); 2773 return true; 3026 h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; 3027 return TRUE; 2774 3028 } 2775 3029 … … 2778 3032 { 2779 3033 if (! bfd_elf32_link_record_dynamic_symbol (info, h)) 2780 return false;3034 return FALSE; 2781 3035 } 2782 3036 … … 2818 3072 s->_raw_size += sizeof (Elf32_External_Rel); 2819 3073 2820 return true;3074 return TRUE; 2821 3075 } 2822 3076 … … 2830 3084 h->root.u.def.section = h->weakdef->root.u.def.section; 2831 3085 h->root.u.def.value = h->weakdef->root.u.def.value; 2832 return true;3086 return TRUE; 2833 3087 } 2834 3088 … … 2841 3095 be handled correctly by relocate_section. */ 2842 3096 if (info->shared) 2843 return true;3097 return TRUE; 2844 3098 2845 3099 /* We must allocate the symbol in our .dynbss section, which will … … 2881 3135 { 2882 3136 if (! bfd_set_section_alignment (dynobj, s, power_of_two)) 2883 return false;3137 return FALSE; 2884 3138 } 2885 3139 … … 2891 3145 s->_raw_size += h->size; 2892 3146 2893 return true;3147 return TRUE; 2894 3148 } 2895 3149 2896 3150 /* Set the sizes of the dynamic sections. */ 2897 3151 2898 static b oolean3152 static bfd_boolean 2899 3153 elf32_arm_size_dynamic_sections (output_bfd, info) 2900 bfd * output_bfd ;3154 bfd * output_bfd ATTRIBUTE_UNUSED; 2901 3155 struct bfd_link_info * info; 2902 3156 { 2903 3157 bfd * dynobj; 2904 3158 asection * s; 2905 boolean plt; 2906 boolean relocs; 2907 boolean reltext; 3159 bfd_boolean plt; 3160 bfd_boolean relocs; 2908 3161 2909 3162 dynobj = elf_hash_table (info)->dynobj; … … 2945 3198 determined the sizes of the various dynamic sections. Allocate 2946 3199 memory for them. */ 2947 plt = false; 2948 relocs = false; 2949 reltext = false; 3200 plt = FALSE; 3201 relocs = FALSE; 2950 3202 for (s = dynobj->sections; s != NULL; s = s->next) 2951 3203 { 2952 3204 const char * name; 2953 b oolean strip;3205 bfd_boolean strip; 2954 3206 2955 3207 if ((s->flags & SEC_LINKER_CREATED) == 0) … … 2960 3212 name = bfd_get_section_name (dynobj, s); 2961 3213 2962 strip = false;3214 strip = FALSE; 2963 3215 2964 3216 if (strcmp (name, ".plt") == 0) … … 2968 3220 /* Strip this section if we don't need it; see the 2969 3221 comment below. */ 2970 strip = true;3222 strip = TRUE; 2971 3223 } 2972 3224 else 2973 3225 { 2974 3226 /* Remember whether there is a PLT. */ 2975 plt = true;3227 plt = TRUE; 2976 3228 } 2977 3229 } … … 2989 3241 function which decides whether anything needs to go 2990 3242 into these sections. */ 2991 strip = true;3243 strip = TRUE; 2992 3244 } 2993 3245 else 2994 3246 { 2995 asection * target;2996 2997 3247 /* Remember whether there are any reloc sections other 2998 3248 than .rel.plt. */ 2999 3249 if (strcmp (name, ".rel.plt") != 0) 3000 { 3001 const char *outname; 3002 3003 relocs = true; 3004 3005 /* If this relocation section applies to a read only 3006 section, then we probably need a DT_TEXTREL 3007 entry. The entries in the .rel.plt section 3008 really apply to the .got section, which we 3009 created ourselves and so know is not readonly. */ 3010 outname = bfd_get_section_name (output_bfd, 3011 s->output_section); 3012 target = bfd_get_section_by_name (output_bfd, outname + 4); 3013 3014 if (target != NULL 3015 && (target->flags & SEC_READONLY) != 0 3016 && (target->flags & SEC_ALLOC) != 0) 3017 reltext = true; 3018 } 3250 relocs = TRUE; 3019 3251 3020 3252 /* We use the reloc_count field as a counter if we need … … 3031 3263 if (strip) 3032 3264 { 3033 asection ** spp; 3034 3035 for (spp = &s->output_section->owner->sections; 3036 *spp != s->output_section; 3037 spp = &(*spp)->next) 3038 ; 3039 *spp = s->output_section->next; 3040 --s->output_section->owner->section_count; 3041 3265 _bfd_strip_section_from_output (info, s); 3042 3266 continue; 3043 3267 } … … 3046 3270 s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); 3047 3271 if (s->contents == NULL && s->_raw_size != 0) 3048 return false;3272 return FALSE; 3049 3273 } 3050 3274 … … 3056 3280 the .dynamic section. The DT_DEBUG entry is filled in by the 3057 3281 dynamic linker and used by the debugger. */ 3058 if (! info->shared) 3059 { 3060 if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) 3061 return false; 3282 #define add_dynamic_entry(TAG, VAL) \ 3283 bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) 3284 3285 if (!info->shared) 3286 { 3287 if (!add_dynamic_entry (DT_DEBUG, 0)) 3288 return FALSE; 3062 3289 } 3063 3290 3064 3291 if (plt) 3065 3292 { 3066 if ( ! bfd_elf32_add_dynamic_entry (info,DT_PLTGOT, 0)3067 || ! bfd_elf32_add_dynamic_entry (info,DT_PLTRELSZ, 0)3068 || ! bfd_elf32_add_dynamic_entry (info,DT_PLTREL, DT_REL)3069 || ! bfd_elf32_add_dynamic_entry (info,DT_JMPREL, 0))3070 return false;3293 if ( !add_dynamic_entry (DT_PLTGOT, 0) 3294 || !add_dynamic_entry (DT_PLTRELSZ, 0) 3295 || !add_dynamic_entry (DT_PLTREL, DT_REL) 3296 || !add_dynamic_entry (DT_JMPREL, 0)) 3297 return FALSE; 3071 3298 } 3072 3299 3073 3300 if (relocs) 3074 3301 { 3075 if ( ! bfd_elf32_add_dynamic_entry (info, DT_REL, 0) 3076 || ! bfd_elf32_add_dynamic_entry (info, DT_RELSZ, 0) 3077 || ! bfd_elf32_add_dynamic_entry (info, DT_RELENT, 3078 sizeof (Elf32_External_Rel))) 3079 return false; 3080 } 3081 3082 if (reltext) 3083 { 3084 if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) 3085 return false; 3302 if ( !add_dynamic_entry (DT_REL, 0) 3303 || !add_dynamic_entry (DT_RELSZ, 0) 3304 || !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel))) 3305 return FALSE; 3306 } 3307 3308 if ((info->flags & DF_TEXTREL) != 0) 3309 { 3310 if (!add_dynamic_entry (DT_TEXTREL, 0)) 3311 return FALSE; 3086 3312 info->flags |= DF_TEXTREL; 3087 3313 } 3088 3314 } 3089 3090 return true; 3315 #undef add_synamic_entry 3316 3317 return TRUE; 3091 3318 } 3092 3319 … … 3098 3325 relocate_section routine. */ 3099 3326 3100 static b oolean3327 static bfd_boolean 3101 3328 elf32_arm_discard_copies (h, ignore) 3102 3329 struct elf32_arm_link_hash_entry * h; … … 3105 3332 struct elf32_arm_pcrel_relocs_copied * s; 3106 3333 3334 if (h->root.root.type == bfd_link_hash_warning) 3335 h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link; 3336 3107 3337 /* We only discard relocs for symbols defined in a regular object. */ 3108 3338 if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) 3109 return true;3339 return TRUE; 3110 3340 3111 3341 for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) 3112 3342 s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel); 3113 3343 3114 return true;3344 return TRUE; 3115 3345 } 3116 3346 … … 3118 3348 dynamic sections here. */ 3119 3349 3120 static b oolean3350 static bfd_boolean 3121 3351 elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym) 3122 3352 bfd * output_bfd; … … 3136 3366 bfd_vma plt_index; 3137 3367 bfd_vma got_offset; 3138 Elf_Internal_Rel rel; 3368 Elf_Internal_Rela rel; 3369 bfd_byte *loc; 3139 3370 3140 3371 /* This symbol has an entry in the procedure linkage table. Set … … 3186 3417 + got_offset); 3187 3418 rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_JUMP_SLOT); 3188 bfd_elf32_swap_reloc_out (output_bfd, &rel, 3189 ((Elf32_External_Rel *) srel->contents 3190 + plt_index)); 3419 loc = srel->contents + plt_index * sizeof (Elf32_External_Rel); 3420 bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); 3191 3421 3192 3422 if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) … … 3209 3439 asection * sgot; 3210 3440 asection * srel; 3211 Elf_Internal_Rel rel; 3441 Elf_Internal_Rela rel; 3442 bfd_byte *loc; 3212 3443 3213 3444 /* This symbol has an entry in the global offset table. Set it … … 3219 3450 rel.r_offset = (sgot->output_section->vma 3220 3451 + sgot->output_offset 3221 + (h->got.offset &~ 1));3452 + (h->got.offset &~ (bfd_vma) 1)); 3222 3453 3223 3454 /* If this is a -Bsymbolic link, and the symbol is defined … … 3235 3466 } 3236 3467 3237 bfd_elf32_swap_reloc_out (output_bfd, &rel, 3238 ((Elf32_External_Rel *) srel->contents 3239 + srel->reloc_count)); 3240 ++srel->reloc_count; 3468 loc = srel->contents + srel->reloc_count++ * sizeof (Elf32_External_Rel); 3469 bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); 3241 3470 } 3242 3471 … … 3244 3473 { 3245 3474 asection * s; 3246 Elf_Internal_Rel rel; 3475 Elf_Internal_Rela rel; 3476 bfd_byte *loc; 3247 3477 3248 3478 /* This symbol needs a copy reloc. Set it up. */ … … 3259 3489 + h->root.u.def.section->output_offset); 3260 3490 rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_COPY); 3261 bfd_elf32_swap_reloc_out (output_bfd, &rel, 3262 ((Elf32_External_Rel *) s->contents 3263 + s->reloc_count)); 3264 ++s->reloc_count; 3491 loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rel); 3492 bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); 3265 3493 } 3266 3494 … … 3270 3498 sym->st_shndx = SHN_ABS; 3271 3499 3272 return true;3500 return TRUE; 3273 3501 } 3274 3502 3275 3503 /* Finish up the dynamic sections. */ 3276 3504 3277 static b oolean3505 static bfd_boolean 3278 3506 elf32_arm_finish_dynamic_sections (output_bfd, info) 3279 3507 bfd * output_bfd; … … 3356 3584 bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); 3357 3585 break; 3586 3587 /* Set the bottom bit of DT_INIT/FINI if the 3588 corresponding function is Thumb. */ 3589 case DT_INIT: 3590 name = info->init_function; 3591 goto get_sym; 3592 case DT_FINI: 3593 name = info->fini_function; 3594 get_sym: 3595 /* If it wasn't set by elf_bfd_final_link 3596 then there is nothing to ajdust. */ 3597 if (dyn.d_un.d_val != 0) 3598 { 3599 struct elf_link_hash_entry * eh; 3600 3601 eh = elf_link_hash_lookup (elf_hash_table (info), name, 3602 FALSE, FALSE, TRUE); 3603 if (eh != (struct elf_link_hash_entry *) NULL 3604 && ELF_ST_TYPE (eh->type) == STT_ARM_TFUNC) 3605 { 3606 dyn.d_un.d_val |= 1; 3607 bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); 3608 } 3609 } 3610 break; 3358 3611 } 3359 3612 } … … 3388 3641 elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; 3389 3642 3390 return true;3643 return TRUE; 3391 3644 } 3392 3645 … … 3404 3657 } 3405 3658 3659 static enum elf_reloc_type_class 3660 elf32_arm_reloc_type_class (rela) 3661 const Elf_Internal_Rela *rela; 3662 { 3663 switch ((int) ELF32_R_TYPE (rela->r_info)) 3664 { 3665 case R_ARM_RELATIVE: 3666 return reloc_class_relative; 3667 case R_ARM_JUMP_SLOT: 3668 return reloc_class_plt; 3669 case R_ARM_COPY: 3670 return reloc_class_copy; 3671 default: 3672 return reloc_class_normal; 3673 } 3674 } 3675 3676 static bfd_boolean elf32_arm_section_flags PARAMS ((flagword *, Elf_Internal_Shdr *)); 3677 static void elf32_arm_final_write_processing PARAMS ((bfd *, bfd_boolean)); 3678 3679 /* Set the right machine number for an Arm ELF file. */ 3680 3681 static bfd_boolean 3682 elf32_arm_section_flags (flags, hdr) 3683 flagword *flags; 3684 Elf_Internal_Shdr *hdr; 3685 { 3686 if (hdr->sh_type == SHT_NOTE) 3687 *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS; 3688 3689 return TRUE; 3690 } 3691 3692 void 3693 elf32_arm_final_write_processing (abfd, linker) 3694 bfd *abfd; 3695 bfd_boolean linker ATTRIBUTE_UNUSED; 3696 { 3697 bfd_arm_update_notes (abfd, ARM_NOTE_SECTION); 3698 } 3699 3406 3700 #define ELF_ARCH bfd_arch_arm 3407 3701 #define ELF_MACHINE_CODE EM_ARM 3408 3702 #define ELF_MAXPAGESIZE 0x8000 3409 3703 3410 #define bfd_elf32_bfd_copy_private_bfd_data 3411 #define bfd_elf32_bfd_merge_private_bfd_data 3704 #define bfd_elf32_bfd_copy_private_bfd_data elf32_arm_copy_private_bfd_data 3705 #define bfd_elf32_bfd_merge_private_bfd_data elf32_arm_merge_private_bfd_data 3412 3706 #define bfd_elf32_bfd_set_private_flags elf32_arm_set_private_flags 3413 3707 #define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data 3414 3708 #define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create 3415 #define bfd_elf32_bfd_reloc_type_lookup 3709 #define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup 3416 3710 #define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line 3417 3711 … … 3420 3714 #define elf_backend_gc_sweep_hook elf32_arm_gc_sweep_hook 3421 3715 #define elf_backend_check_relocs elf32_arm_check_relocs 3422 #define elf_backend_relocate_section 3716 #define elf_backend_relocate_section elf32_arm_relocate_section 3423 3717 #define elf_backend_adjust_dynamic_symbol elf32_arm_adjust_dynamic_symbol 3424 3718 #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections … … 3427 3721 #define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections 3428 3722 #define elf_backend_post_process_headers elf32_arm_post_process_headers 3723 #define elf_backend_reloc_type_class elf32_arm_reloc_type_class 3724 #define elf_backend_object_p elf32_arm_object_p 3725 #define elf_backend_section_flags elf32_arm_section_flags 3726 #define elf_backend_final_write_processing elf32_arm_final_write_processing 3429 3727 3430 3728 #define elf_backend_can_gc_sections 1 … … 3432 3730 #define elf_backend_want_got_plt 1 3433 3731 #define elf_backend_want_plt_sym 0 3732 #if !USE_REL 3733 #define elf_backend_rela_normal 1 3734 #endif 3434 3735 3435 3736 #define elf_backend_got_header_size 12 … … 3437 3738 3438 3739 #include "elf32-target.h" 3740 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.