X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bfd%2Felf32-sh.c;h=44a3aa7875ede7449df3d23cca80b35ebb0341ba;hb=1903aa3536a887f693088b0404a8dd2214dfb6fc;hp=8adc9a43f8fdda2570ffedbdda1ad97c4de7f807;hpb=4b95cf5c0c75d6efc1b2f96af72317aecca079f1;p=platform%2Fupstream%2Fbinutils.git diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 8adc9a4..44a3aa7 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -88,11 +88,11 @@ static bfd_boolean vxworks_object_p (bfd *abfd ATTRIBUTE_UNUSED) { #if !defined INCLUDE_SHMEDIA && !defined SH_TARGET_ALREADY_DEFINED - extern const bfd_target bfd_elf32_shlvxworks_vec; - extern const bfd_target bfd_elf32_shvxworks_vec; + extern const bfd_target sh_elf32_vxworks_le_vec; + extern const bfd_target sh_elf32_vxworks_vec; - return (abfd->xvec == &bfd_elf32_shlvxworks_vec - || abfd->xvec == &bfd_elf32_shvxworks_vec); + return (abfd->xvec == &sh_elf32_vxworks_le_vec + || abfd->xvec == &sh_elf32_vxworks_vec); #else return FALSE; #endif @@ -104,11 +104,11 @@ static bfd_boolean fdpic_object_p (bfd *abfd ATTRIBUTE_UNUSED) { #if !defined INCLUDE_SHMEDIA && !defined SH_TARGET_ALREADY_DEFINED - extern const bfd_target bfd_elf32_shfd_vec; - extern const bfd_target bfd_elf32_shbfd_vec; + extern const bfd_target sh_elf32_fdpic_le_vec; + extern const bfd_target sh_elf32_fdpic_be_vec; - return (abfd->xvec == &bfd_elf32_shfd_vec - || abfd->xvec == &bfd_elf32_shbfd_vec); + return (abfd->xvec == &sh_elf32_fdpic_le_vec + || abfd->xvec == &sh_elf32_fdpic_be_vec); #else return FALSE; #endif @@ -702,10 +702,10 @@ sh_elf_relax_section (bfd *abfd, asection *sec, elf_section_data (sec)->this_hdr.contents = contents; symtab_hdr->contents = (unsigned char *) isymbuf; - /* Replace the jsr with a bsr. */ + /* Replace the jmp/jsr with a bra/bsr. */ /* Change the R_SH_USES reloc into an R_SH_IND12W reloc, and - replace the jsr with a bsr. */ + replace the jmp/jsr with a bra/bsr. */ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irelfn->r_info), R_SH_IND12W); /* We used to test (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) here, but that only checks if the symbol is an external symbol, @@ -716,7 +716,10 @@ sh_elf_relax_section (bfd *abfd, asection *sec, /* We can't fully resolve this yet, because the external symbol value may be changed by future relaxing. We let the final link phase handle it. */ - bfd_put_16 (abfd, (bfd_vma) 0xb000, contents + irel->r_offset); + if (bfd_get_16 (abfd, contents + irel->r_offset) & 0x0020) + bfd_put_16 (abfd, (bfd_vma) 0xa000, contents + irel->r_offset); + else + bfd_put_16 (abfd, (bfd_vma) 0xb000, contents + irel->r_offset); irel->r_addend = -4; @@ -3341,7 +3344,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Set up .got offsets for local syms, and space for local dynamic relocs. */ - for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) { bfd_signed_vma *local_got; bfd_signed_vma *end_local_got; @@ -3676,7 +3679,9 @@ sh_elf_osec_to_segment (bfd *output_bfd, asection *osec) { Elf_Internal_Phdr *p = NULL; - if (output_bfd->xvec->flavour == bfd_target_elf_flavour) + if (output_bfd->xvec->flavour == bfd_target_elf_flavour + /* PR ld/17110: Do not look for output segments in an input bfd. */ + && output_bfd->direction != read_direction) p = _bfd_elf_find_segment_containing_section (output_bfd, osec); /* FIXME: Nothing ever says what this index is relative to. The kernel @@ -7403,9 +7408,9 @@ sh_elf_encode_eh_address (bfd *abfd, } #if !defined SH_TARGET_ALREADY_DEFINED -#define TARGET_BIG_SYM bfd_elf32_sh_vec +#define TARGET_BIG_SYM sh_elf32_vec #define TARGET_BIG_NAME "elf32-sh" -#define TARGET_LITTLE_SYM bfd_elf32_shl_vec +#define TARGET_LITTLE_SYM sh_elf32_le_vec #define TARGET_LITTLE_NAME "elf32-shl" #endif @@ -7478,11 +7483,11 @@ sh_elf_encode_eh_address (bfd *abfd, /* NetBSD support. */ #undef TARGET_BIG_SYM -#define TARGET_BIG_SYM bfd_elf32_shnbsd_vec +#define TARGET_BIG_SYM sh_elf32_nbsd_vec #undef TARGET_BIG_NAME #define TARGET_BIG_NAME "elf32-sh-nbsd" #undef TARGET_LITTLE_SYM -#define TARGET_LITTLE_SYM bfd_elf32_shlnbsd_vec +#define TARGET_LITTLE_SYM sh_elf32_nbsd_le_vec #undef TARGET_LITTLE_NAME #define TARGET_LITTLE_NAME "elf32-shl-nbsd" #undef ELF_MAXPAGESIZE @@ -7498,11 +7503,11 @@ sh_elf_encode_eh_address (bfd *abfd, /* Linux support. */ #undef TARGET_BIG_SYM -#define TARGET_BIG_SYM bfd_elf32_shblin_vec +#define TARGET_BIG_SYM sh_elf32_linux_be_vec #undef TARGET_BIG_NAME #define TARGET_BIG_NAME "elf32-shbig-linux" #undef TARGET_LITTLE_SYM -#define TARGET_LITTLE_SYM bfd_elf32_shlin_vec +#define TARGET_LITTLE_SYM sh_elf32_linux_vec #undef TARGET_LITTLE_NAME #define TARGET_LITTLE_NAME "elf32-sh-linux" #undef ELF_COMMONPAGESIZE @@ -7520,11 +7525,11 @@ sh_elf_encode_eh_address (bfd *abfd, /* FDPIC support. */ #undef TARGET_BIG_SYM -#define TARGET_BIG_SYM bfd_elf32_shbfd_vec +#define TARGET_BIG_SYM sh_elf32_fdpic_be_vec #undef TARGET_BIG_NAME #define TARGET_BIG_NAME "elf32-shbig-fdpic" #undef TARGET_LITTLE_SYM -#define TARGET_LITTLE_SYM bfd_elf32_shfd_vec +#define TARGET_LITTLE_SYM sh_elf32_fdpic_le_vec #undef TARGET_LITTLE_NAME #define TARGET_LITTLE_NAME "elf32-sh-fdpic" @@ -7537,11 +7542,11 @@ sh_elf_encode_eh_address (bfd *abfd, /* VxWorks support. */ #undef TARGET_BIG_SYM -#define TARGET_BIG_SYM bfd_elf32_shvxworks_vec +#define TARGET_BIG_SYM sh_elf32_vxworks_vec #undef TARGET_BIG_NAME #define TARGET_BIG_NAME "elf32-sh-vxworks" #undef TARGET_LITTLE_SYM -#define TARGET_LITTLE_SYM bfd_elf32_shlvxworks_vec +#define TARGET_LITTLE_SYM sh_elf32_vxworks_le_vec #undef TARGET_LITTLE_NAME #define TARGET_LITTLE_NAME "elf32-shl-vxworks" #undef elf32_bed