The options is useful to build position-independent executables on
hardened systems (e.g. Android L and Gentoo Hardened).
---
 Makefile          | 4 ++--
 configure         | 9 +++++++++
 doc/platform.texi | 3 +++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 6302997..99d3240 100644
--- a/Makefile
+++ b/Makefile
@@ -104,7 +104,7 @@ FF_DEP_LIBS  := $(DEP_LIBS)
 all: $(AVPROGS)
 
 $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
-       $(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
+       $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS)
 
 tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
 
@@ -149,7 +149,7 @@ endef
 $(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(EXESUF)=))))
 
 $(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
-       $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
+       $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
 
 OBJDIRS += tools
 
diff --git a/configure b/configure
index ea26029..d78fd56 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,7 @@ Toolchain options:
   --host-os=OS             compiler host OS [$target_os]
   --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
   --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
+  --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
   --extra-libs=ELIBS       add ELIBS [$ELIBS]
   --extra-version=STRING   version string suffix []
   --optflags=OPTFLAGS      override optimization-related compiler flags
@@ -679,6 +680,10 @@ add_ldflags(){
     append LDFLAGS $($ldflags_filter "$@")
 }
 
+add_ldexeflags(){
+    append LDEXEFLAGS $($ldflags_filter "$@")
+}
+
 add_stripflags(){
     append STRIPFLAGS "$@"
 }
@@ -2355,6 +2360,9 @@ for opt do
         --extra-ldflags=*)
             add_ldflags $optval
         ;;
+        --extra-ldexeflags=*)
+            add_ldexeflags $optval
+        ;;
         --extra-libs=*)
             add_extralibs $optval
         ;;
@@ -4574,6 +4582,7 @@ LD_LIB=$LD_LIB
 LD_PATH=$LD_PATH
 DLLTOOL=$dlltool
 LDFLAGS=$LDFLAGS
+LDEXEFLAGS=$LDEXEFLAGS
 SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
 STRIPFLAGS=$STRIPFLAGS
 YASMFLAGS=$YASMFLAGS
diff --git a/doc/platform.texi b/doc/platform.texi
index 3ada146..d4a6618 100644
--- a/doc/platform.texi
+++ b/doc/platform.texi
@@ -35,6 +35,9 @@ to your project LDFLAGS:
 -Wl,-Bsymbolic
 @end example
 
+If your target platform requires position independent binaries, you should
+pass the correct linking flag (e.g. @code{-pie}) to @code{--extra-ldexeflags}.
+
 @section BSD
 
 BSD make will not build Libav, you need to install and use GNU Make
-- 
1.9.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to