toolchain: add hidden symbol for PIE support

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>
This commit is contained in:
Waldemar Brodkorb 2016-07-11 16:35:14 +02:00 committed by Thomas Petazzoni
parent 58b573c252
commit 3c93901bcd
13 changed files with 18 additions and 21 deletions

View File

@ -54,8 +54,7 @@ BLUEZ_UTILS_CONF_OPTS += \
--disable-usb --disable-usb
endif endif
# PIE is broken for m68k ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
ifeq ($(BR2_m68k),y)
BLUEZ_UTILS_CONF_OPTS += --disable-pie BLUEZ_UTILS_CONF_OPTS += --disable-pie
endif endif

View File

@ -10,7 +10,7 @@ CIFS_UTILS_SITE = http://ftp.samba.org/pub/linux-cifs/cifs-utils
CIFS_UTILS_LICENSE = GPLv3+ CIFS_UTILS_LICENSE = GPLv3+
CIFS_UTILS_LICENSE_FILES = COPYING CIFS_UTILS_LICENSE_FILES = COPYING
ifneq ($(BR2_STATIC_LIBS)$(BR2_m68k),) ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
CIFS_UTILS_CONF_OPTS += --disable-pie CIFS_UTILS_CONF_OPTS += --disable-pie
endif endif

View File

@ -18,9 +18,7 @@ LIBMEMCACHED_AUTORECONF = YES
LIBMEMCACHED_LICENSE = BSD-3c LIBMEMCACHED_LICENSE = BSD-3c
LIBMEMCACHED_LICENSE_FILES = COPYING LIBMEMCACHED_LICENSE_FILES = COPYING
# Help libmemcached to understand that -fPIE and -pie should not be ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
# used when linking statically.
ifeq ($(BR2_STATIC_LIBS),y)
LIBMEMCACHED_CONF_ENV += \ LIBMEMCACHED_CONF_ENV += \
ax_cv_check_cflags__Werror__fPIE=no \ ax_cv_check_cflags__Werror__fPIE=no \
ax_cv_check_cflags__Werror__pie=no \ ax_cv_check_cflags__Werror__pie=no \

View File

@ -10,7 +10,7 @@ LIBSODIUM_LICENSE = ISC
LIBSODIUM_LICENSE_FILES = LICENSE LIBSODIUM_LICENSE_FILES = LICENSE
LIBSODIUM_INSTALL_STAGING = YES LIBSODIUM_INSTALL_STAGING = YES
ifeq ($(BR2_arc),y) ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
LIBSODIUM_CONF_OPTS += --disable-pie LIBSODIUM_CONF_OPTS += --disable-pie
endif endif

View File

@ -43,7 +43,7 @@ else
LVM2_CONF_OPTS += --disable-applib LVM2_CONF_OPTS += --disable-applib
endif endif
ifeq ($(BR2_arc)$(BR2_m68k),y) ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
LVM2_CONF_ENV += ac_cv_flag_HAVE_PIE=no LVM2_CONF_ENV += ac_cv_flag_HAVE_PIE=no
endif endif

View File

@ -22,12 +22,7 @@ define OPENSSH_USERS
sshd -1 sshd -1 * - - - SSH drop priv user sshd -1 sshd -1 * - - - SSH drop priv user
endef endef
# uClibc toolchain for ARC doesn't support PIE at the moment ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
ifeq ($(BR2_arc),y)
OPENSSH_CONF_OPTS += --without-pie
endif
# PIE and static does not work on Linux
ifeq ($(BR2_STATIC_LIBS),y)
OPENSSH_CONF_OPTS += --without-pie OPENSSH_CONF_OPTS += --without-pie
endif endif

View File

@ -11,8 +11,8 @@ OPENSWAN_LICENSE_FILES = COPYING LICENSE
OPENSWAN_DEPENDENCIES = host-bison host-flex gmp iproute2 OPENSWAN_DEPENDENCIES = host-bison host-flex gmp iproute2
OPENSWAN_MAKE_OPTS = ARCH=$(BR2_ARCH) CC="$(TARGET_CC)" \ OPENSWAN_MAKE_OPTS = ARCH=$(BR2_ARCH) CC="$(TARGET_CC)" \
USERCOMPILE="$(TARGET_CFLAGS) $(if $(BR2_STATIC_LIBS),,-fPIE)" \ USERCOMPILE="$(TARGET_CFLAGS) $(if $(BR2_TOOLCHAIN_SUPPORTS_PIE),-fPIE)" \
USERLINK="$(TARGET_LDFLAGS) $(if $(BR2_STATIC_LIBS),,-fPIE)" \ USERLINK="$(TARGET_LDFLAGS) $(if $(BR2_TOOLCHAIN_SUPPORTS_PIE),-fPIE)" \
INC_USRLOCAL=/usr USE_KLIPS=false USE_MAST=false USE_NM=false INC_USRLOCAL=/usr USE_KLIPS=false USE_MAST=false USE_NM=false
ifeq ($(BR2_PACKAGE_LIBCURL),y) ifeq ($(BR2_PACKAGE_LIBCURL),y)

