if (shdr1->sh_flags > shdr2->sh_flags)
return 1;
+ /* Sizes should be the same. */
+ if (shdr1->sh_size < shdr2->sh_size)
+ return -1;
+ if (shdr1->sh_size > shdr2->sh_size)
+ return 1;
+
/* Sort by name as last resort. */
return strcmp (name1, name2);
}
+2018-07-24 Mark Wielaard <mark@klomp.org>
+
+ * run-annobingroup.sh: Add testfile-annobingroup-i386.o tests.
+ * testfile-annobingroup-i386.o.bz2: New test file.
+ * Makefile.am (EXTRA_DIST): Add testfile-annobingroup-i386.o.bz2.
+
2018-07-21 Mark Wielaard <mark@klomp.org>
* run-annobingroup.sh: New test.
run-strip-test12.sh \
run-strip-nothing.sh run-strip-remove-keep.sh run-strip-g.sh \
run-annobingroup.sh testfile-annobingroup.o.bz2 \
+ testfile-annobingroup-i386.o.bz2 \
run-strip-strmerge.sh run-strip-nobitsalign.sh \
testfile-nobitsalign.bz2 testfile-nobitsalign.strip.bz2 \
run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \
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