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.
We can combine the nxcompat/dynamicbase check because they were added to
binutils at the same time.
---
configure | 14 --
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index a82bef7..60b31ec 100755
--- a/configure
+++ b/configure
@@ -3475,8 +3475,6 @@ case $target_os in
elif enabled arm; then
LIBTARGET=arm-wince
fi
-check_ldflags -Wl,--nxcompat
-check_ldflags -Wl,--dynamicbase
shlibdir_default=$bindir_default
SLIBPREF=
SLIBSUF=.dll
@@ -3492,6 +3490,18 @@ case $target_os in
dlltool=${cross_prefix}dlltool
ranlib=:
enable dos_paths
+check_ldflags -Wl,--nxcompat,--dynamicbase
+# 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.
+add_ldexeflags -Wl,--pic-executable
+if enabled x86_32; then
+add_ldexeflags -Wl,-e,_mainCRTStartup
+elif enabled x86_64; then
+add_ldexeflags -Wl,-e,mainCRTStartup
+fi
;;
win32|win64)
disable symver
--
1.9.4.msysgit.2
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel