summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/bfd/elf32-arm.c
diff options
context:
space:
mode:
authorHan Shen <shenhan@google.com>2015-11-17 16:29:47 -0800
committerHan Shen <shenhan@google.com>2015-11-19 17:29:00 -0800
commit8bfb6b2bf11cfbc445239158ec28d0988f8fa947 (patch)
tree64baf9be2b2d76eb0d3d83ec6acf3d5ddd452b64 /binutils-2.25/bfd/elf32-arm.c
parent932d71b859239e834651fdee549dc661cda82fe8 (diff)
downloadtoolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.tar.gz
toolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.tar.bz2
toolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.zip
Create an unified binutils source tree for both Android and ChromiumOS.
About source code - The base version of this binutils is newer than that of aosp/binutils-2.25, it is based on the binutils that is used to build google products and ChromiumOS. And it contains *all* local Android patches as well as all patches that are cherry-picked from upstream for aosp/binutils-2.25 tree (up to Nov. 5 - 932d71b85). You may find the detailed development history for this binutils tree here - https://chromium.googlesource.com/chromiumos/third_party/binutils/+log/unification (This CL is a combination of all the CLs in it. After this CL is submitted the tree will be identical to https://chromium.googlesource.com/chromiumos/third_party/binutils/+log/unification at 2865a3615d80bd5f82d14d7e0484e84dc052596a) About testing - We tested this binutils for both ChromiumOS and Android. For android, we tested building N4, N5X, N6, N7, N9 using new binutils, we also did a full-build of toolchain (by build.py) and built a N5X image; for ChromiumOS - it passed ChromiumOS toolchain release tests on all 4 platforms (x86, x86_64, arm32 and arm64). Change-Id: I2bb2cf579f9458d0a8bc9612331dc7d5043e3d82
Diffstat (limited to 'binutils-2.25/bfd/elf32-arm.c')
-rw-r--r--binutils-2.25/bfd/elf32-arm.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/binutils-2.25/bfd/elf32-arm.c b/binutils-2.25/bfd/elf32-arm.c
index c507e4fe..bbda298a 100644
--- a/binutils-2.25/bfd/elf32-arm.c
+++ b/binutils-2.25/bfd/elf32-arm.c
@@ -11746,10 +11746,14 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
/* This needs to happen before Tag_ABI_FP_number_model is merged. */
if (in_attr[Tag_ABI_VFP_args].i != out_attr[Tag_ABI_VFP_args].i)
{
- /* Ignore mismatches if the object doesn't use floating point. */
- if (out_attr[Tag_ABI_FP_number_model].i == 0)
+ /* Ignore mismatches if the object doesn't use floating point or is
+ floating point ABI independent. */
+ if (out_attr[Tag_ABI_FP_number_model].i == AEABI_FP_number_model_none
+ || (in_attr[Tag_ABI_FP_number_model].i != AEABI_FP_number_model_none
+ && out_attr[Tag_ABI_VFP_args].i == AEABI_VFP_args_compatible))
out_attr[Tag_ABI_VFP_args].i = in_attr[Tag_ABI_VFP_args].i;
- else if (in_attr[Tag_ABI_FP_number_model].i != 0)
+ else if (in_attr[Tag_ABI_FP_number_model].i != AEABI_FP_number_model_none
+ && in_attr[Tag_ABI_VFP_args].i != AEABI_VFP_args_compatible)
{
_bfd_error_handler
(_("error: %B uses VFP register arguments, %B does not"),
@@ -14713,7 +14717,7 @@ elf32_arm_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATT
&& ((i_ehdrp->e_type == ET_DYN) || (i_ehdrp->e_type == ET_EXEC)))
{
int abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_PROC, Tag_ABI_VFP_args);
- if (abi)
+ if (abi == AEABI_VFP_args_vfp)
i_ehdrp->e_flags |= EF_ARM_ABI_FLOAT_HARD;
else
i_ehdrp->e_flags |= EF_ARM_ABI_FLOAT_SOFT;
@@ -15958,6 +15962,26 @@ const struct elf_size_info elf32_arm_size_info =
bfd_elf32_swap_reloca_out
};
+static bfd_vma
+read_code32 (const bfd *abfd, const bfd_byte *addr)
+{
+ /* V7 BE8 code is always little endian. */
+ if ((elf_elfheader (abfd)->e_flags & EF_ARM_BE8) != 0)
+ return bfd_getl32 (addr);
+
+ return bfd_get_32 (abfd, addr);
+}
+
+static bfd_vma
+read_code16 (const bfd *abfd, const bfd_byte *addr)
+{
+ /* V7 BE8 code is always little endian. */
+ if ((elf_elfheader (abfd)->e_flags & EF_ARM_BE8) != 0)
+ return bfd_getl16 (addr);
+
+ return bfd_get_16 (abfd, addr);
+}
+
/* Return size of plt0 entry starting at ADDR
or (bfd_vma) -1 if size can not be determined. */
@@ -15967,7 +15991,7 @@ elf32_arm_plt0_size (const bfd *abfd, const bfd_byte *addr)
bfd_vma first_word;
bfd_vma plt0_size;
- first_word = H_GET_32 (abfd, addr);
+ first_word = read_code32 (abfd, addr);
if (first_word == elf32_arm_plt0_entry[0])
plt0_size = 4 * ARRAY_SIZE (elf32_arm_plt0_entry);
@@ -15992,17 +16016,17 @@ elf32_arm_plt_size (const bfd *abfd, const bfd_byte *start, bfd_vma offset)
const bfd_byte *addr = start + offset;
/* PLT entry size if fixed on Thumb-only platforms. */
- if (H_GET_32(abfd, start) == elf32_thumb2_plt0_entry[0])
+ if (read_code32 (abfd, start) == elf32_thumb2_plt0_entry[0])
return 4 * ARRAY_SIZE (elf32_thumb2_plt_entry);
/* Respect Thumb stub if necessary. */
- if (H_GET_16(abfd, addr) == elf32_arm_plt_thumb_stub[0])
+ if (read_code16 (abfd, addr) == elf32_arm_plt_thumb_stub[0])
{
plt_size += 2 * ARRAY_SIZE(elf32_arm_plt_thumb_stub);
}
/* Strip immediate from first add. */
- first_insn = H_GET_32(abfd, addr + plt_size) & 0xffffff00;
+ first_insn = read_code32 (abfd, addr + plt_size) & 0xffffff00;
#ifdef FOUR_WORD_PLT
if (first_insn == elf32_arm_plt_entry[0])
@@ -16219,6 +16243,7 @@ elf32_arm_get_synthetic_symtab (bfd *abfd,
becaus elf32_arm_plt_entry isn't defined when FOUR_WORD_PLT isn't defined where elf32_arm_plt_entry_short
and elf32_arm_plt_entry_long are defined instead.
*/
+
#undef elf_backend_plt_sym_val
#define elf_backend_plt_sym_val elf32_arm_plt_sym_val