GNU bug report logs -
#23531
C++ shared library breaks with "-pie -fpie" and libtool
Previous Next
Full log
View this message in rfc822 format
Hi folks,
I am building a C++ project [1] with libtool ; this project contains a
shared library.
Since recently, and as I am building with the Yocto project, I am
required to build with GCC security enforcement options ([2], see
SECURITY_FLAGS line).
It basically adds the following flags in CFLAGS and CXXFLAGS : "-pie -fpie"
This makes the build break on x86_64 with the following message (ARM
has a similar one) :
/usr/lib64/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
(.text+0x14): undefined reference to `__init_array_start'
/bin/ld: /usr/lib64/libc_nonshared.a(elf-init.oS): relocation
R_X86_64_PC32 against undefined hidden symbol `__init_array_start' can
not be used when making a shared object
Removing the "-pie" flag, alone, makes the build succeed.
I was told that "-pie" flag is reserved for executables, not shared
libraries or modules. But build logs [3] show that libtool is
propagating both "-pie -fpie" flags in all steps, but the final linker
step.
Is this a libtool bug, not removing "-pie" in this case ? Or should we
not include "-pie" in our CFLAGS in the first place ?
Thanks for any advice !
[1] : https://github.com/iotbzh/qml_radio_plugin
[2] : https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/conf/distro/include/security_flags.inc
[3] : http://hastebin.com/onerixofop.md
[4]: https://github.com/iotbzh/qml_radio_plugin/blob/master/Makefile.am
Regards,
Manuel Bachmann, Graphics & Multimedia Engineer
www.iot.bzh
This bug report was last modified 9 years and 121 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.