Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • postmarketOS/pmbootstrap
  • fossdd/pmbootstrap
  • Adrian/pmbootstrap
  • JustSoup321/pmbootstrap
  • longnoserob/pmbootstrap
  • sixthkrum/pmbootstrap
  • ollieparanoid/pmbootstrap
  • magdesign/pmbootstrap
  • anjandev/pmbootstrap
  • HenriDellal/pmbootstrap
  • Minecrell/pmbootstrap
  • chipiguay/pmbootstrap
  • ijiki16/pmbootstrap
  • whynothugo/pmbootstrap
  • amessier/pmbootstrap
  • Eisenbahnfan/pmbootstrap
  • user0-07161/pmbootstrap
  • SzczurekYT/pmbootstrap
  • neuschaefer/pmbootstrap
  • knuxify/pmbootstrap
  • Frieder.Hannenheim/pmbootstrap
21 results
Show changes
Commits on Source (33)
Showing
with 39 additions and 537 deletions
......@@ -30,5 +30,8 @@ set -o pipefail
# test_aports
python -m pytest -vv -x --cov=pmb --tb=native ./test/test_aports.py
# test_aports_kde
python -m pytest -vv -x --cov=pmb --tb=native ./test/test_aports_kde.py
# check_checksums
./test/check_checksums.py --build
......@@ -8,18 +8,19 @@
See pmbootstrap's [Development Guide](https://wiki.postmarketos.org/wiki/Development_guide).
### Contributing code changes
* [Fork](https://guides.github.com/activities/forking/) this repository, commit your changes and then make a [pull-request](https://guides.github.com/activities/forking/#making-a-pull-request) (PR).
* Please test your code before submitting a PR.
* We squash all commits from one PR into one commit. Please make multiple PRs if you feel like your changes should appear as multiple commits in the git log ([more information](https://wiki.postmarketos.org/wiki/FAQ#Development:_Why_do_we_use_squash_.27n.27_merge_for_pull_requests.3F)).
* [Fork](https://docs.gitlab.com/ee/gitlab-basics/fork-project.html) this repository, commit your changes and then make a [Merge Request](https://docs.gitlab.com/ee/workflow/merge_requests.html).
* Please test your code before submitting a Merge Request.
* We squash all commits from one Merge Request into one commit. Please make multiple Merge Requests if you feel like your changes should appear as multiple commits in the git log ([more information](https://wiki.postmarketos.org/wiki/Merge_Workflow)).
### Shell scripting
* We don't write scripts for `bash`, but for `busybox`'s `ash` shell, which is POSIX compliant (plus very few features from `bash`).
* Use `shellcheck` to test your changes for issues before submitting. There is even an [online](https://www.shellcheck.net) version.
* We're looking into automatizing this more, some files already get checked automatically by the [static code analysis script](https://github.com/postmarketOS/pmbootstrap/blob/master/test/static_code_analysis.sh).
* We're looking into automatizing this more, some files already get checked automatically by the [static code analysis script](test/static_code_analysis.sh).
### Python
* We use the [PEP8](https://www.python.org/dev/peps/pep-0008/) standard for Python code. Don't worry, you don't need to read all that, just run the `autopep8` program on your changed code, and confirm with the [static code analyis script](https://github.com/postmarketOS/pmbootstrap/blob/master/test/static_code_analysis.sh) that everything is PEP8 compliant. *This script will run automatically on Travis CI when you make a change request, and it must pass for your code to get accepted.*
* We use the [PEP8](https://www.python.org/dev/peps/pep-0008/) standard for Python code. Don't worry, you don't need to read all that, just run the `autopep8` program on your changed code, and confirm with the [static code analyis script](test/static_code_analysis.sh) that everything is PEP8 compliant. *This script will run automatically on Travis CI when you make a Merge Request, and it must pass for your code to get accepted.*
* We use the `reST` style for `docstrings` below functions (to comment what individual functions are doing, you'll see those when browsing through the code). Please stick to this format, and try to describe the important parameters and return values at least. Example from [here](https://stackoverflow.com/a/24385103):
```Python
"""
This is a reST style.
......@@ -30,7 +31,8 @@ This is a reST style.
:raises keyError: raises an exception
"""
```
* If it is feasible for you, try to run the testsuite on code that you have changed. The `test/test_build.py` case will build full cross-compilers for `aarch64` and `armhf`, so it may take a long time. Testcases can be started with `pytest` and it's planned to run that automatically when making a new PR (see [#64](https://github.com/postmarketOS/pmbootstrap/issues/64)).
* If it is feasible for you, try to run the testsuite on code that you have changed. The `test/test_build.py` case will build full cross-compilers for `aarch64` and `armhf`, so it may take a long time. Testcases can be started with `pytest` and it's planned to run that automatically when making a new Merge Request (see #64).
**If you need any help, don't hesitate to open an [issue](https://github.com/postmarketOS/pmbootstrap/issues) and ask!**
**If you need any help, don't hesitate to open an [issue](https://gitlab.com/postmarketOS/pmbootstrap/issues) and ask!**
......@@ -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"
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"
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"
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
......@@ -3,7 +3,7 @@
pkgname=busybox-static-aarch64
pkgver=1.28.4
pkgrel=1
pkgrel=2
_arch="aarch64"
_mirror="http://dl-cdn.alpinelinux.org/alpine/"
......@@ -26,4 +26,4 @@ package() {
rm .PKGINFO .SIGN.*
}
sha512sums="60dd3b8c518d4b042e754449c89cccac6797228ca8f665481606ff17d6b50af1ae0117182fb55d5a677c1afbac78a015b52ba5ae62c8417347254ae789e17997 busybox-static-1.28.4-r1-aarch64.apk"
sha512sums="363f13a3041a65ee96c984f75e46e3b0af985de3ca312b109ee2fbcfea957a69fe75655d3138ca922f8e196fa97c56c7c8a387440962150874a2cc619f07e8b6 busybox-static-1.28.4-r2-aarch64.apk"
......@@ -3,7 +3,7 @@
pkgname=busybox-static-armhf
pkgver=1.28.4
pkgrel=1
pkgrel=2
_arch="armhf"
_mirror="http://dl-cdn.alpinelinux.org/alpine/"
......@@ -26,4 +26,4 @@ package() {
rm .PKGINFO .SIGN.*
}
sha512sums="f83afca9b6ceaacb6c0d6bda6e05373d0ecded69b55df6a04c5ac85c38caaed8a93a4b470be1188b66ae9b78bedc64213b4f9812910eef362b310c24939f6344 busybox-static-1.28.4-r1-armhf.apk"
sha512sums="e10a339969fee47103d567d4a24237371a13a8519c40c550e64c3129018ff0fbd3bea785391c921087631bf0857e4a2ac46862fd699052f6a0752fb6e5771024 busybox-static-1.28.4-r2-armhf.apk"
pkgname="qemu-user-static-repack"
pkgver=2.8
pkgrel=11
pkgdesc="QEMU user mode emulation binaries (static version)"
arch="all"
url="https://wiki.debian.org/DebianKernel/ARMMP"
license="GPL2"
_debver="${pkgver}+dfsg-6+deb9u3"
_deburl="https://deb.debian.org/debian/pool/main/q/qemu/qemu-user-static_${_debver}"
source="
qemu-user-static_${_debver}_x86.deb::${_deburl}_i386.deb
qemu-user-static_${_debver}_x86_64.deb::${_deburl}_amd64.deb
qemu-user-static_${_debver}_armhf.deb::${_deburl}_armhf.deb
qemu-user-static_${_debver}_aarch64.deb::${_deburl}_arm64.deb
"
makedepends="tar xz"
subpackages="$pkgname-doc $pkgname-binfmt:binfmt:noarch"
options="!check"
unpack() {
cd "$srcdir"
for i in $source; do
case ${i%::*} in
*${CARCH}.deb) ar x ${i%::*} ;;
esac
done
# postinst in this archive contains the binfmt information
tar -xf "$srcdir/control.tar.gz"
}
package() {
mkdir -p "$pkgdir"
tar -xJf "$srcdir"/data.tar.xz -C $pkgdir
return 0
}
_binfmtout="$srcdir/qemu-user-binfmt.txt"
build() {
cd "$srcdir"
for line in \
"# Non-standard file format with grepped binfmt information" \
"# from Debians postinst script. Used in pmbootstrap."
do
echo "$line" >> $_binfmtout
done
for suffix in mask magic; do
grep "_${suffix}=" postinst >> $_binfmtout
done
}
binfmt() {
mkdir -p "$pkgdir-binfmt"
install -Dm644 $_binfmtout \
"$pkgdir-binfmt/usr/share/qemu-user-binfmt.txt"
}
sha512sums="466544a6e2b2ee4b0a25d290d9a95dd9082131118ee2818436e0a1ab4835ed5eaed0d4479dd392c2285dcb70e572a3323da970ff625706b9d72164992e8dd4a6 qemu-user-static_2.8+dfsg-6+deb9u3_x86.deb
96ffac25444f7fd3275dfb5c00b73a033b4668572aac3448e77e8d87ca27698f9b32fc7d57f1b311ee8b0662a7d7cb39c716bbdb433e0bd798e7b6d2d8380c2a qemu-user-static_2.8+dfsg-6+deb9u3_x86_64.deb
d7aac0a40e3795a3cc83131f95d5e5c8e6164d29fc58a412ee5b5306017f9d47b3c659504bea93b87dbbe86ee07b60284c38e58476a6d7142f3cfde392f75502 qemu-user-static_2.8+dfsg-6+deb9u3_armhf.deb
cb46e7ce7091b8d032a1a2fc7238ecce0238494517a23d64ad92dc50dc5ba5acdfb9e0d907db3c46d4c23d6c63612aa07d610ed3e11c4664c61d6bafe5b117ed qemu-user-static_2.8+dfsg-6+deb9u3_aarch64.deb"
pkgname=device-amazon-thor
pkgver=1
pkgrel=8
pkgrel=9
pkgdesc="Amazon KFHDX 7inch 2013"
url="https://postmarketos.org"
arch="noarch"
......@@ -23,5 +23,5 @@ package() {
devicepkg_package $startdir $pkgname
}
sha512sums="72f3e47ae416b625d0c82d0450dc3260675978ba3817fd6a157bcae8caacd6ea86364f525a11297bf6d4909846eecbff256119af940cffac99bcf7aa9abb1788 deviceinfo
sha512sums="d790fc98e56ea8376bc1619cf374f744989cebcb37e5874f5cf5b99f974c2b2cae327add45fecc59720ed3b06a2d7c98129d523d62d165aff1a173ac8417dca2 deviceinfo
e96725e631ba474980274266fd5af85c72fcd31543d0b5f5dbe7bd610f9650f881708a41887d61ba3e1d821b88668c3ca3d18667e9a1de918560a1ff762dda3d fb.modes"
......@@ -2,7 +2,7 @@
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Kindle Fire HDX 2013 (7-inch)"
deviceinfo_name="Amazon Kindle Fire HDX 2013 (7-inch)"
deviceinfo_manufacturer="Amazon"
deviceinfo_date=""
deviceinfo_nonfree="????"
......
pkgname=device-asus-flo
pkgver=0
pkgrel=12
pkgrel=13
pkgdesc="Google Nexus 7 2013 flo"
url="https://postmarketos.org"
arch="noarch"
......@@ -36,7 +36,7 @@ nonfree_firmware() {
mkdir "$subpkgdir"
}
sha512sums="968cdc9acd07adfd7bc865675618bcbf7917e8bb3592f2c098cb20cdae64272d8dc7e6fedbc1159bad3e659488c5cb1ae6b8a4f7394f90c81dc3199ba1ef3d32 deviceinfo
sha512sums="6f67406d0af3e6908c649acdacab7970493bfe9cdb6f546e4a61e00d480c806f55c71e5238176a9fa2874bf33183e36a2d7a00f09bb647f5a65beb619d90fa38 deviceinfo
5ac89b627f52d2f1103c3329bd905cdbb906cae5bb332d52e6805d7971fbcc0faabe1fd9d2beb7c6de4e4487c05047eaa17852dbf9e114ee3c5d4b0d57d73859 90-android-touch-dev.rules
3278921cc1617d10fdd13dfbeaf213cda0078d069e727acd8cfac10bd8ade6f373be1e22fd1e4b50ae71cd2eae09f7d6aad5de42338d9ea9f8c1a34f0b60cb69 wpa_supplicant.conf
cf913217b41a3dde8bc2a16a5bc82013c85679de0e81db1cfc36f2409ea034fec430082ddcb207c16746453601cf8381300b049cd2fb131f1916dc7dbcc247e3 pointercal
......
......@@ -2,7 +2,7 @@
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Nexus 7 2013 Wifi"
deviceinfo_name="Google Nexus 7 2013 Wifi"
deviceinfo_manufacturer="Asus"
deviceinfo_date=""
deviceinfo_keyboard="false"
......
pkgname=device-asus-grouper
pkgver=1
pkgrel=13
pkgrel=14
pkgdesc="Asus Nexus 7 2012 Wifi"
url="https://postmarketos.org"
arch="noarch"
......@@ -23,6 +23,6 @@ package() {
"$pkgdir"/etc/pointercal
}
sha512sums="c29494fb54ec23e73d0c31a83b38e65175c8d646fa5b6ddc94f66b1ee0b9e75e4373cc0d2dd12456340c0405457604fb0bfa79c29261f1305e1317cab2570b54 deviceinfo
sha512sums="6d7ea5d197aed62548fc68e42e18620a8f493436c2cf431e438e4cffa9fac40c690873b4498e328192f2d9b46f3f2fd5321e6847b2793b5caf5f08ccaf59fb1d deviceinfo
05f938784e8f30cdbe9923a5f3e34ce7c539060d3a621741206bc5ed02afd7cbf480b02fbe48a70968e7182f885ab9bfe57c4d1e7c6eefca54a6f7188d2849f2 90-android-touch-dev.rules
ae9c145ffd745c83c73edbc486d3b9d22c6cbb8c57827b6f1ba87b6449a17a73a443be7daa0ab87de8df2dd9594e624364652c84ec1e7b536d37f52449a5a58c pointercal"
......@@ -2,7 +2,7 @@
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Nexus 7 2012 Wifi"
deviceinfo_name="Google Nexus 7 2012 Wifi"
deviceinfo_manufacturer="Asus"
deviceinfo_date=""
deviceinfo_keyboard="false"
......
pkgname="device-asus-t00f"
pkgdesc="Asus Zenfone 5"
pkgver=0.1
pkgrel=2
pkgrel=3
url="https://postmarketos.org"
license="MIT"
arch="noarch"
......@@ -34,5 +34,5 @@ x11() {
"$subpkgdir"/etc/X11/xorg.conf.d/10-t00f.conf
}
sha512sums="92bf818ddf4946266aa835c4223b3a33dce428e132cf34e1f5e686f3c3782f58cf15dadc3d3c8c8e30932415a25462f8b4c689f14e48fb78f9b7a18955070924 deviceinfo
sha512sums="7a31b027a17f90872dfe3303227e36a699b0a95619ef27165183e83f91e084d4d61bc9e38bfd13e94f805b328f8850397d05d1f4acde49f86f4c599c98cf8f19 deviceinfo
2511fa519813061531757996fbbbb9eecae1a136d2e13149fd7afe04d19982c7eaa5ced8df57860bb816186f206915fcbd4a9e34fdf92b2c6efe3320a223c328 xorg.conf"
......@@ -3,7 +3,7 @@
deviceinfo_format_version="0"
deviceinfo_name="Asus Zenfone 5"
deviceinfo_manufacturer="ASUS"
deviceinfo_manufacturer="Asus"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
......
......@@ -2,7 +2,7 @@
pkgname="device-asus-z00t"
pkgdesc="Zenfone 2 Laser/Selfie (1080p)"
pkgver=0.1
pkgrel=0
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="noarch"
......@@ -30,5 +30,5 @@ nonfree_firmware() {
mkdir "$subpkgdir"
}
sha512sums="81a1dbe283a2908c7071065dce33d99e147cdf894c44fbe5930d04ad62ece19eae1889203b46d08cba2cc1584903b7179a79dd827e15a3f63b9d680ad0d9bba5 deviceinfo
sha512sums="e2ddd7db3cb1aa6dfad6f3c3c57bfb6faf62e228a5bc86deb2e44fd1a9fcd2806c72b563940f8622f1f9e5ad012ce53c8ee8bb27f9a67d4be2efaa87de4e563c deviceinfo
5bcf314aa8e77db9d9673a93886906bd15e8c3c57f8d0c4343977d2ce8d017af5608a3d13cd2cbacf155e3ecf632ccab6ff6f3b0c95eb4a2a3b35686a3c842db 90-touchscreen.rules"