mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
build: Support executable only ldflags
The options is useful to build position-independent executables on hardened systems (e.g. Android L and Gentoo Hardened).
This commit is contained in:
parent
b396bbad10
commit
bb0babd705
4
Makefile
4
Makefile
@ -104,7 +104,7 @@ FF_DEP_LIBS := $(DEP_LIBS)
|
|||||||
all: $(AVPROGS)
|
all: $(AVPROGS)
|
||||||
|
|
||||||
$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
|
$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
|
||||||
$(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS)
|
||||||
|
|
||||||
tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
|
tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ endef
|
|||||||
$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(EXESUF)=))))
|
$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(EXESUF)=))))
|
||||||
|
|
||||||
$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
|
$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
|
||||||
$(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
|
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
|
||||||
|
|
||||||
OBJDIRS += tools
|
OBJDIRS += tools
|
||||||
|
|
||||||
|
9
configure
vendored
9
configure
vendored
@ -244,6 +244,7 @@ Toolchain options:
|
|||||||
--host-os=OS compiler host OS [$target_os]
|
--host-os=OS compiler host OS [$target_os]
|
||||||
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
|
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
|
||||||
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
|
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
|
||||||
|
--extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
|
||||||
--extra-libs=ELIBS add ELIBS [$ELIBS]
|
--extra-libs=ELIBS add ELIBS [$ELIBS]
|
||||||
--extra-version=STRING version string suffix []
|
--extra-version=STRING version string suffix []
|
||||||
--optflags=OPTFLAGS override optimization-related compiler flags
|
--optflags=OPTFLAGS override optimization-related compiler flags
|
||||||
@ -679,6 +680,10 @@ add_ldflags(){
|
|||||||
append LDFLAGS $($ldflags_filter "$@")
|
append LDFLAGS $($ldflags_filter "$@")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_ldexeflags(){
|
||||||
|
append LDEXEFLAGS $($ldflags_filter "$@")
|
||||||
|
}
|
||||||
|
|
||||||
add_stripflags(){
|
add_stripflags(){
|
||||||
append STRIPFLAGS "$@"
|
append STRIPFLAGS "$@"
|
||||||
}
|
}
|
||||||
@ -2356,6 +2361,9 @@ for opt do
|
|||||||
--extra-ldflags=*)
|
--extra-ldflags=*)
|
||||||
add_ldflags $optval
|
add_ldflags $optval
|
||||||
;;
|
;;
|
||||||
|
--extra-ldexeflags=*)
|
||||||
|
add_ldexeflags $optval
|
||||||
|
;;
|
||||||
--extra-libs=*)
|
--extra-libs=*)
|
||||||
add_extralibs $optval
|
add_extralibs $optval
|
||||||
;;
|
;;
|
||||||
@ -4575,6 +4583,7 @@ LD_LIB=$LD_LIB
|
|||||||
LD_PATH=$LD_PATH
|
LD_PATH=$LD_PATH
|
||||||
DLLTOOL=$dlltool
|
DLLTOOL=$dlltool
|
||||||
LDFLAGS=$LDFLAGS
|
LDFLAGS=$LDFLAGS
|
||||||
|
LDEXEFLAGS=$LDEXEFLAGS
|
||||||
SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
|
SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
|
||||||
STRIPFLAGS=$STRIPFLAGS
|
STRIPFLAGS=$STRIPFLAGS
|
||||||
YASMFLAGS=$YASMFLAGS
|
YASMFLAGS=$YASMFLAGS
|
||||||
|
@ -35,6 +35,9 @@ to your project LDFLAGS:
|
|||||||
-Wl,-Bsymbolic
|
-Wl,-Bsymbolic
|
||||||
@end example
|
@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
|
@section BSD
|
||||||
|
|
||||||
BSD make will not build Libav, you need to install and use GNU Make
|
BSD make will not build Libav, you need to install and use GNU Make
|
||||||
|
@ -46,7 +46,7 @@ $(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
|
|||||||
$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
|
$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
|
||||||
|
|
||||||
$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
|
$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
|
||||||
$$(LD) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
|
$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
|
||||||
|
|
||||||
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
|
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
|
||||||
$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
|
$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
|
||||||
|
Loading…
Reference in New Issue
Block a user