From patchwork Wed Jul 20 13:58:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 650691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rvdn32Vtnz9t1N for ; Wed, 20 Jul 2016 23:59:02 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=NheOVT3g; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=w1YCfmkumMk5hF+nmHotXFq70PWFoGg7Nu3U7Z18Quz lvhqQ9dnYBZ2RtG6NteCUf7vrnimYAdQ3jEEP4BCNTBjKqtxcekrG3ChuT4pORU/ uPcoRiGYUdk1y2EPskH3uYH2W4rTg+QTMuCgvPLBcIltUq8IGfm3nLaCNO7KJHm0 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=1qOrHepuxeOEg2Xyq0N9mYFB63s=; b=NheOVT3gJijYokDzi 1CAjnLzwvIVcOVG11dGCrwO4BX/X2NllLpFcGJH9IFqDarpbM5i8GaXlXMtdUbRP Yc3Ddj5b1jItcTGJ1yQVFOrS+lggUbCyDQUKGCHyZLW9s1A46cF+TT6QB5fS/WWf SuS2P7384iAfq9w0wbwvYVQwSs= Received: (qmail 38564 invoked by alias); 20 Jul 2016 13:58:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 38555 invoked by uid 89); 20 Jul 2016 13:58:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:ed44472, sk:086d0fc, historically X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Jul 2016 13:58:43 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp0151.outbound.protection.outlook.com [213.199.180.151]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-29-AQ4bhUezNkaVRiFAV-alOA-1; Wed, 20 Jul 2016 14:58:37 +0100 Received: from [10.2.206.73] (217.140.96.140) by VI1PR08MB1104.eurprd08.prod.outlook.com (10.166.45.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.544.10; Wed, 20 Jul 2016 13:58:34 +0000 Message-ID: <578F8388.8060605@arm.com> Date: Wed, 20 Jul 2016 14:58:32 +0100 From: Szabolcs Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: , Rich Felker , Szabolcs Nagy Subject: [PATCH] check -nopie in configure X-ClientProxiedBy: DB5PR09CA0010.eurprd09.prod.outlook.com (10.161.191.20) To VI1PR08MB1104.eurprd08.prod.outlook.com (10.166.45.23) X-MS-Office365-Filtering-Correlation-Id: 093ef3a4-8be2-4cb2-9761-08d3b0a5f0fb X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB1104; 2:85Y2DL9PB7bYZceYcFfDkA14yJe6XKp2EFDX1ybtPC7AnbDq/uKzoIJ7eZMBol9km7NwMwOwdBLybGPXzlWtgHkzRot1FkAq7r06ihMruI/L4/Pi528/WGPSSPh8b1OmcOXSiI+75NpTO8GiyTklE0e3F/PM04k1wUW7sabQ+kWLuJ697Izzts/2y19clkCQ; 3:/OrVRTjk8qYvxShNvVHICp+TviYMGPGTbGj1FlIiTt89LpXCD2cb49TFbgLjI138iPhBNS8a799a7w8cBlfwioXx53SlTORxExCMP1wi6gizw4drsoKGh9peJW5b2byP X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR08MB1104; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB1104; 25:JpH9qfWOkQs/757IajTEfHEIjE0sSoz+V8CLgaiFhUF33AOOChN5FPcgt/7NC/6w3BCUFDtM2/ycLEaj4EHRACMLQDvjEOE6DIvWSrrxkb6l4GkfjfNxWU85wE0d6Pf9h6s8HljsUhmjYZkFcH3e+20q9PIZsc2uyMtB0hEFqV47V1s9kNZWuzn06yzuVWrYAD0DtCzAn2/BgfGlVMeP/DHWzKW8q92JdDONGZDwm/7l28jSt+4oxuA5Vrcb3FB5qvUdMgXw3bAZofp7MTtzMFeN3CHVQr/89lNz4T7bhIKXTvNL1sn35PH5g087S7AdZqFpfBiTgiB2+EJ4vzXcn0VN9rB0HmaXWyf+QginV3TFyS+Hm3upGaUM6j2tt7ENijhvAq1x7X0wW9DNIwKeoi6Ee1a5xu1Sy+O/PompwPihPBmNWzxCyHZQjRDzYCw7XLDS0w8R8RSTY1XQ2nXssMXHEFDatBd/cNUSz4qHGX27u78AEG6CB20Tcu9Mh7Tzc74eJLDwjXBPNUJE0ZKLde8/qSwty3+8zKZ0yuPdvM6v4UgbchAWlgXhMDVj+SP/Fcvkh9y9X3oChxB/SMrocwf1DoMmPIeytp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ZNrkngnYfW2dUDU3r3wqGmTYEDNoOXivKlcIPWTCaW/NC0VfaO7YEkFs5YrT6hMCM5rXblvaLoU6Xa4154b0E7Lapg== NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415321)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:VI1PR08MB1104; BCL:0; PCL:0; RULEID:; SRVR:VI1PR08MB1104; X-Forefront-PRVS: 000947967F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(199003)(377424004)(189002)(21490400002)(512874002)(110136002)(64126003)(77096005)(59896002)(8676002)(270700001)(4326007)(189998001)(81166006)(229853001)(86362001)(2501003)(5890100001)(81156014)(83506001)(2351001)(105586002)(106356001)(5000100001)(68736007)(92566002)(36756003)(42186005)(4610100001)(2906002)(66066001)(4001350100001)(65806001)(65956001)(2476003)(19580405001)(80316001)(54356999)(87266999)(84326002)(7846002)(3846002)(6116002)(568964002)(50986999)(33656002)(101416001)(305945005)(7736002)(586003)(97736004)(65816999)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB1104; H:[10.2.206.73]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR08MB1104; 23:aIP+t6gon6gZxBZJb7HXTFK3hAq1cRzEODIxWqVyg?= =?us-ascii?Q?IBhFQYZljFRoX/KvzJ1H7DmtoVuiK2c41+UwqhIORP5pdWe32mhlOSn1P9gm?= =?us-ascii?Q?bkIIn6Zr/kFWrBgAI3jUneJp/He/C+b0gwEKYODHb1gs0sUHL9G4MrNl1AxS?= =?us-ascii?Q?+QcQFVlIN413GwJu83R+zmPjme9gFZKLkpipiuzuvX4AKwp52WZWzvi/5LcH?= =?us-ascii?Q?KsW4kRRP+10Cd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GniWQdKn5rOeD4D8p7S80W/m6bBCMZMqkaUgbTCK8wdsaNqO506AtHyx3b6ClYzopB19G1P0dOh8gxcFn0sgs7ugeLxuF1lFmaAkOKVFxhSvjZGnXkn19Fc7yk4gUwNFxhZm2S/1T06FVvbcbvD9mqm9qk6v0UJFwotwPOSf5mDFfVusYo2jLYQyEqQJD7XhUrATESUqyQt5XWyRMFlERvMAyrmgSUdWFnntNr6Dfjiib SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB1104; 20:LTPOsbgZ54eRJD67cPP6B6+cBZrcGJNz2QHxc78sETlJGNE48Fn/DpyqG1tTsGjM1JUgiyTYYm7NIYtuuzymoV77PLAe3MhfOYRM1xwOGa2IYKRxAbAXA32G9wlf9MyJsk3rkwSYIQC6U1sbFVTonoKJfF51mxqtCiWBN6Udz4c= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2016 13:58:34.4871 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB1104 X-MC-Unique: AQ4bhUezNkaVRiFAV-alOA-1 X-IsSubscribed: yes since gcc can be built with --enable-default-pie, there is a -no-pie flag to turn off PIE. gcc cannot be built as PIE (pr 71934), so the gcc build system has to detect the -no-pie flag to disable PIE. historically default pie toolchains used the -nopie flag (e.g. gentoo hardened), those toolchains cannot build gcc anymore, so detect -nopie too. gcc/ 2016-07-20 Szabolcs Nagy * configure.ac: Detect -nopie flag just like -no-pie. * configure: Regenerate. diff --git a/gcc/configure b/gcc/configure index ed44472..ca16e66 100755 --- a/gcc/configure +++ b/gcc/configure @@ -29566,6 +29566,33 @@ fi $as_echo "$gcc_cv_no_pie" >&6; } if test "$gcc_cv_no_pie" = "yes"; then NO_PIE_FLAG="-no-pie" +else + # Check if -nopie works. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 +$as_echo_n "checking for -nopie option... " >&6; } +if test "${gcc_cv_nopie+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -nopie" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void) {return 0;} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + gcc_cv_nopie=yes +else + gcc_cv_nopie=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$saved_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 +$as_echo "$gcc_cv_nopie" >&6; } + if test "$gcc_cv_nopie" = "yes"; then + NO_PIE_FLAG="-nopie" + fi fi diff --git a/gcc/configure.ac b/gcc/configure.ac index 086d0fc..98ab5cb 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -6200,6 +6200,19 @@ AC_CACHE_CHECK([for -no-pie option], LDFLAGS="$saved_LDFLAGS"]) if test "$gcc_cv_no_pie" = "yes"; then NO_PIE_FLAG="-no-pie" +else + # Check if -nopie works. + AC_CACHE_CHECK([for -nopie option], + [gcc_cv_nopie], + [saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -nopie" + AC_LINK_IFELSE([int main(void) {return 0;}], + [gcc_cv_nopie=yes], + [gcc_cv_nopie=no]) + LDFLAGS="$saved_LDFLAGS"]) + if test "$gcc_cv_nopie" = "yes"; then + NO_PIE_FLAG="-nopie" + fi fi AC_SUBST([NO_PIE_FLAG])