Skip to contentSkip to conversation

ELL unit test problem with Link Time Optimization, l_getrandom, test-ecdh

DISCUSSION Gix 2 participants 3 messages Nov 6, 2019

lore
Share & tools
lore

Gix

#0 lore raw

While examining my BlueZ issues with building with LTO, I came accross the following issue in the ELL unit test of ECDH:

.../ell > export CFLAGS="-flto=auto"
.../ell > ./bootstrap-configure
.../ell > make
make --no-print-directory all-am
CCLD unit/test-ecdh
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /tmp/test- ecdh.XGzxNu.ltrans0.ltrans.o: in function `__wrap_l_getrandom':
/home/bgix/work/user_space/ell/unit/test-ecdh.c:52: undefined reference to `l_getrandom'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1541: unit/test-ecdh] Error 1
make: *** [Makefile:1190: all] Error 2

This is on an up-to-date openSUSE tumbleweed VM, and I have been told that building with the LTO flag is the preferred build method on that system. This problem does not seem to affect anything *except* that one unit test, and is probably related to the explicit link rule for it in Makefile.am:

unit_test_ecdh_LDFLAGS = -Wl,-wrap,l_getrandom

#1 lore raw
Quoted 7 lines · Brian

CCLD unit/test-ecdh
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /tmp/test- ecdh.XGzxNu.ltrans0.ltrans.o: in function `__wrap_l_getrandom':
/home/bgix/work/user_space/ell/unit/test-ecdh.c:52: undefined reference to `l_getrandom'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1541: unit/test-ecdh] Error 1
make: *** [Makefile:1190: all] Error 2

FWIW, I can reproduce this issue on my Ubuntu 19.10 box:

$ make CFLAGS=-flto check
...
  CC       unit/test-ecdh.o
 CCLD     unit/test-ecdh
/usr/bin/ld: /tmp/test-ecdh.guYgVf.ltrans0.ltrans.o: in function `__wrap_l_getra
ndom':
<artificial>:(.text+0x2a): undefined reference to `l_getrandom'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1542: unit/test-ecdh] Error 1

-Ossama

#2 lore raw
In reply to Gix

Hi Brian,

Quoted 2 lines · Brian

While examining my BlueZ issues with building with LTO, I came accross the following issue in the ELL unit test of ECDH:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88643

May I suggest that the distro in question figures this out by themselves, there's nothing wrong in ell.

If they insist on using LTO, then at least disable it for that test.

Regards,
-Denis