[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



Hi Nach,

2016-11-03 12:06 GMT+01:00 Nach <joecool22us@yahoo.com>:
> 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.

Static libraries shipped by Debian are being recompiled with PIE which
allows linking them
to PIE binaries.

>
> 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).

Please use -fno-pie. It works with older compilers, too.

Cheers,
Balint


Reply to: