https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63613
Bug ID: 63613
Summary: Regression: Unable to link .c file using <dejagnu.h>
API (inline functions not appearing)
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Created attachment 33777
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33777&action=edit
Preprocessed reproducer
I'm no longer able to build test programs that use the <dejagnu.h>
header, due to a linker failure.
$ cat ../../test-dg-api.c
#include <dejagnu.h>
int
main (int argc, char **argv)
{
pass ("got here");
return 0;
}
The dejagnu.h API consists purely of functions marked "inline" e.g.:
63 inline void
64 pass (const char* fmt, ...)
65 {
66 va_list ap;
67
68 passed++;
69 va_start (ap, fmt);
70 vsnprintf (buffer, sizeof (buffer), fmt, ap);
71 va_end (ap);
72 printf ("\tPASSED: %s\n", buffer);
73 wait ();
74 }
See http://git.savannah.gnu.org/cgit/dejagnu.git/tree/dejagnu.h
With gcc 4.8.3:
$ gcc ../../test-dg-api.c -o test-dg-api
$ ./test-dg-api
PASSED: got here
and examination of the generated assembler shows it contains an
implementation of e.g. "pass".
With trunk:
$ ./xgcc -B. ../../test-dg-api.c -o test-dg-api
/tmp/ccc7PdfM.o: In function `main':
test-dg-api.c:(.text+0x21): undefined reference to `pass'
collect2: error: ld returned 1 exit status
and the generated asm doesn't contain an implementation of "pass".
This is with r216530. I believe the problem appears somewhere between
r215958: WORKS (aka e012cdc775868e9922f5fef9068a764546876d93, 2014-10-06)
and
r216524: ERROR (aka d14cac46135326115f0dc589b0b3d2d249d74cf7, 2014-10-21)
Am attempting to isolate further.
With -v -save-temps:
$ ./xgcc -B. -v -save-temps ../../test-dg-api.c -o test-dg-api
command line of cc1 is:
./cc1 -fpreprocessed test-dg-api.i -quiet -dumpbase test-dg-api.c
-mtune=generic -march=x86-64 -auxbase test-dg-api -version -o test-dg-api.s
and link line:
./collect2 -plugin ./liblto_plugin.so -plugin-opt=./lto-wrapper
-plugin-opt=-fresolution=test-dg-api.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o
test-dg-api /lib/../lib64/crt1.o /lib/../lib64/crti.o ./crtbegin.o -L.
-L/lib/../lib64 -L/usr/lib/../lib64 test-dg-api.o -lgcc --as-needed -lgcc_s
--no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed ./crtend.o
/lib/../lib64/crtn.o
Will attach the test-dg-api.i
This is with build,host,target==x86_64-unknown-linux-gnu (Fedora 20 x86_64)
This affects merger of my jit branch, since my testsuite is based on
dejagnu.h.