cross/binutils-*: update to upstream (2.31.1-r0)
This commit is contained in:
parent
b3f1d81f35
commit
cf979e773a
6 changed files with 9 additions and 450 deletions
|
@ -4,8 +4,8 @@
|
|||
|
||||
|
||||
pkgname="binutils-aarch64"
|
||||
pkgver=2.30
|
||||
pkgrel=5
|
||||
pkgver=2.31.1
|
||||
pkgrel=0
|
||||
pkgdesc="Tools necessary to build programs for aarch64 targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
depends=""
|
||||
|
@ -16,10 +16,8 @@ arch="armhf x86_64 x86"
|
|||
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
|
||||
subpackages=""
|
||||
source="http://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.bz2
|
||||
fix-powerpc64-out-ot-line-save-restore.patch
|
||||
binutils-ld-fix-static-linking.patch
|
||||
gold-mips.patch
|
||||
allow-R_AARCH64_ABS16-and.patch
|
||||
"
|
||||
builddir="$srcdir/binutils-$pkgver"
|
||||
|
||||
|
@ -62,8 +60,6 @@ package() {
|
|||
|
||||
|
||||
|
||||
sha512sums="c3ce91aa20f058ec589bf18c722bf651331b394db6378900cc813cc0eea3a331a96584d5ae090630b627369510397dccc9edfcd43d4aeefc99579f277a05c72c binutils-2.30.tar.bz2
|
||||
5d8ebbcae2c8d3b2075fb06ace3c52ff6bb0ec96989873fbe302019a15d91f6e85e9e38a6d8eb09bd9aefa7723665108a3a62a6fc1cafb07b1eba2a96d19c9e3 allow-R_AARCH64_ABS16-and.patch
|
||||
29791af5a09387d16fc4272dc7a10f71aed5a13187187af533bbe365506d6e6b581030d3f9bb4b7d8e300fb29b8b37b5f48027d86e33a8395b1a6d2dfb2d895a fix-powerpc64-out-ot-line-save-restore.patch
|
||||
sha512sums="b42954e6f49a0adcd2676bdd77dfb59bfc25cec8184b007521d1e2b1d5d0593b58639e3d9448d5a40fe024c3cea386a37743627d6bb16d502f52a4a32b9573bd binutils-2.31.1.tar.bz2
|
||||
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch
|
||||
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f gold-mips.patch"
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
From b01452b1d44a586f4ecf5cf02ffc0643e4962324 Mon Sep 17 00:00:00 2001
|
||||
From: Renlin Li <renlin.li@arm.com>
|
||||
Date: Sat, 3 Feb 2018 13:18:17 +0000
|
||||
Subject: [PATCH] [PR22764][LD][AARCH64]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/ChangeLog | 7 +++++++
|
||||
bfd/elfnn-aarch64.c | 15 ++++++++++++---
|
||||
ld/ChangeLog | 8 ++++++++
|
||||
ld/testsuite/ld-aarch64/aarch64-elf.exp | 1 +
|
||||
ld/testsuite/ld-aarch64/emit-relocs-258.s | 3 ++-
|
||||
ld/testsuite/ld-aarch64/emit-relocs-259.s | 3 ++-
|
||||
ld/testsuite/ld-aarch64/pr22764.d | 18 ++++++++++++++++++
|
||||
ld/testsuite/ld-aarch64/pr22764.s | 6 ++++++
|
||||
8 files changed, 56 insertions(+), 5 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-aarch64/pr22764.d
|
||||
create mode 100644 ld/testsuite/ld-aarch64/pr22764.s
|
||||
|
||||
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
|
||||
index d5711e0..9731882 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 */
|
||||
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
index f310893..d766f37 100644
|
||||
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
@@ -275,6 +275,7 @@ run_dump_test "pr17415"
|
||||
run_dump_test_lp64 "tprel_g2_overflow"
|
||||
run_dump_test "tprel_add_lo12_overflow"
|
||||
run_dump_test "protected-data"
|
||||
+run_dump_test_lp64 "pr22764"
|
||||
|
||||
# ifunc tests
|
||||
run_dump_test "ifunc-1"
|
||||
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-258.s b/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
index f724776..87bb657 100644
|
||||
--- a/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
+++ b/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
@@ -1,5 +1,6 @@
|
||||
+.global dummy
|
||||
.text
|
||||
-
|
||||
+dummy:
|
||||
ldr x0, .L1
|
||||
|
||||
.L1:
|
||||
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-259.s b/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
index 7e1ba3c..0977c9d 100644
|
||||
--- a/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
+++ b/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
@@ -1,5 +1,6 @@
|
||||
+.global dummy
|
||||
.text
|
||||
-
|
||||
+dummy:
|
||||
ldr x0, .L1
|
||||
|
||||
.L1:
|
||||
diff --git a/ld/testsuite/ld-aarch64/pr22764.d b/ld/testsuite/ld-aarch64/pr22764.d
|
||||
new file mode 100644
|
||||
index 0000000..997519f
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-aarch64/pr22764.d
|
||||
@@ -0,0 +1,18 @@
|
||||
+#source: pr22764.s
|
||||
+#ld: -shared -T relocs.ld -defsym sym_abs1=0x1 -defsym sym_abs2=0x2 -defsym sym_abs3=0x3 -e0 --emit-relocs
|
||||
+#notarget: aarch64_be-*-*
|
||||
+#objdump: -dr
|
||||
+#...
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+0000000000010000 \<\.text\>:
|
||||
+ 10000: d503201f nop
|
||||
+ ...
|
||||
+ 10004: R_AARCH64_ABS64 sym_abs1
|
||||
+ 1000c: 00000002 \.word 0x00000002
|
||||
+ 1000c: R_AARCH64_ABS32 sym_abs2
|
||||
+ 10010: 0003 \.short 0x0003
|
||||
+ 10010: R_AARCH64_ABS16 sym_abs3
|
||||
+ 10012: 0000 \.short 0x0000
|
||||
+ 10014: d503201f nop
|
||||
diff --git a/ld/testsuite/ld-aarch64/pr22764.s b/ld/testsuite/ld-aarch64/pr22764.s
|
||||
new file mode 100644
|
||||
index 0000000..25e36b4
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-aarch64/pr22764.s
|
||||
@@ -0,0 +1,6 @@
|
||||
+ .text
|
||||
+ nop
|
||||
+ .xword sym_abs1
|
||||
+ .word sym_abs2
|
||||
+ .short sym_abs3
|
||||
+ nop
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
|
||||
pkgname="binutils-armhf"
|
||||
pkgver=2.30
|
||||
pkgrel=5
|
||||
pkgver=2.31.1
|
||||
pkgrel=0
|
||||
pkgdesc="Tools necessary to build programs for armhf targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
depends=""
|
||||
|
@ -16,10 +16,8 @@ arch="aarch64 x86_64 x86"
|
|||
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
|
||||
subpackages=""
|
||||
source="http://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.bz2
|
||||
fix-powerpc64-out-ot-line-save-restore.patch
|
||||
binutils-ld-fix-static-linking.patch
|
||||
gold-mips.patch
|
||||
allow-R_AARCH64_ABS16-and.patch
|
||||
"
|
||||
builddir="$srcdir/binutils-$pkgver"
|
||||
|
||||
|
@ -62,8 +60,6 @@ package() {
|
|||
|
||||
|
||||
|
||||
sha512sums="c3ce91aa20f058ec589bf18c722bf651331b394db6378900cc813cc0eea3a331a96584d5ae090630b627369510397dccc9edfcd43d4aeefc99579f277a05c72c binutils-2.30.tar.bz2
|
||||
5d8ebbcae2c8d3b2075fb06ace3c52ff6bb0ec96989873fbe302019a15d91f6e85e9e38a6d8eb09bd9aefa7723665108a3a62a6fc1cafb07b1eba2a96d19c9e3 allow-R_AARCH64_ABS16-and.patch
|
||||
29791af5a09387d16fc4272dc7a10f71aed5a13187187af533bbe365506d6e6b581030d3f9bb4b7d8e300fb29b8b37b5f48027d86e33a8395b1a6d2dfb2d895a fix-powerpc64-out-ot-line-save-restore.patch
|
||||
sha512sums="b42954e6f49a0adcd2676bdd77dfb59bfc25cec8184b007521d1e2b1d5d0593b58639e3d9448d5a40fe024c3cea386a37743627d6bb16d502f52a4a32b9573bd binutils-2.31.1.tar.bz2
|
||||
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch
|
||||
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f gold-mips.patch"
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
From b01452b1d44a586f4ecf5cf02ffc0643e4962324 Mon Sep 17 00:00:00 2001
|
||||
From: Renlin Li <renlin.li@arm.com>
|
||||
Date: Sat, 3 Feb 2018 13:18:17 +0000
|
||||
Subject: [PATCH] [PR22764][LD][AARCH64]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/ChangeLog | 7 +++++++
|
||||
bfd/elfnn-aarch64.c | 15 ++++++++++++---
|
||||
ld/ChangeLog | 8 ++++++++
|
||||
ld/testsuite/ld-aarch64/aarch64-elf.exp | 1 +
|
||||
ld/testsuite/ld-aarch64/emit-relocs-258.s | 3 ++-
|
||||
ld/testsuite/ld-aarch64/emit-relocs-259.s | 3 ++-
|
||||
ld/testsuite/ld-aarch64/pr22764.d | 18 ++++++++++++++++++
|
||||
ld/testsuite/ld-aarch64/pr22764.s | 6 ++++++
|
||||
8 files changed, 56 insertions(+), 5 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-aarch64/pr22764.d
|
||||
create mode 100644 ld/testsuite/ld-aarch64/pr22764.s
|
||||
|
||||
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
|
||||
index d5711e0..9731882 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 */
|
||||
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
index f310893..d766f37 100644
|
||||
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
@@ -275,6 +275,7 @@ run_dump_test "pr17415"
|
||||
run_dump_test_lp64 "tprel_g2_overflow"
|
||||
run_dump_test "tprel_add_lo12_overflow"
|
||||
run_dump_test "protected-data"
|
||||
+run_dump_test_lp64 "pr22764"
|
||||
|
||||
# ifunc tests
|
||||
run_dump_test "ifunc-1"
|
||||
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-258.s b/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
index f724776..87bb657 100644
|
||||
--- a/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
+++ b/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
@@ -1,5 +1,6 @@
|
||||
+.global dummy
|
||||
.text
|
||||
-
|
||||
+dummy:
|
||||
ldr x0, .L1
|
||||
|
||||
.L1:
|
||||
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-259.s b/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
index 7e1ba3c..0977c9d 100644
|
||||
--- a/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
+++ b/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
@@ -1,5 +1,6 @@
|
||||
+.global dummy
|
||||
.text
|
||||
-
|
||||
+dummy:
|
||||
ldr x0, .L1
|
||||
|
||||
.L1:
|
||||
diff --git a/ld/testsuite/ld-aarch64/pr22764.d b/ld/testsuite/ld-aarch64/pr22764.d
|
||||
new file mode 100644
|
||||
index 0000000..997519f
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-aarch64/pr22764.d
|
||||
@@ -0,0 +1,18 @@
|
||||
+#source: pr22764.s
|
||||
+#ld: -shared -T relocs.ld -defsym sym_abs1=0x1 -defsym sym_abs2=0x2 -defsym sym_abs3=0x3 -e0 --emit-relocs
|
||||
+#notarget: aarch64_be-*-*
|
||||
+#objdump: -dr
|
||||
+#...
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+0000000000010000 \<\.text\>:
|
||||
+ 10000: d503201f nop
|
||||
+ ...
|
||||
+ 10004: R_AARCH64_ABS64 sym_abs1
|
||||
+ 1000c: 00000002 \.word 0x00000002
|
||||
+ 1000c: R_AARCH64_ABS32 sym_abs2
|
||||
+ 10010: 0003 \.short 0x0003
|
||||
+ 10010: R_AARCH64_ABS16 sym_abs3
|
||||
+ 10012: 0000 \.short 0x0000
|
||||
+ 10014: d503201f nop
|
||||
diff --git a/ld/testsuite/ld-aarch64/pr22764.s b/ld/testsuite/ld-aarch64/pr22764.s
|
||||
new file mode 100644
|
||||
index 0000000..25e36b4
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-aarch64/pr22764.s
|
||||
@@ -0,0 +1,6 @@
|
||||
+ .text
|
||||
+ nop
|
||||
+ .xword sym_abs1
|
||||
+ .word sym_abs2
|
||||
+ .short sym_abs3
|
||||
+ nop
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
|
||||
pkgname="binutils-x86_64"
|
||||
pkgver=2.30
|
||||
pkgrel=5
|
||||
pkgver=2.31.1
|
||||
pkgrel=0
|
||||
pkgdesc="Tools necessary to build programs for x86_64 targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
depends=""
|
||||
|
@ -16,10 +16,8 @@ arch="armhf aarch64 x86"
|
|||
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
|
||||
subpackages=""
|
||||
source="http://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.bz2
|
||||
fix-powerpc64-out-ot-line-save-restore.patch
|
||||
binutils-ld-fix-static-linking.patch
|
||||
gold-mips.patch
|
||||
allow-R_AARCH64_ABS16-and.patch
|
||||
"
|
||||
builddir="$srcdir/binutils-$pkgver"
|
||||
|
||||
|
@ -62,8 +60,6 @@ package() {
|
|||
|
||||
|
||||
|
||||
sha512sums="c3ce91aa20f058ec589bf18c722bf651331b394db6378900cc813cc0eea3a331a96584d5ae090630b627369510397dccc9edfcd43d4aeefc99579f277a05c72c binutils-2.30.tar.bz2
|
||||
5d8ebbcae2c8d3b2075fb06ace3c52ff6bb0ec96989873fbe302019a15d91f6e85e9e38a6d8eb09bd9aefa7723665108a3a62a6fc1cafb07b1eba2a96d19c9e3 allow-R_AARCH64_ABS16-and.patch
|
||||
29791af5a09387d16fc4272dc7a10f71aed5a13187187af533bbe365506d6e6b581030d3f9bb4b7d8e300fb29b8b37b5f48027d86e33a8395b1a6d2dfb2d895a fix-powerpc64-out-ot-line-save-restore.patch
|
||||
sha512sums="b42954e6f49a0adcd2676bdd77dfb59bfc25cec8184b007521d1e2b1d5d0593b58639e3d9448d5a40fe024c3cea386a37743627d6bb16d502f52a4a32b9573bd binutils-2.31.1.tar.bz2
|
||||
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch
|
||||
f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f gold-mips.patch"
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
From b01452b1d44a586f4ecf5cf02ffc0643e4962324 Mon Sep 17 00:00:00 2001
|
||||
From: Renlin Li <renlin.li@arm.com>
|
||||
Date: Sat, 3 Feb 2018 13:18:17 +0000
|
||||
Subject: [PATCH] [PR22764][LD][AARCH64]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/ChangeLog | 7 +++++++
|
||||
bfd/elfnn-aarch64.c | 15 ++++++++++++---
|
||||
ld/ChangeLog | 8 ++++++++
|
||||
ld/testsuite/ld-aarch64/aarch64-elf.exp | 1 +
|
||||
ld/testsuite/ld-aarch64/emit-relocs-258.s | 3 ++-
|
||||
ld/testsuite/ld-aarch64/emit-relocs-259.s | 3 ++-
|
||||
ld/testsuite/ld-aarch64/pr22764.d | 18 ++++++++++++++++++
|
||||
ld/testsuite/ld-aarch64/pr22764.s | 6 ++++++
|
||||
8 files changed, 56 insertions(+), 5 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-aarch64/pr22764.d
|
||||
create mode 100644 ld/testsuite/ld-aarch64/pr22764.s
|
||||
|
||||
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
|
||||
index d5711e0..9731882 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 */
|
||||
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
index f310893..d766f37 100644
|
||||
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
|
||||
@@ -275,6 +275,7 @@ run_dump_test "pr17415"
|
||||
run_dump_test_lp64 "tprel_g2_overflow"
|
||||
run_dump_test "tprel_add_lo12_overflow"
|
||||
run_dump_test "protected-data"
|
||||
+run_dump_test_lp64 "pr22764"
|
||||
|
||||
# ifunc tests
|
||||
run_dump_test "ifunc-1"
|
||||
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-258.s b/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
index f724776..87bb657 100644
|
||||
--- a/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
+++ b/ld/testsuite/ld-aarch64/emit-relocs-258.s
|
||||
@@ -1,5 +1,6 @@
|
||||
+.global dummy
|
||||
.text
|
||||
-
|
||||
+dummy:
|
||||
ldr x0, .L1
|
||||
|
||||
.L1:
|
||||
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-259.s b/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
index 7e1ba3c..0977c9d 100644
|
||||
--- a/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
+++ b/ld/testsuite/ld-aarch64/emit-relocs-259.s
|
||||
@@ -1,5 +1,6 @@
|
||||
+.global dummy
|
||||
.text
|
||||
-
|
||||
+dummy:
|
||||
ldr x0, .L1
|
||||
|
||||
.L1:
|
||||
diff --git a/ld/testsuite/ld-aarch64/pr22764.d b/ld/testsuite/ld-aarch64/pr22764.d
|
||||
new file mode 100644
|
||||
index 0000000..997519f
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-aarch64/pr22764.d
|
||||
@@ -0,0 +1,18 @@
|
||||
+#source: pr22764.s
|
||||
+#ld: -shared -T relocs.ld -defsym sym_abs1=0x1 -defsym sym_abs2=0x2 -defsym sym_abs3=0x3 -e0 --emit-relocs
|
||||
+#notarget: aarch64_be-*-*
|
||||
+#objdump: -dr
|
||||
+#...
|
||||
+
|
||||
+Disassembly of section \.text:
|
||||
+
|
||||
+0000000000010000 \<\.text\>:
|
||||
+ 10000: d503201f nop
|
||||
+ ...
|
||||
+ 10004: R_AARCH64_ABS64 sym_abs1
|
||||
+ 1000c: 00000002 \.word 0x00000002
|
||||
+ 1000c: R_AARCH64_ABS32 sym_abs2
|
||||
+ 10010: 0003 \.short 0x0003
|
||||
+ 10010: R_AARCH64_ABS16 sym_abs3
|
||||
+ 10012: 0000 \.short 0x0000
|
||||
+ 10014: d503201f nop
|
||||
diff --git a/ld/testsuite/ld-aarch64/pr22764.s b/ld/testsuite/ld-aarch64/pr22764.s
|
||||
new file mode 100644
|
||||
index 0000000..25e36b4
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-aarch64/pr22764.s
|
||||
@@ -0,0 +1,6 @@
|
||||
+ .text
|
||||
+ nop
|
||||
+ .xword sym_abs1
|
||||
+ .word sym_abs2
|
||||
+ .short sym_abs3
|
||||
+ nop
|
||||
--
|
||||
2.9.3
|
||||
|
Loading…
Reference in a new issue