summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-10-29 15:43:23 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-10-29 15:43:23 +0000
commit5dd1598b2fa7ccb5445477410102cab554de7bce (patch)
tree5b32a24336fc98193e95d502fb0ca3d47505f754
parent1c24dffd66fd7673635f81c6228d28ddc675991f (diff)
downloadexecline-5dd1598b2fa7ccb5445477410102cab554de7bce.tar.xz
Support default pie
-rwxr-xr-xconfigure15
-rw-r--r--package/deps.mak4
-rwxr-xr-xtools/gen-deps.sh4
3 files changed, 21 insertions, 2 deletions
diff --git a/configure b/configure
index a5654da..8b10b01 100755
--- a/configure
+++ b/configure
@@ -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/package/deps.mak b/package/deps.mak
index f76f7b6..7cca70e 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -164,6 +164,10 @@ wait: EXTRA_LIBS :=
wait: src/execline/wait.o ${LIBEXECLINE} -lskarnet
withstdinas: EXTRA_LIBS :=
withstdinas: src/execline/withstdinas.o -lskarnet
+ifeq ($(strip $(DEFAULT_PIE)),)
libexecline.a.xyzzy: src/libexecline/el_execsequence.o src/libexecline/el_getstrict.o src/libexecline/el_parse.o src/libexecline/el_parse_from_buffer.o src/libexecline/el_parse_from_string.o src/libexecline/el_popenv.o src/libexecline/el_pushenv.o src/libexecline/el_semicolon.o src/libexecline/el_spawn0.o src/libexecline/el_spawn1.o src/libexecline/el_substandrun.o src/libexecline/el_substandrun_str.o src/libexecline/el_substitute.o src/libexecline/el_transform.o src/libexecline/el_vardupl.o src/libexecline/exlsn_define.o src/libexecline/exlsn_elglob.o src/libexecline/exlsn_import.o src/libexecline/exlsn_multidefine.o src/libexecline/exlsn_exlp.o src/libexecline/exlsn_main.o src/libexecline/exlsn_free.o src/libexecline/exlp.o
+else
+libexecline.a.xyzzy: src/libexecline/el_execsequence.lo src/libexecline/el_getstrict.lo src/libexecline/el_parse.lo src/libexecline/el_parse_from_buffer.lo src/libexecline/el_parse_from_string.lo src/libexecline/el_popenv.lo src/libexecline/el_pushenv.lo src/libexecline/el_semicolon.lo src/libexecline/el_spawn0.lo src/libexecline/el_spawn1.lo src/libexecline/el_substandrun.lo src/libexecline/el_substandrun_str.lo src/libexecline/el_substitute.lo src/libexecline/el_transform.lo src/libexecline/el_vardupl.lo src/libexecline/exlsn_define.lo src/libexecline/exlsn_elglob.lo src/libexecline/exlsn_import.lo src/libexecline/exlsn_multidefine.lo src/libexecline/exlsn_exlp.lo src/libexecline/exlsn_main.lo src/libexecline/exlsn_free.lo src/libexecline/exlp.lo
+endif
libexecline.so.xyzzy: EXTRA_LIBS := -lskarnet
libexecline.so.xyzzy: src/libexecline/el_execsequence.lo src/libexecline/el_getstrict.lo src/libexecline/el_parse.lo src/libexecline/el_parse_from_buffer.lo src/libexecline/el_parse_from_string.lo src/libexecline/el_popenv.lo src/libexecline/el_pushenv.lo src/libexecline/el_semicolon.lo src/libexecline/el_spawn0.lo src/libexecline/el_spawn1.lo src/libexecline/el_substandrun.lo src/libexecline/el_substandrun_str.lo src/libexecline/el_substitute.lo src/libexecline/el_transform.lo src/libexecline/el_vardupl.lo src/libexecline/exlsn_define.lo src/libexecline/exlsn_elglob.lo src/libexecline/exlsn_import.lo src/libexecline/exlsn_multidefine.lo src/libexecline/exlsn_exlp.lo src/libexecline/exlsn_main.lo src/libexecline/exlsn_free.lo src/libexecline/exlp.lo
diff --git a/tools/gen-deps.sh b/tools/gen-deps.sh
index 3f6838e..67ec2d4 100755
--- a/tools/gen-deps.sh
+++ b/tools/gen-deps.sh
@@ -68,10 +68,10 @@ for dir in $(ls -1 src | grep -v ^include) ; do
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 "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')"
+ echo "lib${file}.so.xyzzy:$(echo "$deps" | sed 's/\.o/.lo/g')"
done
for file in $(ls -1 src/$dir/deps-exe) ; do