diff options
| author | Mark Wielaard <[email protected]> | 2018-07-24 23:34:19 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2018-07-27 14:09:21 +0200 |
| commit | 9718c94bbce0dabe0ce048efa3a2a6d1ea08bce5 (patch) | |
| tree | 469ba082b135e545cbc803353c2860775cf84318 /tests/run-annobingroup.sh | |
| parent | 98ec9737922faef025ab10de15b9a653f46eaf53 (diff) | |
unstrip: Also check sh_size in compare_unalloc_sections.
compare_unalloc_sections only checked sh_flags and the section names.
This would cause stripped/debug section mismatches when there were
multiple sections with the same name and flags. Fix this by also checking
the size of the section matches.
Add a testcase that has two ".group" sections created on i386 with the
gcc annobin plugin.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests/run-annobingroup.sh')
| -rwxr-xr-x | tests/run-annobingroup.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/run-annobingroup.sh b/tests/run-annobingroup.sh index 5f08b35f..700df321 100755 --- a/tests/run-annobingroup.sh +++ b/tests/run-annobingroup.sh @@ -65,4 +65,59 @@ EOF testrun ${abs_top_builddir}/src/elfcmp testfile-annobingroup.o remerged.elf +# echo "void * __attribute__((cold)) foo (void) { return foo; }" +# > testfile-annobingroup-i386.c +# gcc -fpic -g -O2 -fplugin=annobin -c testfile-annobingroup-i386.c +testfiles testfile-annobingroup-i386.o + +testrun_compare ${abs_top_builddir}/src/readelf -g testfile-annobingroup-i386.o << EOF + +Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 entries: + [ 8] .gnu.build.attributes..text.unlikely + [ 9] .rel.gnu.build.attributes..text.unlikely + [10] .text.unlikely + +COMDAT section group [ 2] '.group' with signature '__x86.get_pc_thunk.ax' contains 1 entry: + [13] .text.__x86.get_pc_thunk.ax +EOF + +testrun ${abs_top_builddir}/src/strip -o stripped.elf -f debugfile.elf testfile-annobingroup-i386.o + +testrun_compare ${abs_top_builddir}/src/readelf -g stripped.elf << EOF + +Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 entries: + [ 8] .gnu.build.attributes..text.unlikely + [ 9] .rel.gnu.build.attributes..text.unlikely + [10] .text.unlikely + +COMDAT section group [ 2] '.group' with signature '__x86.get_pc_thunk.ax' contains 1 entry: + [13] .text.__x86.get_pc_thunk.ax +EOF + +testrun_compare ${abs_top_builddir}/src/readelf -g debugfile.elf << EOF + +Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 entries: + [ 8] .gnu.build.attributes..text.unlikely + [ 9] .rel.gnu.build.attributes..text.unlikely + [10] .text.unlikely + +COMDAT section group [ 2] '.group' with signature '__x86.get_pc_thunk.ax' contains 1 entry: + [13] .text.__x86.get_pc_thunk.ax +EOF + +testrun ${abs_top_builddir}/src/unstrip -o remerged.elf stripped.elf debugfile.elf + +testrun_compare ${abs_top_builddir}/src/readelf -g remerged.elf << EOF + +Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 entries: + [ 8] .gnu.build.attributes..text.unlikely + [ 9] .rel.gnu.build.attributes..text.unlikely + [10] .text.unlikely + +COMDAT section group [ 2] '.group' with signature '__x86.get_pc_thunk.ax' contains 1 entry: + [13] .text.__x86.get_pc_thunk.ax +EOF + +testrun ${abs_top_builddir}/src/elfcmp testfile-annobingroup-i386.o remerged.elf + exit 0 |
