]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Make various linker tests more robust
authorMatthew Malcomson <matthew.malcomson@arm.com>
Fri, 5 Aug 2022 16:19:37 +0000 (17:19 +0100)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Fri, 5 Aug 2022 16:50:11 +0000 (17:50 +0100)
commit20b65d428087284323adb7ea8a697738be5dea62
tree955b26289f4e91694c21287c343d5c484a702761
parenta744244852b3886f7bba68638c0090f755a631d7
Make various linker tests more robust

Various linker tests have been failing on aarch64-none-linux-gnu for a
while now.  We've ignored their failure since we knew they were from us
writing the tests with hard-coded values based on the aarch64-none-elf
toolchain.

A while ago we introduced a record/check feature in the testsuite that
has allowed re-writing some tests in a more general manner.  This commit
adjusts the remaining tests using this new feature.

While updating these remaining tests we also changed the record/check
feature to replace *all* occurrences of a `check` pattern in the line we
want to use.  This seems like what would be the expected behaviour,
although we did not actually need that change in this commit.

Only one testcase was slightly tricky to generalise.

This was the `morello-pcc-bounds-include-readonly` testcase.  We wanted
to ensure that the `othersection` was included in PCC bounds, but that
othersection was usually not the last RO section.  Since it was usually
not the last RO section we could not calculate the bounds that should be
given to our capability.

When using hard-coded addresses this was fine since we could just ensure
that the hard-coded address was large enough to span .othersection.
The record/check functionality does not allow checking that a value is
acceptable (i.e. the "check" part does not pass the values we see to
some procedure).  Rather it generates a value that the line should
match.

Hence in order to make this particular test general we emitted the
section headers, found the last read-only section, then asserted that
the size of the capability with executable permissions spanned up to the
end of that section.

The method by which we find the last read-only section could change
between different targets, but it at least works on both
aarch64-none-elf and aarch64-none-linux.
13 files changed:
binutils/testsuite/lib/binutils-common.exp
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/c64-ifunc-3a.d
ld/testsuite/ld-aarch64/emit-morello-reloc-markers-1.d
ld/testsuite/ld-aarch64/emit-morello-reloc-markers-2.d
ld/testsuite/ld-aarch64/emit-morello-reloc-markers-3.d
ld/testsuite/ld-aarch64/emit-relocs-morello-7.d
ld/testsuite/ld-aarch64/emit-relocs-morello-7.ld
ld/testsuite/ld-aarch64/emit-relocs-morello-9.d
ld/testsuite/ld-aarch64/morello-pcc-bounds-include-readonly.d
ld/testsuite/ld-aarch64/morello-sizeless-global-syms.d
ld/testsuite/ld-aarch64/morello-sizeless-got-syms.d
ld/testsuite/ld-aarch64/morello-sizeless-local-syms.d