For some time now, Debian tries to build all binaries with some "hardening" flags. This includes the -pie linker flag, which forces building of position-independent binaries. But I cannot build the current tip of the fixes-5.5 branch this way. At the point where poly reads the portable export, I get:
./poly -H 50 --error-exit < mlsource/BuildExport.sml lt-poly: memmgr.cpp:915: void MemMgr::AddTreeRange(SpaceTree**, MemSpace*, uintptr_t, uintptr_t): Assertion `t->tree[r] == 0' failed. /bin/bash: line 1: 14570 Aborted ./poly -H 50 --error-exit < mlsource/BuildExport.sml make[2]: *** [compiler] Error 134 make[2]: Leaving directory `/tmp/polyml-fixes/polyml'
Attached is the build log both _with_ (bad) and _without_ (good) the -pie flag.
I suspect that the successful build without -pie is an accident, ie. an uninitialized location is being read and it just happens to be 0 in this case.
Arch amd-64, gcc/g++ 4.7.2
On 26/12/2012 08:42, Ian Zimmerman wrote:
For some time now, Debian tries to build all binaries with some "hardening" flags. This includes the -pie linker flag, which forces building of position-independent binaries. But I cannot build the current tip of the fixes-5.5 branch this way. At the point where poly reads the portable export, I get:
./poly -H 50 --error-exit < mlsource/BuildExport.sml lt-poly: memmgr.cpp:915: void MemMgr::AddTreeRange(SpaceTree**, MemSpace*, uintptr_t, uintptr_t): Assertion `t->tree[r] == 0' failed. /bin/bash: line 1: 14570 Aborted ./poly -H 50 --error-exit < mlsource/BuildExport.sml make[2]: *** [compiler] Error 134 make[2]: Leaving directory `/tmp/polyml-fixes/polyml'
The problem was actually to do with ELF relocations on X86/64. It looks as though the linker doesn't handle the old-style relocations with -fPIE. I've backported commit 1602 from trunk and that seems to have fixed it.
Let me know if there are any more problems.
David