diff options
author | Mark Wielaard <mark@klomp.org> | 2020-09-03 09:42:32 -0400 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-09-07 11:23:54 +0200 |
commit | 18d64cd8e7ce0761568631bb40136ca7a154b6e0 (patch) | |
tree | ef5e71c8f41f426f0a628b491bd01e2137c255ac /tests | |
parent | f1a0e680aa0f4e9fcdf10afcea075a833a5a9e4a (diff) | |
download | elfutils-18d64cd8e7ce0761568631bb40136ca7a154b6e0.tar.gz |
libebl: Handle aarch64 bti, pac bits in gnu property note
When building with gcc -mbranch-protection= we might get a gnu property
note indicating BTI (Branch Target Identification) and/or PAC (Pointer
Authentication Code) is being used.
Add a small testcase to show eu-readelf -n now properly lists those
bits in the gnu property note.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 7 | ||||
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rwxr-xr-x | tests/run-readelf-n.sh | 31 | ||||
-rwxr-xr-x | tests/testfile-gnu-property-note-aarch64.bz2 | bin | 0 -> 1952 bytes |
4 files changed, 39 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 047100b0..61c6cb7c 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2020-09-03 Mark Wielaard <mark@klomp.org> + + * testfile-gnu-property-note-aarch64.bz2: New file. + * run-readelf-n.sh: Handle testfile-gnu-property-note-aarch64. + * Makefile.am (EXTRA_DIST): Add + testfile-gnu-property-note-aarch64.bz2. + 2020-07-19 Mark Wielaard <mark@klomp.org> * asm-tst1.c: Include libebl.h after libasm.h. diff --git a/tests/Makefile.am b/tests/Makefile.am index d30b8218..939bbb6a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -319,6 +319,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ testfile_gnu_props.64le.o.bz2 \ testfile_gnu_props.32be.o.bz2 \ testfile_gnu_props.64be.o.bz2 \ + testfile-gnu-property-note-aarch64.bz2 \ run-allfcts-multi.sh \ test-offset-loop.bz2 test-offset-loop.alt.bz2 \ run-prelink-addr-test.sh \ diff --git a/tests/run-readelf-n.sh b/tests/run-readelf-n.sh index cc7d7f66..4c98fd82 100755 --- a/tests/run-readelf-n.sh +++ b/tests/run-readelf-n.sh @@ -226,3 +226,34 @@ Note section [ 4] '.note.gnu.property' of 56 bytes at offset 0x40: GNU 8 GNU_PROPERTY_TYPE_0 NO_COPY_ON_PROTECTION EOF + +# - testfile-gnu-property-note.c +# int +# main () +# { +# return 0; +# } +# +# gcc -mbranch-protection=standard -c testfile-gnu-property-note.c +# gcc -o testfile-gnu-property-note-aarch64 testfile-gnu-property-note.o +# eu-strip --remove-section=.gnu.build.attributes \ +# testfile-gnu-property-note-aarch64 + +testfiles testfile-gnu-property-note-aarch64 +testrun_compare ${abs_top_builddir}/src/readelf -n testfile-gnu-property-note-aarch64 << EOF + +Note section [ 2] '.note.gnu.property' of 32 bytes at offset 0x2c8: + Owner Data size Type + GNU 16 GNU_PROPERTY_TYPE_0 + AARCH64 FEATURE_1_AND: 00000003 BTI PAC + +Note section [ 3] '.note.gnu.build-id' of 36 bytes at offset 0x2e8: + Owner Data size Type + GNU 20 GNU_BUILD_ID + Build ID: af82d6df6f3b396487e3e27a826ca9cbbbecbe5f + +Note section [ 4] '.note.ABI-tag' of 32 bytes at offset 0x30c: + Owner Data size Type + GNU 16 GNU_ABI_TAG + OS: Linux, ABI: 3.7.0 +EOF diff --git a/tests/testfile-gnu-property-note-aarch64.bz2 b/tests/testfile-gnu-property-note-aarch64.bz2 Binary files differnew file mode 100755 index 00000000..2fe37b19 --- /dev/null +++ b/tests/testfile-gnu-property-note-aarch64.bz2 |