toolchain: add hidden symbol for PIE support
authorWaldemar Brodkorb <wbx@openadk.org>
Mon, 11 Jul 2016 14:35:14 +0000 (16:35 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 24 Jul 2016 19:44:22 +0000 (21:44 +0200)
uClibc-ng does not support PIE for some architectures as
arc and m68k. It isn't implemented in the static linking case, too.
With musl toolchains you might have static PIE support with little
patching of gcc. Static linking for GNU libc isn't enabled in
buildroot. Fixup any package using special treatment of PIE.
(grep -ir pie package/*/*.mk)

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
[Thomas: use positive logic.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13 files changed:
package/bluez_utils/bluez_utils.mk
package/cifs-utils/cifs-utils.mk
package/libmemcached/libmemcached.mk
package/libsodium/libsodium.mk
package/lvm2/lvm2.mk
package/openssh/openssh.mk
package/openswan/openswan.mk
package/pure-ftpd/pure-ftpd.mk
package/quagga/quagga.mk
package/tinc/tinc.mk
package/trousers/trousers.mk
toolchain/Config.in
toolchain/toolchain-common.in

index 91c2905603c6044a58db3d63b6b78448b9f94f37..1c93f2e5f5a96c665b2fd14c899217e5a5c1b171 100644 (file)
@@ -54,8 +54,7 @@ BLUEZ_UTILS_CONF_OPTS +=      \
        --disable-usb
 endif
 
-# PIE is broken for m68k
-ifeq ($(BR2_m68k),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 BLUEZ_UTILS_CONF_OPTS += --disable-pie
 endif
 
index c90a504103d0e023b30c876179e8d723d30870c0..6cd45e0cfb0c52e183b405a2aa210dc9a89d67e6 100644 (file)
@@ -10,7 +10,7 @@ CIFS_UTILS_SITE = http://ftp.samba.org/pub/linux-cifs/cifs-utils
 CIFS_UTILS_LICENSE = GPLv3+
 CIFS_UTILS_LICENSE_FILES = COPYING
 
-ifneq ($(BR2_STATIC_LIBS)$(BR2_m68k),)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 CIFS_UTILS_CONF_OPTS += --disable-pie
 endif
 
index a5ea4f5d3e746b9f4d7a2607e52f54615641b88a..36d09139620063908420a90c9a3156af893779f5 100644 (file)
@@ -18,9 +18,7 @@ LIBMEMCACHED_AUTORECONF = YES
 LIBMEMCACHED_LICENSE = BSD-3c
 LIBMEMCACHED_LICENSE_FILES = COPYING
 
-# Help libmemcached to understand that -fPIE and -pie should not be
-# used when linking statically.
-ifeq ($(BR2_STATIC_LIBS),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 LIBMEMCACHED_CONF_ENV += \
        ax_cv_check_cflags__Werror__fPIE=no \
        ax_cv_check_cflags__Werror__pie=no \
index 13dba8dec3f1b49ce44a4d1780c46bafb045620b..a8c28a6cf0bcf8a08b405386c08d08b909ce2985 100644 (file)
@@ -10,7 +10,7 @@ LIBSODIUM_LICENSE = ISC
 LIBSODIUM_LICENSE_FILES = LICENSE
 LIBSODIUM_INSTALL_STAGING = YES
 
-ifeq ($(BR2_arc),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 LIBSODIUM_CONF_OPTS += --disable-pie
 endif
 
index 0341670491f7f285a0ffc1e64bf2bf36b5368b6d..fed82739ad66ed7332465f65adf135399fd8a0f7 100644 (file)
@@ -43,7 +43,7 @@ else
 LVM2_CONF_OPTS += --disable-applib
 endif
 
-ifeq ($(BR2_arc)$(BR2_m68k),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 LVM2_CONF_ENV += ac_cv_flag_HAVE_PIE=no
 endif
 
index 856646c0732e6951083e78c2f4279804cdc98019..8f85d0a8f485a902ce08d304e5e643cd1cef2ce3 100644 (file)
@@ -22,12 +22,7 @@ define OPENSSH_USERS
        sshd -1 sshd -1 * - - - SSH drop priv user
 endef
 
-# uClibc toolchain for ARC doesn't support PIE at the moment
-ifeq ($(BR2_arc),y)
-OPENSSH_CONF_OPTS += --without-pie
-endif
-# PIE and static does not work on Linux
-ifeq ($(BR2_STATIC_LIBS),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 OPENSSH_CONF_OPTS += --without-pie
 endif
 
index 54bd4b3eff5b3b77771cf11ed793019fcfb73bd8..5c8e143b4cfdc545e680ca3778f522837f4d8126 100644 (file)
@@ -11,8 +11,8 @@ OPENSWAN_LICENSE_FILES = COPYING LICENSE
 
 OPENSWAN_DEPENDENCIES = host-bison host-flex gmp iproute2
 OPENSWAN_MAKE_OPTS = ARCH=$(BR2_ARCH) CC="$(TARGET_CC)" \
-       USERCOMPILE="$(TARGET_CFLAGS) $(if $(BR2_STATIC_LIBS),,-fPIE)" \
-       USERLINK="$(TARGET_LDFLAGS) $(if $(BR2_STATIC_LIBS),,-fPIE)" \
+       USERCOMPILE="$(TARGET_CFLAGS) $(if $(BR2_TOOLCHAIN_SUPPORTS_PIE),-fPIE)" \
+       USERLINK="$(TARGET_LDFLAGS) $(if $(BR2_TOOLCHAIN_SUPPORTS_PIE),-fPIE)" \
        INC_USRLOCAL=/usr USE_KLIPS=false USE_MAST=false USE_NM=false
 
 ifeq ($(BR2_PACKAGE_LIBCURL),y)
index e1040fa15959843b0240aa9dd5dc6801a4180f08..ba4096c2813eb5310fed335f0b0b51c34b73abce 100644 (file)
@@ -41,7 +41,7 @@ else
 PURE_FTPD_CONF_OPTS += --without-tls
 endif
 
-ifeq ($(BR2_arc),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 PURE_FTPD_CONF_ENV += ax_cv_check_cflags___fPIE=no ax_cv_check_ldflags___fPIE=no
 endif
 
index 1bbc72dee7a517a3e23d8fe9f2af1400a88fff24..ad2aff4ea8170a1c7448238b22cd8c7b69d24c07 100644 (file)
@@ -68,7 +68,7 @@ else
 QUAGGA_CONF_OPTS += --disable-vtysh
 endif
 
-ifeq ($(BR2_arc),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 QUAGGA_CONF_OPTS += --disable-pie
 endif
 
index cb0785ba34aaad90749cf251a1aaa52c8bd0ee55..fb15c34b7476adbb26a2343ac3ca7e4054ecf053 100644 (file)
@@ -11,7 +11,7 @@ TINC_LICENSE = GPLv2+ with OpenSSL exception
 TINC_LICENSE_FILES = COPYING COPYING.README
 TINC_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=c99"
 
-ifeq ($(BR2_arc),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 TINC_CONF_ENV += \
        ax_cv_check_cflags___fPIE=no \
        ax_cv_check_ldflags___pie=no
index 70daa881727a4fcede2bf7aa149365c99c059bca..be6ce390a7e9d5a06c59ab849ecf4e964ac65d84 100644 (file)
@@ -23,8 +23,7 @@ endif
 # workaround.
 TROUSERS_CONF_OPTS += --disable-usercheck
 
-# uClibc toolchain for ARC doesn't support PIE at the moment
-ifeq ($(BR2_arc),y)
+ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
 TROUSERS_CONF_ENV += \
        ax_cv_check_cflags___fPIE__DPIE=no \
        ax_cv_check_ldflags___pie=no
index a7255566f878b8002c1ea00439c10d1135fa1b6a..57523805acf127652c982b0dc7868db7add740e9 100644 (file)
@@ -15,9 +15,11 @@ config BR2_TOOLCHAIN_USES_GLIBC
        select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
        select BR2_TOOLCHAIN_HAS_THREADS_NPTL
        select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
+       select BR2_TOOLCHAIN_SUPPORTS_PIE
 
 config BR2_TOOLCHAIN_USES_UCLIBC
        bool
+       select BR2_TOOLCHAIN_SUPPORTS_PIE if !BR2_arc && !BR2_m68k && !BR2_STATIC_LIBS
 
 config BR2_TOOLCHAIN_USES_MUSL
        bool
@@ -26,6 +28,7 @@ config BR2_TOOLCHAIN_USES_MUSL
        select BR2_TOOLCHAIN_HAS_THREADS
        select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
        select BR2_TOOLCHAIN_HAS_THREADS_NPTL
+       select BR2_TOOLCHAIN_SUPPORTS_PIE
 
 choice
        prompt "Toolchain type"
index 65df31be9b2f4e37c0bfd231f85fd7b4952a827d..d69acf2644e5552e3e04ac3368b7b37f4b607733 100644 (file)
@@ -39,6 +39,9 @@ config BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
 config BR2_TOOLCHAIN_HAS_SSP
        bool
 
+config BR2_TOOLCHAIN_SUPPORTS_PIE
+       bool
+
 config BR2_ENABLE_LOCALE_PURGE
        bool "Purge unwanted locales"
        help