bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23531: C++ shared library breaks with "-pie -fpie" and libtool


From: Manuel Bachmann
Subject: bug#23531: C++ shared library breaks with "-pie -fpie" and libtool
Date: Fri, 13 May 2016 14:04:00 +0200

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]