Bug#892281: gcc: make PIE opt-out rather than opt-in

2018-09-29 Thread Helmut Grohne
Control: tags -1 + patch

On Wed, Mar 07, 2018 at 07:16:26PM +0100, Helmut Grohne wrote:
> Since it practically is the default "everywhere", can we move on to
> enable PIE for all "new" architectures by turning the opt-in list
> opt-out? While at it, can we keep this list as small as possible? At
> least for musl-linux-any and x32, we know that !PIE causes more harm
> than PIE.

The attached patch implements opt-in. It does not change x32 to be
conservative. It does change musl to keep the list short, but there is
no relevant Debian musl deployment anyhow.

Helmut
diff -u gcc-8-8.2.0/debian/changelog gcc-8-8.2.0/debian/changelog
--- gcc-8-8.2.0/debian/changelog
+++ gcc-8-8.2.0/debian/changelog
@@ -1,3 +1,10 @@
+gcc-8 (8.2.0-7.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Make PIE opt-out starting with buster. (Closes: 892281)
+
+ -- Helmut Grohne   Sat, 29 Sep 2018 09:37:18 +0200
+
 gcc-8 (8.2.0-7) unstable; urgency=medium
 
   * Update to SVN 20180917 (r264370) from the gcc-8-branch.
diff -u gcc-8-8.2.0/debian/rules.defs gcc-8-8.2.0/debian/rules.defs
--- gcc-8-8.2.0/debian/rules.defs
+++ gcc-8-8.2.0/debian/rules.defs
@@ -1243,7 +1243,8 @@
hurd-i386 riscv64
   endif
   ifeq (,$(filter $(distrelease),wheezy squeeze jessie stretch))
-pie_archs += powerpc ppc64
+nopie_archs = alpha arm arm64ilp32 armeb avr32 hppa ia64 m32r m68k nios2 \
+ or1k powerpcel powerpcspe s390 sh3 sh3eb sh4 sh4eb tilegx x32
   endif
 else ifeq ($(distribution),Ubuntu)
   ifeq (,$(filter $(distrelease),lucid precise trusty utopic vivid wily))
@@ -1256,8 +1257,14 @@
 pie_archs += armhf arm64 i386
   endif
 endif
-ifneq (,$(filter $(DEB_TARGET_ARCH),$(pie_archs)))
-  with_pie := yes
+ifneq (,$(nopie_archs))
+  ifeq (,$(filter $(DEB_TARGET_ARCH),$(nopie_archs)))
+with_pie := yes
+  endif
+else
+  ifneq (,$(filter $(DEB_TARGET_ARCH),$(pie_archs)))
+with_pie := yes
+  endif
 endif
 ifeq ($(trunk_build),yes)
   with_pie := disabled for trunk builds


Bug#892281: gcc: make PIE opt-out rather than opt-in

2018-03-07 Thread Helmut Grohne
Source: gcc-8
Version: 8-20180218-1
Severity: wishlist

We have long transitioned to PIE by default on all release architectures
now. Still each gcc-V package tracks the architectures that enable PIE
by default in an opt-in list (pie_archs).

Since it is the default, PIE is much better supported than !PIE now.
For instance, musl-linux-mips fails building dash, because ld segfaults.
Once enabling PIE for musl, it proceeds. Similarly, x32 fails linking
systemd and it obviously is connected to !PIE:

ld: /tmp/cc9ezYWe.ltrans0.ltrans.o: relocation R_X86_64_32S against 
`.rodata' can not be used when making a PIE object; recompile with -fPIC

Very likely, the riscv64 people want to enable PIE by default as well.

Since it practically is the default "everywhere", can we move on to
enable PIE for all "new" architectures by turning the opt-in list
opt-out? While at it, can we keep this list as small as possible? At
least for musl-linux-any and x32, we know that !PIE causes more harm
than PIE.

I've Cced this to d-devel to have people object, but I think the case is
pretty clear at this point, because opt-out will reduce the maintenance
cost.

Helmut