From patchwork Thu Sep 17 14:37:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Heading X-Patchwork-Id: 518890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id BE86A141402 for ; Fri, 18 Sep 2015 00:38:30 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=HPLenb0h; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id F35EF950D3; Thu, 17 Sep 2015 14:38:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1NZnIFspHHlw; Thu, 17 Sep 2015 14:38:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id E0876950B5; Thu, 17 Sep 2015 14:38:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 74D5A1C1080 for ; Thu, 17 Sep 2015 14:38:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 707A7A4DFF for ; Thu, 17 Sep 2015 14:38:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xFFSpkfBvo4h for ; Thu, 17 Sep 2015 14:38:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 987F1A4E2F for ; Thu, 17 Sep 2015 14:38:24 +0000 (UTC) Received: by wiclk2 with SMTP id lk2so26986800wic.0 for ; Thu, 17 Sep 2015 07:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=gNeu33LDM9Sh/GCD3z6bfNsDiU+jKJibTFZ4QTl2AY4=; b=HPLenb0hKDV9ibcPLh/fa3jhB+yvyguc8gDt2JdNtqsWX+kYKToyUEqRIBj7EEAtgf tRxSGpqR4CKeHd9XWK6T5z4+wvXMql3MonR19ZXl8fkLM78MwnMVJXicKQiIHayk1bhQ BzOoslIPlKDGyDr9S9a1LRmXi6zh8/9+nUsGLo7W5aQzRsXnW0TvgxPCIUeuLhXtza21 jIp7iot8JdGoGxoTEwMSOpWZapqU01inCW4wLeJMBceWSc1vpixLIbT2rD+gAfszif8j YKU5dE0fyRjO5Djmehfx9HfuQ5Gy82luVRghoFamsFfMUDPHsBxd4NUao+Uost0k+nMX ebXQ== X-Received: by 10.180.103.72 with SMTP id fu8mr30682964wib.7.1442500703091; Thu, 17 Sep 2015 07:38:23 -0700 (PDT) Received: from bhfedora.localdomain ([82.15.84.251]) by smtp.gmail.com with ESMTPSA id db8sm3730605wjb.41.2015.09.17.07.38.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 07:38:22 -0700 (PDT) From: Brendan Heading To: buildroot@buildroot.org Date: Thu, 17 Sep 2015 15:37:58 +0100 Message-Id: <1442500678-4457-1-git-send-email-brendanheading@gmail.com> X-Mailer: git-send-email 2.4.3 Cc: thomas.petazzoni@free-electrons.com, Brendan Heading Subject: [Buildroot] [PATCH RFC v1 1/1] gcc: fix problem with detecting SSP under uclibc-ng X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 --- 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