]> gcc.gnu.org Git - gcc.git/commit
[AArch64] Fix symbol offset limit (PR 98618)
authorWilco Dijkstra <wdijkstr@arm.com>
Wed, 16 Oct 2019 14:24:41 +0000 (14:24 +0000)
committerWilco Dijkstra <wdijkstr@arm.com>
Thu, 21 Jan 2021 12:53:06 +0000 (12:53 +0000)
commitc9569046bd8ba2671833d600b3bdbdb7de593873
tree7aede684a132111a710dc689f7bc2b3762b7e4e8
parent82945464594d54009439d9a30c51bf0c1cdb32b3
[AArch64] Fix symbol offset limit (PR 98618)

In aarch64_classify_symbol symbols are allowed large offsets on relocations.
This means the offset can use all of the +/-4GB offset, leaving no offset
available for the symbol itself.  This results in relocation overflow and
link-time errors for simple expressions like &global_array + 0xffffff00.

To avoid this, unless the offset_within_block_p is true, limit the offset
to +/-1MB so that the symbol needs to be within a 3.9GB offset from its
references.  For the tiny code model use a 64KB offset, allowing most of
the 1MB range for code/data between the symbol and its references.

gcc/
PR target/98618
* config/aarch64/aarch64.c (aarch64_classify_symbol):
Apply reasonable limit to symbol offsets.

gcc/testsuite/
PR target/98618
* gcc.target/aarch64/symbol-range.c: Improve testcase.
* gcc.target/aarch64/symbol-range-tiny.c: Likewise.

(cherry picked from commit 7d3b27ff12610fde9d6c4b56abc70c6ee9b6b3db)
gcc/config/aarch64/aarch64.c
gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c
gcc/testsuite/gcc.target/aarch64/symbol-range.c
This page took 0.067199 seconds and 6 git commands to generate.