elf64-alpha.c (89862) | elf64-alpha.c (91049) |
---|---|
1/* Alpha specific support for 64-bit ELF 2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 3 Free Software Foundation, Inc. 4 Contributed by Richard Henderson <rth@tamu.edu>. 5 6This file is part of BFD, the Binary File Descriptor library. 7 8This program is free software; you can redistribute it and/or modify --- 5 unchanged lines hidden (view full) --- 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License 19along with this program; if not, write to the Free Software 20Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 21 | 1/* Alpha specific support for 64-bit ELF 2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 3 Free Software Foundation, Inc. 4 Contributed by Richard Henderson <rth@tamu.edu>. 5 6This file is part of BFD, the Binary File Descriptor library. 7 8This program is free software; you can redistribute it and/or modify --- 5 unchanged lines hidden (view full) --- 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License 19along with this program; if not, write to the Free Software 20Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 21 |
22/* $FreeBSD: head/contrib/binutils/bfd/elf64-alpha.c 89862 2002-01-27 12:08:15Z obrien $ */ | 22/* $FreeBSD: head/contrib/binutils/bfd/elf64-alpha.c 91049 2002-02-22 04:46:20Z obrien $ */ |
23 24/* We need a published ABI spec for this. Until one comes out, don't 25 assume this'll remain unchanged forever. */ 26 27#include "bfd.h" 28#include "sysdep.h" 29#include "libbfd.h" 30#include "elf-bfd.h" --- 698 unchanged lines hidden (view full) --- 729 false, 730 0, 731 complain_overflow_dont, 732 bfd_elf_generic_reloc, 733 "RELATIVE", 734 false, 735 0, 736 0, | 23 24/* We need a published ABI spec for this. Until one comes out, don't 25 assume this'll remain unchanged forever. */ 26 27#include "bfd.h" 28#include "sysdep.h" 29#include "libbfd.h" 30#include "elf-bfd.h" --- 698 unchanged lines hidden (view full) --- 729 false, 730 0, 731 complain_overflow_dont, 732 bfd_elf_generic_reloc, 733 "RELATIVE", 734 false, 735 0, 736 0, |
737 true) | 737 true), 738 739 /* A 21 bit branch that adjusts for gp loads. */ 740 HOWTO (R_ALPHA_BRSGP, /* type */ 741 2, /* rightshift */ 742 2, /* size (0 = byte, 1 = short, 2 = long) */ 743 21, /* bitsize */ 744 true, /* pc_relative */ 745 0, /* bitpos */ 746 complain_overflow_signed, /* complain_on_overflow */ 747 0, /* special_function */ 748 "BRSGP", /* name */ 749 false, /* partial_inplace */ 750 0x1fffff, /* src_mask */ 751 0x1fffff, /* dst_mask */ 752 true), /* pcrel_offset */ |
738}; 739 740/* A relocation function which doesn't do anything. */ 741 742static bfd_reloc_status_type 743elf64_alpha_reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) 744 bfd *abfd ATTRIBUTE_UNUSED; 745 arelent *reloc; --- 137 unchanged lines hidden (view full) --- 883 {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR}, 884 {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT}, 885 {BFD_RELOC_16_PCREL, R_ALPHA_SREL16}, 886 {BFD_RELOC_32_PCREL, R_ALPHA_SREL32}, 887 {BFD_RELOC_64_PCREL, R_ALPHA_SREL64}, 888 {BFD_RELOC_ALPHA_GPREL_HI16, R_ALPHA_GPRELHIGH}, 889 {BFD_RELOC_ALPHA_GPREL_LO16, R_ALPHA_GPRELLOW}, 890 {BFD_RELOC_GPREL16, R_ALPHA_GPREL16}, | 753}; 754 755/* A relocation function which doesn't do anything. */ 756 757static bfd_reloc_status_type 758elf64_alpha_reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) 759 bfd *abfd ATTRIBUTE_UNUSED; 760 arelent *reloc; --- 137 unchanged lines hidden (view full) --- 898 {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR}, 899 {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT}, 900 {BFD_RELOC_16_PCREL, R_ALPHA_SREL16}, 901 {BFD_RELOC_32_PCREL, R_ALPHA_SREL32}, 902 {BFD_RELOC_64_PCREL, R_ALPHA_SREL64}, 903 {BFD_RELOC_ALPHA_GPREL_HI16, R_ALPHA_GPRELHIGH}, 904 {BFD_RELOC_ALPHA_GPREL_LO16, R_ALPHA_GPRELLOW}, 905 {BFD_RELOC_GPREL16, R_ALPHA_GPREL16}, |
906 {BFD_RELOC_ALPHA_BRSGP, R_ALPHA_BRSGP}, |
|
891}; 892 893/* Given a BFD reloc type, return a HOWTO structure. */ 894 895static reloc_howto_type * 896elf64_alpha_bfd_reloc_type_lookup (abfd, code) 897 bfd *abfd ATTRIBUTE_UNUSED; 898 bfd_reloc_code_real_type code; --- 1514 unchanged lines hidden (view full) --- 2413 } 2414 /* FALLTHRU */ 2415 2416 case R_ALPHA_GPDISP: 2417 case R_ALPHA_GPREL16: 2418 case R_ALPHA_GPREL32: 2419 case R_ALPHA_GPRELHIGH: 2420 case R_ALPHA_GPRELLOW: | 907}; 908 909/* Given a BFD reloc type, return a HOWTO structure. */ 910 911static reloc_howto_type * 912elf64_alpha_bfd_reloc_type_lookup (abfd, code) 913 bfd *abfd ATTRIBUTE_UNUSED; 914 bfd_reloc_code_real_type code; --- 1514 unchanged lines hidden (view full) --- 2429 } 2430 /* FALLTHRU */ 2431 2432 case R_ALPHA_GPDISP: 2433 case R_ALPHA_GPREL16: 2434 case R_ALPHA_GPREL32: 2435 case R_ALPHA_GPRELHIGH: 2436 case R_ALPHA_GPRELLOW: |
2437 case R_ALPHA_BRSGP: |
|
2421 /* We don't actually use the .got here, but the sections must 2422 be created before the linker maps input sections to output 2423 sections. */ 2424 if (!got_created) 2425 { 2426 if (!elf64_alpha_create_got_section (abfd, info)) 2427 return false; 2428 --- 1125 unchanged lines hidden (view full) --- 3554 /* FALLTHRU */ 3555 3556 case R_ALPHA_BRADDR: 3557 /* The regular PC-relative stuff measures from the start of 3558 the instruction rather than the end. */ 3559 addend -= 4; 3560 goto default_reloc; 3561 | 2438 /* We don't actually use the .got here, but the sections must 2439 be created before the linker maps input sections to output 2440 sections. */ 2441 if (!got_created) 2442 { 2443 if (!elf64_alpha_create_got_section (abfd, info)) 2444 return false; 2445 --- 1125 unchanged lines hidden (view full) --- 3571 /* FALLTHRU */ 3572 3573 case R_ALPHA_BRADDR: 3574 /* The regular PC-relative stuff measures from the start of 3575 the instruction rather than the end. */ 3576 addend -= 4; 3577 goto default_reloc; 3578 |
3579 case R_ALPHA_BRSGP: 3580 { 3581 int other; 3582 const char *name; 3583 3584 /* The regular PC-relative stuff measures from the start of 3585 the instruction rather than the end. */ 3586 addend -= 4; 3587 3588 /* The source and destination gp must be the same. Note that 3589 the source will always have an assigned gp, since we forced 3590 one in check_relocs, but that the destination may not, as 3591 it might not have had any relocations at all. Also take 3592 care not to crash if H is an undefined symbol. */ 3593 if (h != NULL && sec != NULL 3594 && alpha_elf_tdata (sec->owner)->gotobj 3595 && gotobj != alpha_elf_tdata (sec->owner)->gotobj) 3596 { 3597 (*_bfd_error_handler) 3598 (_("%s: change in gp: BRSGP %s"), 3599 bfd_archive_filename (input_bfd), h->root.root.root.string); 3600 ret_val = false; 3601 } 3602 3603 /* The symbol should be marked either NOPV or STD_GPLOAD. */ 3604 if (h != NULL) 3605 other = h->root.other; 3606 else 3607 other = sym->st_other; 3608 switch (other & STO_ALPHA_STD_GPLOAD) 3609 { 3610 case STO_ALPHA_NOPV: 3611 break; 3612 case STO_ALPHA_STD_GPLOAD: 3613 addend += 8; 3614 break; 3615 default: 3616 if (h != NULL) 3617 name = h->root.root.root.string; 3618 else 3619 { 3620 name = (bfd_elf_string_from_elf_section 3621 (input_bfd, symtab_hdr->sh_link, sym->st_name)); 3622 if (name == NULL) 3623 name = _("<unknown>"); 3624 else if (name[0] == 0) 3625 name = bfd_section_name (input_bfd, sec); 3626 } 3627 (*_bfd_error_handler) 3628 (_("%s: !samegp reloc against symbol without .prologue: %s"), 3629 bfd_archive_filename (input_bfd), name); 3630 ret_val = false; 3631 break; 3632 } 3633 3634 goto default_reloc; 3635 } 3636 |
|
3562 case R_ALPHA_REFLONG: 3563 case R_ALPHA_REFQUAD: 3564 { 3565 Elf_Internal_Rela outrel; 3566 3567 /* Careful here to remember RELATIVE relocations for global 3568 variables for symbolic shared objects. */ 3569 --- 25 unchanged lines hidden (view full) --- 3595 3596 srel = bfd_get_section_by_name (dynobj, name); 3597 BFD_ASSERT(srel != NULL); 3598 } 3599 3600 outrel.r_offset = 3601 _bfd_elf_section_offset (output_bfd, info, input_section, 3602 rel->r_offset); | 3637 case R_ALPHA_REFLONG: 3638 case R_ALPHA_REFQUAD: 3639 { 3640 Elf_Internal_Rela outrel; 3641 3642 /* Careful here to remember RELATIVE relocations for global 3643 variables for symbolic shared objects. */ 3644 --- 25 unchanged lines hidden (view full) --- 3670 3671 srel = bfd_get_section_by_name (dynobj, name); 3672 BFD_ASSERT(srel != NULL); 3673 } 3674 3675 outrel.r_offset = 3676 _bfd_elf_section_offset (output_bfd, info, input_section, 3677 rel->r_offset); |
3603 if (outrel.r_offset != (bfd_vma) -1) | 3678 if ((outrel.r_offset | 1) != (bfd_vma) -1) |
3604 outrel.r_offset += (input_section->output_section->vma 3605 + input_section->output_offset); 3606 else 3607 memset (&outrel, 0, sizeof outrel); 3608 3609 bfd_elf64_swap_reloca_out (output_bfd, &outrel, 3610 ((Elf64_External_Rela *) 3611 srel->contents) --- 737 unchanged lines hidden --- | 3679 outrel.r_offset += (input_section->output_section->vma 3680 + input_section->output_offset); 3681 else 3682 memset (&outrel, 0, sizeof outrel); 3683 3684 bfd_elf64_swap_reloca_out (output_bfd, &outrel, 3685 ((Elf64_External_Rela *) 3686 srel->contents) --- 737 unchanged lines hidden --- |