OLD | NEW |
1 /* 32-bit ELF support for S+core. | 1 /* 32-bit ELF support for S+core. |
2 Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc. | 2 Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc. |
3 Contributed by | 3 Contributed by |
4 Brain.lin (brain.lin@sunplusct.com) | 4 Brain.lin (brain.lin@sunplusct.com) |
5 Mei Ligang (ligang@sunnorth.com.cn) | 5 Mei Ligang (ligang@sunnorth.com.cn) |
6 Pei-Lin Tsai (pltsai@sunplus.com) | 6 Pei-Lin Tsai (pltsai@sunplus.com) |
7 | 7 |
8 This file is part of BFD, the Binary File Descriptor library. | 8 This file is part of BFD, the Binary File Descriptor library. |
9 | 9 |
10 This program is free software; you can redistribute it and/or modify | 10 This program is free software; you can redistribute it and/or modify |
(...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2634 } | 2634 } |
2635 else | 2635 else |
2636 { | 2636 { |
2637 h = sym_hashes[r_symndx - extsymoff]; | 2637 h = sym_hashes[r_symndx - extsymoff]; |
2638 | 2638 |
2639 /* This may be an indirect symbol created because of a version. */ | 2639 /* This may be an indirect symbol created because of a version. */ |
2640 if (h != NULL) | 2640 if (h != NULL) |
2641 { | 2641 { |
2642 while (h->root.type == bfd_link_hash_indirect) | 2642 while (h->root.type == bfd_link_hash_indirect) |
2643 h = (struct elf_link_hash_entry *) h->root.u.i.link; | 2643 h = (struct elf_link_hash_entry *) h->root.u.i.link; |
| 2644 |
| 2645 /* PR15323, ref flags aren't set for references in the |
| 2646 same object. */ |
| 2647 h->root.non_ir_ref = 1; |
2644 } | 2648 } |
2645 } | 2649 } |
2646 | 2650 |
2647 /* Some relocs require a global offset table. */ | 2651 /* Some relocs require a global offset table. */ |
2648 if (dynobj == NULL || sgot == NULL) | 2652 if (dynobj == NULL || sgot == NULL) |
2649 { | 2653 { |
2650 switch (r_type) | 2654 switch (r_type) |
2651 { | 2655 { |
2652 case R_SCORE_GOT15: | 2656 case R_SCORE_GOT15: |
2653 case R_SCORE_CALL15: | 2657 case R_SCORE_CALL15: |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3338 bfd_vma offset; | 3342 bfd_vma offset; |
3339 bfd_vma value; | 3343 bfd_vma value; |
3340 | 3344 |
3341 value = sym->st_value; | 3345 value = sym->st_value; |
3342 offset = score_elf_global_got_index (dynobj, h); | 3346 offset = score_elf_global_got_index (dynobj, h); |
3343 bfd_put_32 (output_bfd, value, sgot->contents + offset); | 3347 bfd_put_32 (output_bfd, value, sgot->contents + offset); |
3344 } | 3348 } |
3345 | 3349 |
3346 /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ | 3350 /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ |
3347 name = h->root.root.string; | 3351 name = h->root.root.string; |
3348 if (strcmp (name, "_DYNAMIC") == 0 || strcmp (name, "_GLOBAL_OFFSET_TABLE_") =
= 0) | 3352 if (h == elf_hash_table (info)->hdynamic |
| 3353 || h == elf_hash_table (info)->hgot) |
3349 sym->st_shndx = SHN_ABS; | 3354 sym->st_shndx = SHN_ABS; |
3350 else if (strcmp (name, "_DYNAMIC_LINK") == 0) | 3355 else if (strcmp (name, "_DYNAMIC_LINK") == 0) |
3351 { | 3356 { |
3352 sym->st_shndx = SHN_ABS; | 3357 sym->st_shndx = SHN_ABS; |
3353 sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); | 3358 sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); |
3354 sym->st_value = 1; | 3359 sym->st_value = 1; |
3355 } | 3360 } |
3356 else if (strcmp (name, GP_DISP_LABEL) == 0) | 3361 else if (strcmp (name, GP_DISP_LABEL) == 0) |
3357 { | 3362 { |
3358 sym->st_shndx = SHN_ABS; | 3363 sym->st_shndx = SHN_ABS; |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 int offset; | 3719 int offset; |
3715 unsigned int raw_size; | 3720 unsigned int raw_size; |
3716 | 3721 |
3717 switch (note->descsz) | 3722 switch (note->descsz) |
3718 { | 3723 { |
3719 default: | 3724 default: |
3720 return FALSE; | 3725 return FALSE; |
3721 case 272: /* Linux/Score elf_prstatus */ | 3726 case 272: /* Linux/Score elf_prstatus */ |
3722 | 3727 |
3723 /* pr_cursig */ | 3728 /* pr_cursig */ |
3724 elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); | 3729 elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); |
3725 | 3730 |
3726 /* pr_pid */ | 3731 /* pr_pid */ |
3727 elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); | 3732 elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24); |
3728 | 3733 |
3729 /* pr_reg */ | 3734 /* pr_reg */ |
3730 offset = 72; | 3735 offset = 72; |
3731 | 3736 |
3732 /* sizeof(elf_gregset_t) */ | 3737 /* sizeof(elf_gregset_t) */ |
3733 raw_size = 196; | 3738 raw_size = 196; |
3734 | 3739 |
3735 break; | 3740 break; |
3736 } | 3741 } |
3737 | 3742 |
3738 /* Make a ".reg/999" section. */ | 3743 /* Make a ".reg/999" section. */ |
3739 return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size, note->descpos
+ offset); | 3744 return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size, |
| 3745 » » » » » note->descpos + offset); |
3740 } | 3746 } |
3741 | 3747 |
3742 bfd_boolean | 3748 bfd_boolean |
3743 s7_bfd_score_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) | 3749 s7_bfd_score_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) |
3744 { | 3750 { |
3745 switch (note->descsz) | 3751 switch (note->descsz) |
3746 { | 3752 { |
3747 default: | 3753 default: |
3748 return FALSE; | 3754 return FALSE; |
3749 | 3755 |
3750 case 128: /* Linux/Score elf_prpsinfo. */ | 3756 case 128: /* Linux/Score elf_prpsinfo. */ |
3751 /* pr_fname */ | 3757 /* pr_fname */ |
3752 elf_tdata (abfd)->core_program = _bfd_elfcore_strndup (abfd, note->descdat
a + 32, 16); | 3758 elf_tdata (abfd)->core->program |
| 3759 » = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); |
3753 | 3760 |
3754 /* pr_psargs */ | 3761 /* pr_psargs */ |
3755 elf_tdata (abfd)->core_command = _bfd_elfcore_strndup (abfd, note->descdat
a + 48, 80); | 3762 elf_tdata (abfd)->core->command |
| 3763 » = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); |
3756 break; | 3764 break; |
3757 } | 3765 } |
3758 | 3766 |
3759 /* Note that for some reason, a spurious space is tacked | 3767 /* Note that for some reason, a spurious space is tacked |
3760 onto the end of the args in some (at least one anyway) | 3768 onto the end of the args in some (at least one anyway) |
3761 implementations, so strip it off if it exists. */ | 3769 implementations, so strip it off if it exists. */ |
3762 | 3770 |
3763 { | 3771 { |
3764 char *command = elf_tdata (abfd)->core_command; | 3772 char *command = elf_tdata (abfd)->core->command; |
3765 int n = strlen (command); | 3773 int n = strlen (command); |
3766 | 3774 |
3767 if (0 < n && command[n - 1] == ' ') | 3775 if (0 < n && command[n - 1] == ' ') |
3768 command[n - 1] = '\0'; | 3776 command[n - 1] = '\0'; |
3769 } | 3777 } |
3770 | 3778 |
3771 return TRUE; | 3779 return TRUE; |
3772 } | 3780 } |
3773 | 3781 |
3774 | 3782 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3862 sdata = bfd_zalloc (abfd, amt); | 3870 sdata = bfd_zalloc (abfd, amt); |
3863 if (sdata == NULL) | 3871 if (sdata == NULL) |
3864 return FALSE; | 3872 return FALSE; |
3865 sec->used_by_bfd = sdata; | 3873 sec->used_by_bfd = sdata; |
3866 | 3874 |
3867 return _bfd_elf_new_section_hook (abfd, sec); | 3875 return _bfd_elf_new_section_hook (abfd, sec); |
3868 } | 3876 } |
3869 | 3877 |
3870 #define elf_backend_omit_section_dynsym \ | 3878 #define elf_backend_omit_section_dynsym \ |
3871 ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true) | 3879 ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true) |
OLD | NEW |