This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tests/backtrace-dwarf.c failure due to -freorder-blocks-and-partition


Hi Martin,

Sorry for dropping this after you provided such an excellent analysis.
So the problem really is that main gets split into main.cold which is
jumped into, so a simple backtrace won't see the "hot" main anymore. If
we would use the debuginfo we might be able to get the "correct"
function name, but that isn't really the purpose of this testcase.

The only problem is that I haven't been able to replicate this in the
testsuite (I do see the partitioning in the standalone testcase you
posted).

Is it just run-backtrace-dwarf that is a problem for you?
In that case, does the attached patch help? It puts all of main in its
own section, which should prevent gcc from partitioning it.

Thanks,

Mark
diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index e1eb492..35f25ed 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -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.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]