summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorAlex Smith <alex.smith@warpsharp.info>2015-09-21 00:41:36 -0400
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-23 01:11:53 +0200
commit91b668acd6decec0a6f8d20bf56e2644f96adcb9 (patch)
treea0a26a812d05bc56bee5730b82a27f1ad3f71761 /configure
parent0544c95fd6d0e3c1072554f9d13baf45af7fbf56 (diff)
configure: Force mingw's ld to keep the reloc section
Binutils will always strip the relocation information from executable files even if it needs it (dynamicbase/ASLR). We can work around this by using the pic-executable flag combined with setting the correct entry point since apparently ld forgets what that should be. This problem affects both 32 and 64-bit mingw-w64. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure10
1 files changed, 10 insertions, 0 deletions
diff --git a/configure b/configure
index da9f42ebcf..f6bc622c1c 100755
--- a/configure
+++ b/configure
@@ -4392,6 +4392,16 @@ case $target_os in
objformat="win32"
ranlib=:
enable dos_paths
+ # Lets work around some stupidity in binutils.
+ # ld will strip relocations from executables even though we need them
+ # for dynamicbase (ASLR). Using -pie does retain the reloc section
+ # however ld then forgets what the entry point should be (oops) so we
+ # have to manually (re)set it.
+ if enabled x86_32; then
+ add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
+ elif enabled x86_64; then
+ add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
+ fi
;;
win32|win64)
disable symver