[lttng-dev] gcc 4.8.4 linker crashes if use "-O3 -flto" with TRACEPOINT_LOGLEVEL()

John Smith whalajam at gmail.com
Tue Dec 1 21:22:50 EST 2015


Hi,
gcc linker crashes when using -flto gcc (link time optimization), wondering
if you can provide a work around. The cause seems to be the
TRACEPOINT_LOGLEVEL() generated 2 lines.

Environment:
uname -a
... 3.19.0-30-generic #34~14.04.1-Ubuntu SMP Fri Oct 2 22:09:39 UTC 2015
x86_64 x86_64 x86_64 GNU/Linux

gcc version:
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)

Here is a simple sample program that crashes the gcc linker:

tst.c:
[
#include "tst_trace.h"
main(void) {
int i;
for (i = 0; i < 10; i++)
tracepoint(tst, tst_main);
}
]

tst_trace.c:
[
#define TRACEPOINT_CREATE_PROBES
#define TRACEPOINT_DEFINE
#include "./tst_trace.h"
]

tst_trace.h:
[
#undef TRACEPOINT_PROVIDER
#define TRACEPOINT_PROVIDER tst
#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "./tst_trace.h"
#if !defined(_TST_TRACE_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define _TST_TRACE_H
#include <lttng/tracepoint.h>
TRACEPOINT_EVENT(
tst, tst_main, TP_ARGS(), TP_FIELDS()
)
TRACEPOINT_LOGLEVEL(tst, tst_main, TRACE_DEBUG_UNIT)
#endif /* _TST_TRACE_H */
#include <lttng/tracepoint-event.h>
]

these compile & link command options:
[
cc -O3 -g -flto -I. -c -o tst.o tst.c
cc -O3 -g -flto -I. -c -o tst_trace.o tst_trace.c
g++ -O3 -g -flto tst_trace.o tst.o -o tst -l lttng-ust -l dl
]

crash the linker:
[
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
]
thanks, John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20151201/2fcd9c0a/attachment.html>


More information about the lttng-dev mailing list