diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-10-29 23:21:04 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-10-29 23:21:04 +0000 |
commit | d3fb16691fa3aed26bb4472295a4280d0f0aa2d1 (patch) | |
tree | d06460f3890138b3a044c4ab344c255499eed471 | |
parent | 512aa721f36386907bcdcecfeadcb8134e749ade (diff) | |
download | mdevd-d3fb16691fa3aed26bb4472295a4280d0f0aa2d1.tar.xz |
Support default pie
-rwxr-xr-x | configure | 15 | ||||
-rwxr-xr-x | tools/gen-deps.sh | 4 |
2 files changed, 19 insertions, 0 deletions
@@ -299,6 +299,16 @@ if [ "x$target" != "x$(cat $sysdeps/target)" ] ; then exit 1 fi +defaultpie=false +echo "Checking whether we're building PIE..." +if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -dM -E - < /dev/null | grep -qF __PIE__ ; then + defaultpie=true + CFLAGS_AUTO="$CFLAGS_AUTO -fPIC" + echo " ... yes" +else + echo " ... no" +fi + spawn_lib=$(cat $sysdeps/spawn.lib) socket_lib=$(cat $sysdeps/socket.lib) sysclock_lib=$(cat $sysdeps/sysclock.lib) @@ -411,6 +421,11 @@ if $shared ; then else echo "DO_SHARED :=" fi +if $defaultpie ; then + echo "DEFAULT_PIE := 1" +else + echo "DEFAULT_PIE :=" +fi exec 1>&3 3>&- echo " ... done." diff --git a/tools/gen-deps.sh b/tools/gen-deps.sh index 5c96dd1..67ec2d4 100755 --- a/tools/gen-deps.sh +++ b/tools/gen-deps.sh @@ -65,7 +65,11 @@ for dir in $(ls -1 src | grep -v ^include) ; do deps="$deps src/$dir/$dep" fi done < src/$dir/deps-lib/$file + echo 'ifeq ($(strip $(DEFAULT_PIE)),)' echo "lib${file}.a.xyzzy:$deps" + echo else + echo "lib${file}.a.xyzzy:$(echo "$deps" | sed 's/\.o/.lo/g')" + echo endif echo "lib${file}.so.xyzzy: EXTRA_LIBS :=$libs" echo "lib${file}.so.xyzzy:$(echo "$deps" | sed 's/\.o/.lo/g')" done |