Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Brendan Heading <brendanheading@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH RFC v1 1/1] gcc: fix problem with detecting SSP under uclibc-ng
Date: Thu, 17 Sep 2015 15:37:58 +0100	[thread overview]
Message-ID: <1442500678-4457-1-git-send-email-brendanheading@gmail.com> (raw)

Fixes:
http://autobuild.buildroot.net/results/123/123a5b3f72ba8c1a4aa1cea5b7b846a04fd4e923/
http://autobuild.buildroot.net/results/38c/38cfa4e7249a8770b06dbd392acba79303d3f9bc/

.. and others.

GCC's configure stage assumes that if the glibc version, as denoted by
__GLIBC__ and __GLIBC_MINOR__, is greater or equal to 2.4 then stack
protection must be available in the C library. This results in the compiler
not attempting to link SSP helpers during the final link.

The problem is seen with uclibc-ng 1.0.6 (and likely greater) where they
updated the __GLIBC_MINOR__ value to 10. It will be seen in any libc
that permits stack protection to be disabled while exporting a glibc
version >= 2.4.

This patch overrides GCC to expect/not expect SSP support in libc based on
the toolchain's capability as understood by buildroot.

Signed-off-by: Brendan Heading <brendanheading@gmail.com>
---
Patch V1 :
This fix definitely solves the problem, however I doubt it's acceptable to
export environment variables in this way.

I had initially tried adding it to HOST_GCC_COMMON_CONF_ENV, and I
confirmed that this is passed into GCC's top level configure, however it
does not seem to propagate to the gcc/configure script. Another way would
be to patch GCC, however this would involve maintaining patches for all
the supported GCC versions.

Improvement suggestions welcome!
---
 package/gcc/gcc.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 501fcea..43835af 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -123,6 +123,14 @@ endif
 HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)"
 HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)"
 
+# Work around issue with detecting SSP support in the C library
+
+ifeq ($(BR2_TOOLCHAIN_HAS_SSP),y)
+export gcc_cv_libc_provides_ssp=yes
+else
+export gcc_cv_libc_provides_ssp=no
+endif
+
 # libitm needs sparc V9+
 ifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y)
 HOST_GCC_COMMON_CONF_OPTS += --disable-libitm
-- 
2.4.3

             reply	other threads:[~2015-09-17 14:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 14:37 Brendan Heading [this message]
2015-09-17 17:14 ` [Buildroot] [PATCH RFC v1 1/1] gcc: fix problem with detecting SSP under uclibc-ng Thomas Petazzoni
2015-09-17 17:29   ` Brendan Heading
2015-09-17 17:42     ` Waldemar Brodkorb
2015-09-17 20:20     ` Thomas Petazzoni
2015-09-17 21:22       ` Brendan Heading
2015-09-18  7:11         ` Thomas Petazzoni
2015-09-17 22:10     ` Alexey Brodkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442500678-4457-1-git-send-email-brendanheading@gmail.com \
    --to=brendanheading@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox