diff options
Diffstat (limited to 'patches/binutils-2.30/0001-Allow-R_AARCH64_ABS16-and-R_AARCH64_ABS32-against-ab.patch')
-rw-r--r-- | patches/binutils-2.30/0001-Allow-R_AARCH64_ABS16-and-R_AARCH64_ABS32-against-ab.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/patches/binutils-2.30/0001-Allow-R_AARCH64_ABS16-and-R_AARCH64_ABS32-against-ab.patch b/patches/binutils-2.30/0001-Allow-R_AARCH64_ABS16-and-R_AARCH64_ABS32-against-ab.patch new file mode 100644 index 0000000..1fd9afd --- /dev/null +++ b/patches/binutils-2.30/0001-Allow-R_AARCH64_ABS16-and-R_AARCH64_ABS32-against-ab.patch @@ -0,0 +1,57 @@ +From: Renlin Li <renlin.li@arm.com> +Date: Sat, 3 Feb 2018 13:18:17 +0000 +Subject: [PATCH] Allow R_AARCH64_ABS16 and R_AARCH64_ABS32 against absolution + symbol or undefine symbol in shared object. + +backport from mainline + +bfd/ + +2018-02-05 Renlin Li <renlin.li@arm.com> + + PR ld/22764 + * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Relax the + R_AARCH64_ABS32 and R_AARCH64_ABS16 for absolute symbol. Apply the + check for writeable section as well. + +ld/ + +2018-02-05 Renlin Li <renlin.li@arm.com> + + PR ld/22764 + * testsuite/ld-aarch64/emit-relocs-258.s: Define symbol as an address. + * testsuite/ld-aarch64/emit-relocs-259.s: Likewise. + * testsuite/ld-aarch64/aarch64-elf.exp: Run new test. + * testsuite/ld-aarch64/pr22764.s: New. + * testsuite/ld-aarch64/pr22764.d: New. +--- + bfd/elfnn-aarch64.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c +index d5711e0eb1dc..973188220ba1 100644 +--- a/bfd/elfnn-aarch64.c ++++ b/bfd/elfnn-aarch64.c +@@ -7074,10 +7074,19 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, + #if ARCH_SIZE == 64 + case BFD_RELOC_AARCH64_32: + #endif +- if (bfd_link_pic (info) +- && (sec->flags & SEC_ALLOC) != 0 +- && (sec->flags & SEC_READONLY) != 0) ++ if (bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0) + { ++ if (h != NULL ++ /* This is an absolute symbol. It represents a value instead ++ of an address. */ ++ && ((h->root.type == bfd_link_hash_defined ++ && bfd_is_abs_section (h->root.u.def.section)) ++ /* This is an undefined symbol. */ ++ || h->root.type == bfd_link_hash_undefined)) ++ break; ++ ++ /* For local symbols, defined global symbols in a non-ABS section, ++ it is assumed that the value is an address. */ + int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START; + _bfd_error_handler + /* xgettext:c-format */ |