tests: Add section attribute to defeat -freorder-blocks-and-partition.
authorMark Wielaard <mark@klomp.org>
Tue, 11 Sep 2018 10:58:14 +0000 (12:58 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 11 Sep 2018 10:58:14 +0000 (12:58 +0200)
GCC could partition main into an cold and hot block causing our symbol
lookup to fail in the backtrace-dwarf testcase. Add a section attribute
on "main" so that it will be kept together.

Signed-off-by: Mark Wielaard <mark@klomp.org>
tests/ChangeLog
tests/backtrace-dwarf.c

index 2a20ffa..8d70891 100644 (file)
@@ -1,3 +1,7 @@
+2018-09-11  Mark Wielaard  <mark@klomp.org>
+
+       * backtrace-dwarf.c (main): Add section attribute.
+
 2018-07-24  Mark Wielaard  <mark@klomp.org>
 
        * run-annobingroup.sh: Add testfile-annobingroup-i386.o tests.
index e1eb492..35f25ed 100644 (file)
@@ -124,6 +124,7 @@ thread_callback (Dwfl_Thread *thread, void *thread_arg)
 }
 
 int
+__attribute__((section(".main"))) /* Defeat -freorder-blocks-and-partition  */
 main (int argc __attribute__ ((unused)), char **argv)
 {
   /* We use no threads here which can interfere with handling a stream.  */