Hi!

On Wed, 2016-11-09 at 00:34:30 +0100, Hilko Bengen wrote:
> Package: dpkg
> Version: 1.18.13
> Severity: important

> recent rebuilds of supermin on a few architectures (at least powerpc,
> ppc64, sh4, sparc64) failed gcc no longer produces static binaries.
> 
> It looks as if this breakage was introduced when
> "-specs=/usr/share/dpkg/pie-link.specs" became part of the command line
> via LDFLAGS. A quick test on powerpc showed that removing this parameter
> leads to a valid static binary.

I think this is a problem at least in supermin itself. The new dpkg
options enable PIE by default everywhere, but supermin build system is
using file(1) to determine whether the resulting init object has been
statically linked or not. PIE makes binaries look like shared
libraries so I'm assuming file(1) on several of those architecture
might be confused here?

It also seems gcc produces different results depending on whether PIE
is enabled by default. Something like this:

  ,---
  $ cat test.c
  #include <stdio.h>
  int main(int argc, char **argv) {
     printf("test %s %d\n", "foo", 100);
     return 0;
  }
  $ gcc -static -o test test.c
  $ readelf -h test | grep Type
  $ gcc -static -fPIE -pie -o test test.c
  $ readelf -h test | grep Type
  `---

Produces for the readelf calls, EXEC, EXEC for builtin PIE, or
EXEC, DYN for non-builtin PIE. I'd assume this is possibly a problem
in gcc, so I'll file a bug there. In the mean time you might perhaps
want to removed the file check in src/Makefile.am for the
ext2init-bin.S target. So I think I'll reassign this to supermin.

Thanks,
Guillem

Reply via email to