From 09fb97d7d33d74eeabb8fcecc84daf936a1f0e89 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 21 Sep 2018 21:33:10 +0100 Subject: [PATCH] More test tweaks --- tests/missing-notes-test | 17 +++++++++++++---- tests/property-note.S | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/missing-notes-test b/tests/missing-notes-test index 4381fc2..3985cf8 100755 --- a/tests/missing-notes-test +++ b/tests/missing-notes-test @@ -19,7 +19,16 @@ GCC=gcc PLUGIN=../plugin/.libs/annobin.so OPTS="-c -O2 -D_FORTIFY_SOURCE=2 -fPIE -fstack-protector-strong -D_GLIBCXX_ASSERTIONS -fstack-clash-protection" -EXTRA_OPTS="-fcf-protection -mstackrealign" + +# FIXME: Horrible hack time. This test passes on the i686 target, when it +# should fail. The reason is that the linker places a __x86.get_pc_thunk +# stub function at the end of the compiled hello2.o file. Annochecks picks +# up on this, and decides that it can ignore the gap. In real i686 binaries +# this is a good thing. In our test code it is bad. So in order to trigger +# a failure on the i686 target, without affecting other targets, I have +# dropped -mstack-realign from EXTRA_OPTS. Annocheck will detect this and +# report a failure... +EXTRA_OPTS="-fcf-protection" $GCC -fplugin=$PLUGIN -g $OPTS $EXTRA_OPTS $srcdir/hello_hard.c if [ $? != 0 ]; @@ -55,11 +64,11 @@ $GCC -fplugin=$PLUGIN $OPTS $EXTRA_OPTS $srcdir/hello3.c $GCC -fplugin=$PLUGIN $OPTS $EXTRA_OPTS -shared $srcdir/hello_lib.c -o libhello.so -$GCC -L . -pie -Wl,-z,now -Wl,-z,relro -Wl,--print-gc-sections \ +$GCC -L . -pie -Wl,-z,now -Wl,-z,relro \ hello.o hello2.o hello3.o -lhello -o missing-notes-test.exe -readelf --wide --notes --sections missing-notes-test.exe -nm missing-notes-test.exe | grep foo +# Debugging... +# readelf --wide --notes --sections --syms missing-notes-test.exe # FIXME - we should check that the notes were parsed correctly... ../annocheck/annocheck -v missing-notes-test.exe diff --git a/tests/property-note.S b/tests/property-note.S index a621c55..75aab20 100644 --- a/tests/property-note.S +++ b/tests/property-note.S @@ -36,7 +36,7 @@ text_end: .dc.b 0x47, 0x41, 0x24, 0x1, 0x33, 0x70 # name (string: version) .dc.b 0x38, 0 data_start: - .dc.p text_start # description (symbol name) - .dc.p text_end + .dc.a text_start # description (symbol name) + .dc.a text_end data_end: -- 2.43.5