From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18826 invoked by alias); 9 Jan 2015 14:10:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 18816 invoked by uid 89); 9 Jan 2015 14:10:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f53.google.com Received: from mail-oi0-f53.google.com (HELO mail-oi0-f53.google.com) (209.85.218.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 09 Jan 2015 14:10:50 +0000 Received: by mail-oi0-f53.google.com with SMTP id g201so11969907oib.12 for ; Fri, 09 Jan 2015 06:10:48 -0800 (PST) X-Received: by 10.60.92.162 with SMTP id cn2mr4288071oeb.35.1420812648348; Fri, 09 Jan 2015 06:10:48 -0800 (PST) Received: from [192.168.0.14] (CPEbc1401380f73-CMbc1401380f70.cpe.net.cable.rogers.com. [99.231.166.199]) by mx.google.com with ESMTPSA id m15sm4355238oeu.10.2015.01.09.06.10.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jan 2015 06:10:47 -0800 (PST) Message-ID: <54AFE15D.40406@gmail.com> Date: Fri, 09 Jan 2015 14:17:00 -0000 From: Daniel Micay User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Richard Biener , Magnus Granberg , "Joseph S. Myers" CC: GCC Patches Subject: Re: [PING][PATCH][1-3] New configure options that make the compiler use -fPIE and -pie as default option References: <4827012.p4mTkPPu1h@laptop1.gw.ume.nu> <2546517.6r217PbQ20@laptop1.gw.ume.nu> <3640063.8rDKLvUbS6@laptop1.gw.ume.nu> <1625902.vd5h90ZESU@laptop1.gw.ume.nu> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jP4jWNnVXTcodqOOt2CsMWhlEFkX4pEr2" X-SW-Source: 2015-01/txt/msg00513.txt.bz2 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --jP4jWNnVXTcodqOOt2CsMWhlEFkX4pEr2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 2371 On 09/01/15 07:58 AM, Richard Biener wrote: >=20 > Looking at the actual implementation I wonder why it's not similar > to how darwin gets at it default (not sure how it does). Also > looking at how DRIVER_SELF_SPECS is used I wonder if the > functionality can be enabled with a simple >=20 > --with-specs=3D"%{pie|fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE= |shared|static|nostdlib|nodefaultlibs|nostartfiles:;:-fPIE > -pie}" >=20 > at configure time (using CONFIGURE_SPECS). >=20 > I have no idea if the above is really the proper spec to use - why > do you include static, nostdlib, nodefaultlibs and nostartfiles > for example? Similar, if I say PIE isn't supported for static executables by binutils, etc. so it does need to exclude that. The checks for nostdlib, nodefaultlibs and nostartfiles do seem unnecessary. I think distributions include those in the existing wrapper scripts and GCC patches because it avoids the need for patching build systems for kernel / freestanding code to include -fno-pie, but it's more correct to leave these out. =20 > gcc -pie -c t.c >=20 > we will end up with a non-PIE object, and linking with -fPIE will > end up with a DYN_EXEC object. >=20 > I believe you want to treat link and compile arguments separately > (and adjust the link spec for linking). I also would have said that > elfos.h is more appropriate than gnu-user.h, but ... Handling it separately is what the existing wrapper scripts for this do: -fno-PIC|-fno-pic|-fno-PIE|-fno-pie|-static|--static|-shared|--shared) force_fPIE=3D0 force_pie=3D0 ;; -fPIC|-fpic|-fPIE|-fpie) force_fPIE=3D0 ;; -c|-E|-S) force_pie=3D0 ;; I think it's appropriate for it to=20 =20 > That said, the patch looks more like a hack (and see above how > to achieve the same without a patch(?)), not like a proper implementation > of a PIE default. I don't think it can be considered a hack if it's handling all of the cases correctly, so it might need some changes from the current implementation but that doesn't make it a dead end. Is it actually done in a significantly different way for OS X? If it can be done by passing --with-specs to configure then that could be a viable alternative for distributions that do not want to add GCC patches or use wrapper scripts (Arch Linux) but I'm not sure that it will fly. --jP4jWNnVXTcodqOOt2CsMWhlEFkX4pEr2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJUr+FlAAoJEPnnEuWa9fIq/yEQAIN+ZirxpJOMdyg7FO/nC1Gl qFFIIxkQr1klbKrodUVAFHukZ/pD5p4KyER1GVjU3l5i9pyE2O0FhzFmVqOH5ajp 1r1FbdhkqHw7b4hVRLi78qQuRXaMUvGF8yjw393uuB/Lhp1zwxBqwbYocg43pPda 5SpqZ7A+y+4OR9I60JpW6sFSd+aN7U09jVgZXe+9QtFGXTPqJIfNm3y0DaU/933/ XW52THH0wOkW00rlMTjIyEryjKa69Ax0TfooOAOTfL+i4eTuNPfDls3LJd/lfOJo 6KDMA8CASD7e9rvcpM/cuekRF4Z2s4ll5902R78jHjoymQ3JPUDKLbT4eFU91GgJ Ky01Oxmu5zj40FTLKJ33fwGjkFpUKUbkOTxclczq7mRoHa+KREp2+fpJZfPvFbE+ xwe2UobvlbciSzrrEaQc4v135d1dEHTYVROql7xTcX5QFMlk4rERXCGTvfwJFthg YeEM8zHmPWXdtOvZaaPnEQy8jOhxRRqM+V9yCHHL1/5E0YJjH7GINZFsOfm1NxGg TMm4lRSBKJM2M7GC0vX2d0P+vIEbfTZXw7H7dhfZJG/eZVvs+UM3dOF0ej9eWpE0 e15Hc1Dc/V1ngNvt3ngBuxYvwAIrQCvosfbVBSJz5Qf5JL+2lShYz4xqSrq/ZRZ3 hSE78K5C1t0mW7sd+qZZ =i3mj -----END PGP SIGNATURE----- --jP4jWNnVXTcodqOOt2CsMWhlEFkX4pEr2--