[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#843035: gcc-6: --enable-default-pie configuration breaks linking when some libraries are static only



Package: gcc-6
Version: 6.2.0-10
Severity: important

Dear Maintainer,

GCC 6 in Debian changes linking policy from what was the default in all previous GCC versions.
Now when attemping to link an executable which makes use of some static libraries, GCC fails to link.
Failing includes error messages linking the static libraries like the following:

requires dynamic R_X86_64_PC32 reloc against 'memset' which may overflow at runtime; recompile with -fPIC
requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
requires unsupported dynamic reloc 11; recompile with -fPIC

Recompiling the static libraries with -fPIC as suggested isn't always feasable or even possible.
Passing -no-pie to the link command is the actual correct solution.

Since all previous versions of GCC in Debian do not require the addition of -no-pie for linking a static library into an executable, this change is unexpected and at least to me, undesired.
The error message also fails to indicate the best way to achieve simple linking as was possible previously.
The -no-pie option is also brand new in GCC 5, meaning that build scripts that add it will break compiling for those using earlier versions (like those using GCC from Debian Stable).

Those who want a position independant executable can always add -pie themselves as was possible will previous versions of GCC as far back as I can remember.
Changing the default in my opinion will cause unnecessary confusion and problems for developers like myself who use Debian as their development platform.



-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (700, 'unstable'), (650, 'testing'), (600, 'stable'), (500, 'oldoldstable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages gcc-6 depends on:
ii  binutils      2.27-9+b1
ii  cpp-6         6.2.0-10
ii  gcc-6-base    6.2.0-10
ii  libc6         2.24-5
ii  libcc1-0      6.2.0-10
ii  libgcc-6-dev  6.2.0-10
ii  libgcc1       1:6.2.0-10
ii  libgmp10      2:6.1.1+dfsg-1
ii  libisl15      0.17.1-1
ii  libmpc3       1.0.3-1
ii  libmpfr4      3.1.5-1
ii  libstdc++6    6.2.0-10
ii  zlib1g        1:1.2.8.dfsg-2+b3

Versions of packages gcc-6 recommends:
ii  libc6-dev  2.24-5

Versions of packages gcc-6 suggests:
pn  gcc-6-doc         <none>
pn  gcc-6-locales     <none>
ii  gcc-6-multilib    6.2.0-10
pn  libasan3-dbg      <none>
pn  libatomic1-dbg    <none>
pn  libcilkrts5-dbg   <none>
pn  libgcc1-dbg       <none>
pn  libgomp1-dbg      <none>
pn  libitm1-dbg       <none>
pn  liblsan0-dbg      <none>
pn  libmpx2-dbg       <none>
pn  libquadmath0-dbg  <none>
pn  libtsan0-dbg      <none>
pn  libubsan0-dbg     <none>

-- no debconf information


Reply to: