* [Buildroot] [PATCH 0/3] Fix SSP related build failures
@ 2015-10-17 13:09 Thomas Petazzoni
2015-10-17 13:09 ` [Buildroot] [PATCH 1/3] toolchain: like glibc, musl always provides SSP support Thomas Petazzoni
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2015-10-17 13:09 UTC (permalink / raw)
To: buildroot
Hello,
This set of patches aim at fixing the SSP related build failures that
occur with uClibc configurations that don't have SSP support enabled.
The original problem starts when uClibc-ng recently changed the glibc
minor version it pretends to be. Due to this change, gcc know believe
that uClibc always has SSP support (because the corresponding glibc
minor version always has SSP support). This was causing build failures
in programs such as "sudo", which are using SSP support:
http://autobuild.buildroot.org/results/778/778e6309ba834cc70f8243a4f6c664c0bcaeb7c5/
In order to fix this, we explicitly pass the appropriate autoconf
variable to gcc to tell whether the C library has SSP support or
not. It was already done during gcc-initial (because the C library
isn't available at that time), but is now also done at gcc-final time.
It was tested with:
- internal toolchain with glibc. SSP support is properly generated,
and 'sudo' is indeed using it.
- internal toolchain with uClibc and SSP enabled. Same test: sudo
builds fine, and uses SSP.
- internal toolchain with uClibc, SSP disabled. Same test: sudo
builds fine, but of course doesn't use SSP support.
- internal toolchain with musl. SSP support is properly generated,
and 'sudo' is using it.
Best regards,
Thomas
Thomas Petazzoni (3):
toolchain: like glibc, musl always provides SSP support
gcc: pass explicit gcc_cv_libc_provides_ssp also to gcc-final
gcc: simplify musl patches for SSP support
package/gcc/4.7.4/900-musl-support.patch | 36 ----------------------------
package/gcc/4.8.5/900-musl-support.patch | 36 ----------------------------
package/gcc/4.9.3/900-musl-support.patch | 36 ----------------------------
package/gcc/5.2.0/904-musl-libc-config.patch | 36 ----------------------------
package/gcc/gcc-final/gcc-final.mk | 2 ++
package/gcc/gcc-initial/gcc-initial.mk | 5 +---
package/gcc/gcc.mk | 10 ++++++++
toolchain/Config.in | 1 +
8 files changed, 14 insertions(+), 148 deletions(-)
--
2.6.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 1/3] toolchain: like glibc, musl always provides SSP support
2015-10-17 13:09 [Buildroot] [PATCH 0/3] Fix SSP related build failures Thomas Petazzoni
@ 2015-10-17 13:09 ` Thomas Petazzoni
2015-10-17 20:02 ` Yann E. MORIN
2015-10-17 13:09 ` [Buildroot] [PATCH 2/3] gcc: pass explicit gcc_cv_libc_provides_ssp also to gcc-final Thomas Petazzoni
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2015-10-17 13:09 UTC (permalink / raw)
To: buildroot
Make sure BR2_TOOLCHAIN_USES_MUSL selects BR2_TOOLCHAIN_HAS_SSP since
musl always provides SSP support (like glibc).
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
toolchain/Config.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index a851ce4..fc30c6e 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -27,6 +27,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_HAS_SSP
choice
prompt "Toolchain type"
--
2.6.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/3] gcc: pass explicit gcc_cv_libc_provides_ssp also to gcc-final
2015-10-17 13:09 [Buildroot] [PATCH 0/3] Fix SSP related build failures Thomas Petazzoni
2015-10-17 13:09 ` [Buildroot] [PATCH 1/3] toolchain: like glibc, musl always provides SSP support Thomas Petazzoni
@ 2015-10-17 13:09 ` Thomas Petazzoni
2015-10-17 20:04 ` Yann E. MORIN
2015-10-17 13:09 ` [Buildroot] [PATCH 3/3] gcc: simplify musl patches for SSP support Thomas Petazzoni
2015-10-18 13:40 ` [Buildroot] [PATCH 0/3] Fix SSP related build failures Thomas Petazzoni
3 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2015-10-17 13:09 UTC (permalink / raw)
To: buildroot
During the gcc-initial build, we already pass
gcc_cv_libc_provides_ssp=yes explicitly when SSP support will be
available in the C library: at this point in time the C library is not
yet built, so gcc cannot detect if it will support SSP or not.
However, it turns out that there are some situations for which it is
also useful to tell gcc explicitly whether the SSP support is
available or not: the gcc logic to decide whether uClibc has SSP
support or not is broken since uClibc-ng bumped the glibc version it
pretends to be.
So, this commit makes sure that we explicitly pass
gcc_cv_libc_provides_ssp both to gcc-initial and gcc-final, and that
we're always passing either 'yes' or 'no'.
Fixes:
http://autobuild.buildroot.org/results/778/778e6309ba834cc70f8243a4f6c664c0bcaeb7c5/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
package/gcc/gcc-final/gcc-final.mk | 2 ++
package/gcc/gcc-initial/gcc-initial.mk | 5 +----
package/gcc/gcc.mk | 10 ++++++++++
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index a5be3c7..5a0f5b5 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -85,6 +85,8 @@ HOST_GCC_FINAL_CONF_OPTS += \
HOST_GCC_FINAL_CONF_ENV = \
$(HOST_GCC_COMMON_CONF_ENV)
+HOST_GCC_FINAL_MAKE_OPTS += $(HOST_GCC_COMMON_MAKE_OPTS)
+
# Make sure we have 'cc'
define HOST_GCC_FINAL_CREATE_CC_SYMLINKS
if [ ! -e $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc ]; then \
diff --git a/package/gcc/gcc-initial/gcc-initial.mk b/package/gcc/gcc-initial/gcc-initial.mk
index 4b03e47..c0b5eaf 100644
--- a/package/gcc/gcc-initial/gcc-initial.mk
+++ b/package/gcc/gcc-initial/gcc-initial.mk
@@ -51,10 +51,7 @@ HOST_GCC_INITIAL_CONF_OPTS = \
HOST_GCC_INITIAL_CONF_ENV = \
$(HOST_GCC_COMMON_CONF_ENV)
-# We need to tell gcc that the C library will be providing the ssp
-# support, as it can't guess it since the C library hasn't been built
-# yet (we're gcc-initial).
-HOST_GCC_INITIAL_MAKE_OPTS = $(if $(BR2_TOOLCHAIN_HAS_SSP),gcc_cv_libc_provides_ssp=yes) all-gcc
+HOST_GCC_INITIAL_MAKE_OPTS = $(HOST_GCC_COMMON_MAKE_OPTS) all-gcc
HOST_GCC_INITIAL_INSTALL_OPTS = install-gcc
ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index ef606c4..d6213cc 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -238,6 +238,16 @@ endif
HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"'
+# For gcc-initial, we need to tell gcc that the C library will be
+# providing the ssp support, as it can't guess it since the C library
+# hasn't been built yet.
+#
+# For gcc-final, the gcc logic to detect whether SSP support is
+# available or not in the C library is not working properly for
+# uClibc, so let's be explicit as well.
+HOST_GCC_COMMON_MAKE_OPTS = \
+ gcc_cv_libc_provides_ssp=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
+
ifeq ($(BR2_CCACHE),y)
HOST_GCC_COMMON_CCACHE_HASH_FILES += $(DL_DIR)/$(GCC_SOURCE)
# Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned and
--
2.6.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 3/3] gcc: simplify musl patches for SSP support
2015-10-17 13:09 [Buildroot] [PATCH 0/3] Fix SSP related build failures Thomas Petazzoni
2015-10-17 13:09 ` [Buildroot] [PATCH 1/3] toolchain: like glibc, musl always provides SSP support Thomas Petazzoni
2015-10-17 13:09 ` [Buildroot] [PATCH 2/3] gcc: pass explicit gcc_cv_libc_provides_ssp also to gcc-final Thomas Petazzoni
@ 2015-10-17 13:09 ` Thomas Petazzoni
2015-10-17 20:08 ` Yann E. MORIN
2015-10-18 13:40 ` [Buildroot] [PATCH 0/3] Fix SSP related build failures Thomas Petazzoni
3 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2015-10-17 13:09 UTC (permalink / raw)
To: buildroot
Now that we are always explicitly passing gcc_cv_libc_provides_ssp,
there is no longer any reason to modify the gcc configure/configure.ac
to take into account the musl case. When a musl toolchain is being
built, BR2_TOOLCHAIN_HAS_SSP is always 'y', and therefore
gcc_cv_libc_provides_ssp=yes is always passed when building
gcc-initial and gcc-final.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
package/gcc/4.7.4/900-musl-support.patch | 36 ----------------------------
package/gcc/4.8.5/900-musl-support.patch | 36 ----------------------------
package/gcc/4.9.3/900-musl-support.patch | 36 ----------------------------
package/gcc/5.2.0/904-musl-libc-config.patch | 36 ----------------------------
4 files changed, 144 deletions(-)
diff --git a/package/gcc/4.7.4/900-musl-support.patch b/package/gcc/4.7.4/900-musl-support.patch
index 1cb6701..67b8c30 100644
--- a/package/gcc/4.7.4/900-musl-support.patch
+++ b/package/gcc/4.7.4/900-musl-support.patch
@@ -323,24 +323,6 @@ Index: b/gcc/configure
===================================================================
--- a/gcc/configure
+++ b/gcc/configure
-@@ -26791,6 +26791,9 @@
- else
- gcc_cv_libc_provides_ssp=no
- case "$target" in
-+ *-*-musl*)
-+ # All versions of musl provide stack protector
-+ gcc_cv_libc_provides_ssp=yes;;
- *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
- # glibc 2.4 and later provides __stack_chk_fail and
- # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -26824,6 +26827,7 @@
- # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
- # simply assert that glibc does provide this, which is true for all
- # realistically usable GNU/Hurd configurations.
-+ # All supported versions of musl provide it as well
- gcc_cv_libc_provides_ssp=yes;;
- *-*-darwin* | *-*-freebsd*)
- ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
@@ -26906,6 +26910,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
@@ -355,24 +337,6 @@ Index: b/gcc/configure.ac
===================================================================
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
-@@ -4669,6 +4669,9 @@
- gcc_cv_libc_provides_ssp,
- [gcc_cv_libc_provides_ssp=no
- case "$target" in
-+ *-*-musl*)
-+ # All versions of musl provide stack protector
-+ gcc_cv_libc_provides_ssp=yes;;
- *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
- [# glibc 2.4 and later provides __stack_chk_fail and
- # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -4702,6 +4705,7 @@
- # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
- # simply assert that glibc does provide this, which is true for all
- # realistically usable GNU/Hurd configurations.
-+ # All supported versions of musl provide it as well
- gcc_cv_libc_provides_ssp=yes;;
- *-*-darwin* | *-*-freebsd*)
- AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
@@ -4767,6 +4771,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
diff --git a/package/gcc/4.8.5/900-musl-support.patch b/package/gcc/4.8.5/900-musl-support.patch
index 761f018..6743a88 100644
--- a/package/gcc/4.8.5/900-musl-support.patch
+++ b/package/gcc/4.8.5/900-musl-support.patch
@@ -486,24 +486,6 @@ Index: b/gcc/configure
===================================================================
--- a/gcc/configure
+++ b/gcc/configure
-@@ -26821,6 +26821,9 @@
- else
- gcc_cv_libc_provides_ssp=no
- case "$target" in
-+ *-*-musl*)
-+ # All versions of musl provide stack protector
-+ gcc_cv_libc_provides_ssp=yes;;
- *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
- # glibc 2.4 and later provides __stack_chk_fail and
- # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -26854,6 +26857,7 @@
- # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
- # simply assert that glibc does provide this, which is true for all
- # realistically usable GNU/Hurd configurations.
-+ # All supported versions of musl provide it as well
- gcc_cv_libc_provides_ssp=yes;;
- *-*-darwin* | *-*-freebsd*)
- ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
@@ -26936,6 +26940,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
@@ -518,24 +500,6 @@ Index: b/gcc/configure.ac
===================================================================
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
-@@ -4750,6 +4750,9 @@
- gcc_cv_libc_provides_ssp,
- [gcc_cv_libc_provides_ssp=no
- case "$target" in
-+ *-*-musl*)
-+ # All versions of musl provide stack protector
-+ gcc_cv_libc_provides_ssp=yes;;
- *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
- [# glibc 2.4 and later provides __stack_chk_fail and
- # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -4783,6 +4786,7 @@
- # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
- # simply assert that glibc does provide this, which is true for all
- # realistically usable GNU/Hurd configurations.
-+ # All supported versions of musl provide it as well
- gcc_cv_libc_provides_ssp=yes;;
- *-*-darwin* | *-*-freebsd*)
- AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
@@ -4848,6 +4852,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
diff --git a/package/gcc/4.9.3/900-musl-support.patch b/package/gcc/4.9.3/900-musl-support.patch
index 56502b8..a711b06 100644
--- a/package/gcc/4.9.3/900-musl-support.patch
+++ b/package/gcc/4.9.3/900-musl-support.patch
@@ -452,24 +452,6 @@ Index: b/gcc/configure
===================================================================
--- a/gcc/configure
+++ b/gcc/configure
-@@ -27328,6 +27328,9 @@
- else
- gcc_cv_libc_provides_ssp=no
- case "$target" in
-+ *-*-musl*)
-+ # All versions of musl provide stack protector
-+ gcc_cv_libc_provides_ssp=yes;;
- *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
- # glibc 2.4 and later provides __stack_chk_fail and
- # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -27360,6 +27363,7 @@
- # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
- # simply assert that glibc does provide this, which is true for all
- # realistically usable GNU/Hurd configurations.
-+ # All supported versions of musl provide it as well
- gcc_cv_libc_provides_ssp=yes;;
- *-*-darwin* | *-*-freebsd*)
- ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
@@ -27449,6 +27453,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
@@ -484,24 +466,6 @@ Index: b/gcc/configure.ac
===================================================================
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
-@@ -5016,6 +5016,9 @@
- gcc_cv_libc_provides_ssp,
- [gcc_cv_libc_provides_ssp=no
- case "$target" in
-+ *-*-musl*)
-+ # All versions of musl provide stack protector
-+ gcc_cv_libc_provides_ssp=yes;;
- *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
- # glibc 2.4 and later provides __stack_chk_fail and
- # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -5042,6 +5045,7 @@
- # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
- # simply assert that glibc does provide this, which is true for all
- # realistically usable GNU/Hurd configurations.
-+ # All supported versions of musl provide it as well
- gcc_cv_libc_provides_ssp=yes;;
- *-*-darwin* | *-*-freebsd*)
- AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
@@ -5108,6 +5112,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
diff --git a/package/gcc/5.2.0/904-musl-libc-config.patch b/package/gcc/5.2.0/904-musl-libc-config.patch
index c4eddb4..8549140 100644
--- a/package/gcc/5.2.0/904-musl-libc-config.patch
+++ b/package/gcc/5.2.0/904-musl-libc-config.patch
@@ -225,24 +225,6 @@ Index: b/gcc/configure
===================================================================
--- a/gcc/configure
+++ b/gcc/configure
-@@ -27681,6 +27681,9 @@
- else
- gcc_cv_libc_provides_ssp=no
- case "$target" in
-+ *-*-musl*)
-+ # All versions of musl provide stack protector
-+ gcc_cv_libc_provides_ssp=yes;;
- *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
- # glibc 2.4 and later provides __stack_chk_fail and
- # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -27713,6 +27716,7 @@
- # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
- # simply assert that glibc does provide this, which is true for all
- # realistically usable GNU/Hurd configurations.
-+ # All supported versions of musl provide it as well
- gcc_cv_libc_provides_ssp=yes;;
- *-*-darwin* | *-*-freebsd*)
- ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
@@ -27809,6 +27813,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
@@ -257,24 +239,6 @@ Index: b/gcc/configure.ac
===================================================================
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
-@@ -5199,6 +5199,9 @@
- gcc_cv_libc_provides_ssp,
- [gcc_cv_libc_provides_ssp=no
- case "$target" in
-+ *-*-musl*)
-+ # All versions of musl provide stack protector
-+ gcc_cv_libc_provides_ssp=yes;;
- *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
- # glibc 2.4 and later provides __stack_chk_fail and
- # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -5225,6 +5228,7 @@
- # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
- # simply assert that glibc does provide this, which is true for all
- # realistically usable GNU/Hurd configurations.
-+ # All supported versions of musl provide it as well
- gcc_cv_libc_provides_ssp=yes;;
- *-*-darwin* | *-*-freebsd*)
- AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
@@ -5298,6 +5302,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
--
2.6.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 1/3] toolchain: like glibc, musl always provides SSP support
2015-10-17 13:09 ` [Buildroot] [PATCH 1/3] toolchain: like glibc, musl always provides SSP support Thomas Petazzoni
@ 2015-10-17 20:02 ` Yann E. MORIN
0 siblings, 0 replies; 8+ messages in thread
From: Yann E. MORIN @ 2015-10-17 20:02 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2015-10-17 15:09 +0200, Thomas Petazzoni spake thusly:
> Make sure BR2_TOOLCHAIN_USES_MUSL selects BR2_TOOLCHAIN_HAS_SSP since
> musl always provides SSP support (like glibc).
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> ---
> toolchain/Config.in | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/toolchain/Config.in b/toolchain/Config.in
> index a851ce4..fc30c6e 100644
> --- a/toolchain/Config.in
> +++ b/toolchain/Config.in
> @@ -27,6 +27,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_HAS_SSP
>
> choice
> prompt "Toolchain type"
> --
> 2.6.2
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/3] gcc: pass explicit gcc_cv_libc_provides_ssp also to gcc-final
2015-10-17 13:09 ` [Buildroot] [PATCH 2/3] gcc: pass explicit gcc_cv_libc_provides_ssp also to gcc-final Thomas Petazzoni
@ 2015-10-17 20:04 ` Yann E. MORIN
0 siblings, 0 replies; 8+ messages in thread
From: Yann E. MORIN @ 2015-10-17 20:04 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2015-10-17 15:09 +0200, Thomas Petazzoni spake thusly:
> During the gcc-initial build, we already pass
> gcc_cv_libc_provides_ssp=yes explicitly when SSP support will be
> available in the C library: at this point in time the C library is not
> yet built, so gcc cannot detect if it will support SSP or not.
>
> However, it turns out that there are some situations for which it is
> also useful to tell gcc explicitly whether the SSP support is
> available or not: the gcc logic to decide whether uClibc has SSP
> support or not is broken since uClibc-ng bumped the glibc version it
> pretends to be.
>
> So, this commit makes sure that we explicitly pass
> gcc_cv_libc_provides_ssp both to gcc-initial and gcc-final, and that
> we're always passing either 'yes' or 'no'.
>
> Fixes:
>
> http://autobuild.buildroot.org/results/778/778e6309ba834cc70f8243a4f6c664c0bcaeb7c5/
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> ---
> package/gcc/gcc-final/gcc-final.mk | 2 ++
> package/gcc/gcc-initial/gcc-initial.mk | 5 +----
> package/gcc/gcc.mk | 10 ++++++++++
> 3 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
> index a5be3c7..5a0f5b5 100644
> --- a/package/gcc/gcc-final/gcc-final.mk
> +++ b/package/gcc/gcc-final/gcc-final.mk
> @@ -85,6 +85,8 @@ HOST_GCC_FINAL_CONF_OPTS += \
> HOST_GCC_FINAL_CONF_ENV = \
> $(HOST_GCC_COMMON_CONF_ENV)
>
> +HOST_GCC_FINAL_MAKE_OPTS += $(HOST_GCC_COMMON_MAKE_OPTS)
> +
> # Make sure we have 'cc'
> define HOST_GCC_FINAL_CREATE_CC_SYMLINKS
> if [ ! -e $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc ]; then \
> diff --git a/package/gcc/gcc-initial/gcc-initial.mk b/package/gcc/gcc-initial/gcc-initial.mk
> index 4b03e47..c0b5eaf 100644
> --- a/package/gcc/gcc-initial/gcc-initial.mk
> +++ b/package/gcc/gcc-initial/gcc-initial.mk
> @@ -51,10 +51,7 @@ HOST_GCC_INITIAL_CONF_OPTS = \
> HOST_GCC_INITIAL_CONF_ENV = \
> $(HOST_GCC_COMMON_CONF_ENV)
>
> -# We need to tell gcc that the C library will be providing the ssp
> -# support, as it can't guess it since the C library hasn't been built
> -# yet (we're gcc-initial).
> -HOST_GCC_INITIAL_MAKE_OPTS = $(if $(BR2_TOOLCHAIN_HAS_SSP),gcc_cv_libc_provides_ssp=yes) all-gcc
> +HOST_GCC_INITIAL_MAKE_OPTS = $(HOST_GCC_COMMON_MAKE_OPTS) all-gcc
> HOST_GCC_INITIAL_INSTALL_OPTS = install-gcc
>
> ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
> diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
> index ef606c4..d6213cc 100644
> --- a/package/gcc/gcc.mk
> +++ b/package/gcc/gcc.mk
> @@ -238,6 +238,16 @@ endif
>
> HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"'
>
> +# For gcc-initial, we need to tell gcc that the C library will be
> +# providing the ssp support, as it can't guess it since the C library
> +# hasn't been built yet.
> +#
> +# For gcc-final, the gcc logic to detect whether SSP support is
> +# available or not in the C library is not working properly for
> +# uClibc, so let's be explicit as well.
> +HOST_GCC_COMMON_MAKE_OPTS = \
> + gcc_cv_libc_provides_ssp=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
> +
> ifeq ($(BR2_CCACHE),y)
> HOST_GCC_COMMON_CCACHE_HASH_FILES += $(DL_DIR)/$(GCC_SOURCE)
> # Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned and
> --
> 2.6.2
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 3/3] gcc: simplify musl patches for SSP support
2015-10-17 13:09 ` [Buildroot] [PATCH 3/3] gcc: simplify musl patches for SSP support Thomas Petazzoni
@ 2015-10-17 20:08 ` Yann E. MORIN
0 siblings, 0 replies; 8+ messages in thread
From: Yann E. MORIN @ 2015-10-17 20:08 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2015-10-17 15:09 +0200, Thomas Petazzoni spake thusly:
> Now that we are always explicitly passing gcc_cv_libc_provides_ssp,
> there is no longer any reason to modify the gcc configure/configure.ac
> to take into account the musl case. When a musl toolchain is being
> built, BR2_TOOLCHAIN_HAS_SSP is always 'y', and therefore
> gcc_cv_libc_provides_ssp=yes is always passed when building
> gcc-initial and gcc-final.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> ---
> package/gcc/4.7.4/900-musl-support.patch | 36 ----------------------------
> package/gcc/4.8.5/900-musl-support.patch | 36 ----------------------------
> package/gcc/4.9.3/900-musl-support.patch | 36 ----------------------------
> package/gcc/5.2.0/904-musl-libc-config.patch | 36 ----------------------------
> 4 files changed, 144 deletions(-)
>
> diff --git a/package/gcc/4.7.4/900-musl-support.patch b/package/gcc/4.7.4/900-musl-support.patch
> index 1cb6701..67b8c30 100644
> --- a/package/gcc/4.7.4/900-musl-support.patch
> +++ b/package/gcc/4.7.4/900-musl-support.patch
> @@ -323,24 +323,6 @@ Index: b/gcc/configure
> ===================================================================
> --- a/gcc/configure
> +++ b/gcc/configure
> -@@ -26791,6 +26791,9 @@
> - else
> - gcc_cv_libc_provides_ssp=no
> - case "$target" in
> -+ *-*-musl*)
> -+ # All versions of musl provide stack protector
> -+ gcc_cv_libc_provides_ssp=yes;;
> - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
> - # glibc 2.4 and later provides __stack_chk_fail and
> - # either __stack_chk_guard, or TLS access to stack guard canary.
> -@@ -26824,6 +26827,7 @@
> - # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
> - # simply assert that glibc does provide this, which is true for all
> - # realistically usable GNU/Hurd configurations.
> -+ # All supported versions of musl provide it as well
> - gcc_cv_libc_provides_ssp=yes;;
> - *-*-darwin* | *-*-freebsd*)
> - ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
> @@ -26906,6 +26910,9 @@
> gcc_cv_target_dl_iterate_phdr=no
> fi
> @@ -355,24 +337,6 @@ Index: b/gcc/configure.ac
> ===================================================================
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> -@@ -4669,6 +4669,9 @@
> - gcc_cv_libc_provides_ssp,
> - [gcc_cv_libc_provides_ssp=no
> - case "$target" in
> -+ *-*-musl*)
> -+ # All versions of musl provide stack protector
> -+ gcc_cv_libc_provides_ssp=yes;;
> - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
> - [# glibc 2.4 and later provides __stack_chk_fail and
> - # either __stack_chk_guard, or TLS access to stack guard canary.
> -@@ -4702,6 +4705,7 @@
> - # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
> - # simply assert that glibc does provide this, which is true for all
> - # realistically usable GNU/Hurd configurations.
> -+ # All supported versions of musl provide it as well
> - gcc_cv_libc_provides_ssp=yes;;
> - *-*-darwin* | *-*-freebsd*)
> - AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
> @@ -4767,6 +4771,9 @@
> gcc_cv_target_dl_iterate_phdr=no
> fi
> diff --git a/package/gcc/4.8.5/900-musl-support.patch b/package/gcc/4.8.5/900-musl-support.patch
> index 761f018..6743a88 100644
> --- a/package/gcc/4.8.5/900-musl-support.patch
> +++ b/package/gcc/4.8.5/900-musl-support.patch
> @@ -486,24 +486,6 @@ Index: b/gcc/configure
> ===================================================================
> --- a/gcc/configure
> +++ b/gcc/configure
> -@@ -26821,6 +26821,9 @@
> - else
> - gcc_cv_libc_provides_ssp=no
> - case "$target" in
> -+ *-*-musl*)
> -+ # All versions of musl provide stack protector
> -+ gcc_cv_libc_provides_ssp=yes;;
> - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
> - # glibc 2.4 and later provides __stack_chk_fail and
> - # either __stack_chk_guard, or TLS access to stack guard canary.
> -@@ -26854,6 +26857,7 @@
> - # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
> - # simply assert that glibc does provide this, which is true for all
> - # realistically usable GNU/Hurd configurations.
> -+ # All supported versions of musl provide it as well
> - gcc_cv_libc_provides_ssp=yes;;
> - *-*-darwin* | *-*-freebsd*)
> - ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
> @@ -26936,6 +26940,9 @@
> gcc_cv_target_dl_iterate_phdr=no
> fi
> @@ -518,24 +500,6 @@ Index: b/gcc/configure.ac
> ===================================================================
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> -@@ -4750,6 +4750,9 @@
> - gcc_cv_libc_provides_ssp,
> - [gcc_cv_libc_provides_ssp=no
> - case "$target" in
> -+ *-*-musl*)
> -+ # All versions of musl provide stack protector
> -+ gcc_cv_libc_provides_ssp=yes;;
> - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
> - [# glibc 2.4 and later provides __stack_chk_fail and
> - # either __stack_chk_guard, or TLS access to stack guard canary.
> -@@ -4783,6 +4786,7 @@
> - # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
> - # simply assert that glibc does provide this, which is true for all
> - # realistically usable GNU/Hurd configurations.
> -+ # All supported versions of musl provide it as well
> - gcc_cv_libc_provides_ssp=yes;;
> - *-*-darwin* | *-*-freebsd*)
> - AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
> @@ -4848,6 +4852,9 @@
> gcc_cv_target_dl_iterate_phdr=no
> fi
> diff --git a/package/gcc/4.9.3/900-musl-support.patch b/package/gcc/4.9.3/900-musl-support.patch
> index 56502b8..a711b06 100644
> --- a/package/gcc/4.9.3/900-musl-support.patch
> +++ b/package/gcc/4.9.3/900-musl-support.patch
> @@ -452,24 +452,6 @@ Index: b/gcc/configure
> ===================================================================
> --- a/gcc/configure
> +++ b/gcc/configure
> -@@ -27328,6 +27328,9 @@
> - else
> - gcc_cv_libc_provides_ssp=no
> - case "$target" in
> -+ *-*-musl*)
> -+ # All versions of musl provide stack protector
> -+ gcc_cv_libc_provides_ssp=yes;;
> - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
> - # glibc 2.4 and later provides __stack_chk_fail and
> - # either __stack_chk_guard, or TLS access to stack guard canary.
> -@@ -27360,6 +27363,7 @@
> - # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
> - # simply assert that glibc does provide this, which is true for all
> - # realistically usable GNU/Hurd configurations.
> -+ # All supported versions of musl provide it as well
> - gcc_cv_libc_provides_ssp=yes;;
> - *-*-darwin* | *-*-freebsd*)
> - ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
> @@ -27449,6 +27453,9 @@
> gcc_cv_target_dl_iterate_phdr=no
> fi
> @@ -484,24 +466,6 @@ Index: b/gcc/configure.ac
> ===================================================================
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> -@@ -5016,6 +5016,9 @@
> - gcc_cv_libc_provides_ssp,
> - [gcc_cv_libc_provides_ssp=no
> - case "$target" in
> -+ *-*-musl*)
> -+ # All versions of musl provide stack protector
> -+ gcc_cv_libc_provides_ssp=yes;;
> - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
> - # glibc 2.4 and later provides __stack_chk_fail and
> - # either __stack_chk_guard, or TLS access to stack guard canary.
> -@@ -5042,6 +5045,7 @@
> - # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
> - # simply assert that glibc does provide this, which is true for all
> - # realistically usable GNU/Hurd configurations.
> -+ # All supported versions of musl provide it as well
> - gcc_cv_libc_provides_ssp=yes;;
> - *-*-darwin* | *-*-freebsd*)
> - AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
> @@ -5108,6 +5112,9 @@
> gcc_cv_target_dl_iterate_phdr=no
> fi
> diff --git a/package/gcc/5.2.0/904-musl-libc-config.patch b/package/gcc/5.2.0/904-musl-libc-config.patch
> index c4eddb4..8549140 100644
> --- a/package/gcc/5.2.0/904-musl-libc-config.patch
> +++ b/package/gcc/5.2.0/904-musl-libc-config.patch
> @@ -225,24 +225,6 @@ Index: b/gcc/configure
> ===================================================================
> --- a/gcc/configure
> +++ b/gcc/configure
> -@@ -27681,6 +27681,9 @@
> - else
> - gcc_cv_libc_provides_ssp=no
> - case "$target" in
> -+ *-*-musl*)
> -+ # All versions of musl provide stack protector
> -+ gcc_cv_libc_provides_ssp=yes;;
> - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
> - # glibc 2.4 and later provides __stack_chk_fail and
> - # either __stack_chk_guard, or TLS access to stack guard canary.
> -@@ -27713,6 +27716,7 @@
> - # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
> - # simply assert that glibc does provide this, which is true for all
> - # realistically usable GNU/Hurd configurations.
> -+ # All supported versions of musl provide it as well
> - gcc_cv_libc_provides_ssp=yes;;
> - *-*-darwin* | *-*-freebsd*)
> - ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
> @@ -27809,6 +27813,9 @@
> gcc_cv_target_dl_iterate_phdr=no
> fi
> @@ -257,24 +239,6 @@ Index: b/gcc/configure.ac
> ===================================================================
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> -@@ -5199,6 +5199,9 @@
> - gcc_cv_libc_provides_ssp,
> - [gcc_cv_libc_provides_ssp=no
> - case "$target" in
> -+ *-*-musl*)
> -+ # All versions of musl provide stack protector
> -+ gcc_cv_libc_provides_ssp=yes;;
> - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
> - # glibc 2.4 and later provides __stack_chk_fail and
> - # either __stack_chk_guard, or TLS access to stack guard canary.
> -@@ -5225,6 +5228,7 @@
> - # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
> - # simply assert that glibc does provide this, which is true for all
> - # realistically usable GNU/Hurd configurations.
> -+ # All supported versions of musl provide it as well
> - gcc_cv_libc_provides_ssp=yes;;
> - *-*-darwin* | *-*-freebsd*)
> - AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
> @@ -5298,6 +5302,9 @@
> gcc_cv_target_dl_iterate_phdr=no
> fi
> --
> 2.6.2
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 0/3] Fix SSP related build failures
2015-10-17 13:09 [Buildroot] [PATCH 0/3] Fix SSP related build failures Thomas Petazzoni
` (2 preceding siblings ...)
2015-10-17 13:09 ` [Buildroot] [PATCH 3/3] gcc: simplify musl patches for SSP support Thomas Petazzoni
@ 2015-10-18 13:40 ` Thomas Petazzoni
3 siblings, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2015-10-18 13:40 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 17 Oct 2015 15:09:07 +0200, Thomas Petazzoni wrote:
> Thomas Petazzoni (3):
> toolchain: like glibc, musl always provides SSP support
> gcc: pass explicit gcc_cv_libc_provides_ssp also to gcc-final
> gcc: simplify musl patches for SSP support
Thanks to Yann's review, I've applied those patches.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-10-18 13:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-17 13:09 [Buildroot] [PATCH 0/3] Fix SSP related build failures Thomas Petazzoni
2015-10-17 13:09 ` [Buildroot] [PATCH 1/3] toolchain: like glibc, musl always provides SSP support Thomas Petazzoni
2015-10-17 20:02 ` Yann E. MORIN
2015-10-17 13:09 ` [Buildroot] [PATCH 2/3] gcc: pass explicit gcc_cv_libc_provides_ssp also to gcc-final Thomas Petazzoni
2015-10-17 20:04 ` Yann E. MORIN
2015-10-17 13:09 ` [Buildroot] [PATCH 3/3] gcc: simplify musl patches for SSP support Thomas Petazzoni
2015-10-17 20:08 ` Yann E. MORIN
2015-10-18 13:40 ` [Buildroot] [PATCH 0/3] Fix SSP related build failures Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox