[Bug 1266492] Re: ld:i386 crashes with -static -fPIE -pie
Steve Beattie
sbeattie at ubuntu.com
Wed Jan 29 08:39:56 UTC 2014
Unfortunately, the workaround prescribed, adding hardening-wrapper as a
build dependency doesn't always work, and it's not clear why it does
work occasionally. First, in order for hardened-cc to do anything at
all, DEB_BUILD_HARDENING needs to be set, and second, if it detects
'-static' or other position independent executable incompatible
arguments, it only prevents itself from adding -pie; it does not filter
it out from the command line if it's already there. In these cases, -pie
is already present, having been added via DEB_BUILD_MAINT_OPTIONS or
some other way in the debian/rules file.
The most proper way that I can see to address this would be to rely on
the default dpkg-buildflags to get the basic level of protections. Then
to get all the protections, build depend on hardening-wrapper and export
DEB_BUILD_HARDENING=1 in debian/rules. I've attached a debdiff that I've
verified builds on all available architectures for ureadahead, since
that package is also hitting this issue.
The least invasive workaround would be to export MALLOC_CHECK=2 at build
time (i.e. in debian/rules), as this causes glibc to abort without
attempting to produce a backtrace when it detects internal malloc
corruption. This unfortunately still leaves configure believing that
'gcc -static' doesn't work, but it at least causes builds not to hang.
** Patch added: "ureadahead_0.100.0-17.debdiff"
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1266492/+attachment/3961491/+files/ureadahead_0.100.0-17.debdiff
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to eglibc in Ubuntu.
https://bugs.launchpad.net/bugs/1266492
Title:
ld:i386 crashes with -static -fPIE -pie
Status in Embedded GLIBC:
Incomplete
Status in “binutils” package in Ubuntu:
Confirmed
Status in “eglibc” package in Ubuntu:
New
Status in “evolution-data-server” package in Ubuntu:
Triaged
Status in “xorg-server” package in Ubuntu:
Triaged
Status in “binutils” source package in Trusty:
Confirmed
Status in “eglibc” source package in Trusty:
New
Status in “evolution-data-server” source package in Trusty:
Triaged
Status in “xorg-server” source package in Trusty:
Triaged
Bug description:
Making a simple file conftest.c with the following contents:
int main() { return 0; }
And then compiling it on i386 with gcc -fPIE -pie -static conftest.c
returns:
*** Error in `/usr/bin/ld': corrupted double-linked list: 0x08dddb38
***
This breaks compilation xorg-server on i386. I believe that -static
-fPIE -pie is probably invalid, and it fails on amd64 too.
$ gcc -fPIE -pie -static conftest.c
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/crtbeginT.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
But autoconf hangs on the corrupted double-linked list, which times
out the xorg-server build.
To manage notifications about this bug go to:
https://bugs.launchpad.net/eglibc/+bug/1266492/+subscriptions
More information about the foundations-bugs
mailing list