View File

@ -41,7 +41,7 @@ else
PURE_FTPD_CONF_OPTS += --without-tls PURE_FTPD_CONF_OPTS += --without-tls
endif 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 PURE_FTPD_CONF_ENV += ax_cv_check_cflags___fPIE=no ax_cv_check_ldflags___fPIE=no
endif endif

View File

@ -68,7 +68,7 @@ else
QUAGGA_CONF_OPTS += --disable-vtysh QUAGGA_CONF_OPTS += --disable-vtysh
endif endif
ifeq ($(BR2_arc),y) ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
QUAGGA_CONF_OPTS += --disable-pie QUAGGA_CONF_OPTS += --disable-pie
endif endif

View File

@ -11,7 +11,7 @@ TINC_LICENSE = GPLv2+ with OpenSSL exception
TINC_LICENSE_FILES = COPYING COPYING.README TINC_LICENSE_FILES = COPYING COPYING.README
TINC_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=c99" TINC_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=c99"
ifeq ($(BR2_arc),y) ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
TINC_CONF_ENV += \ TINC_CONF_ENV += \
ax_cv_check_cflags___fPIE=no \ ax_cv_check_cflags___fPIE=no \
ax_cv_check_ldflags___pie=no ax_cv_check_ldflags___pie=no

View File

@ -23,8 +23,7 @@ endif
# workaround. # workaround.
TROUSERS_CONF_OPTS += --disable-usercheck TROUSERS_CONF_OPTS += --disable-usercheck
# uClibc toolchain for ARC doesn't support PIE at the moment ifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
ifeq ($(BR2_arc),y)
TROUSERS_CONF_ENV += \ TROUSERS_CONF_ENV += \
ax_cv_check_cflags___fPIE__DPIE=no \ ax_cv_check_cflags___fPIE__DPIE=no \
ax_cv_check_ldflags___pie=no ax_cv_check_ldflags___pie=no

View File

@ -15,9 +15,11 @@ config BR2_TOOLCHAIN_USES_GLIBC
select BR2_TOOLCHAIN_HAS_THREADS_DEBUG select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
select BR2_TOOLCHAIN_HAS_THREADS_NPTL select BR2_TOOLCHAIN_HAS_THREADS_NPTL
select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
select BR2_TOOLCHAIN_SUPPORTS_PIE
config BR2_TOOLCHAIN_USES_UCLIBC config BR2_TOOLCHAIN_USES_UCLIBC
bool bool
select BR2_TOOLCHAIN_SUPPORTS_PIE if !BR2_arc && !BR2_m68k && !BR2_STATIC_LIBS
config BR2_TOOLCHAIN_USES_MUSL config BR2_TOOLCHAIN_USES_MUSL
bool bool
@ -26,6 +28,7 @@ config BR2_TOOLCHAIN_USES_MUSL
select BR2_TOOLCHAIN_HAS_THREADS select BR2_TOOLCHAIN_HAS_THREADS
select BR2_TOOLCHAIN_HAS_THREADS_DEBUG select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
select BR2_TOOLCHAIN_HAS_THREADS_NPTL select BR2_TOOLCHAIN_HAS_THREADS_NPTL
select BR2_TOOLCHAIN_SUPPORTS_PIE
choice choice
prompt "Toolchain type" prompt "Toolchain type"

View File

@ -39,6 +39,9 @@ config BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
config BR2_TOOLCHAIN_HAS_SSP config BR2_TOOLCHAIN_HAS_SSP
bool bool
config BR2_TOOLCHAIN_SUPPORTS_PIE
bool
config BR2_ENABLE_LOCALE_PURGE config BR2_ENABLE_LOCALE_PURGE
bool "Purge unwanted locales" bool "Purge unwanted locales"
help help