diff --git a/Makefile.user b/Makefile.user index 907e74bd9eec7d7f395e0a67055e792c90988293..9e4f040e7cbc3eb5db7d128b5ccea2deeac2260a 100644 --- a/Makefile.user +++ b/Makefile.user @@ -2,10 +2,15 @@ include ../config-host.mak include $(SRC_PATH)/rules.mak +include config.mak .PHONY: all -VPATH=$(SRC_PATH) +# Do not take %.o from $(SRC_PATH), only %.c and %.h +# All %.o for user targets should be built with -fpie, when +# configured with --enable-user-pie, so we don't want to +# take %.o from $(SRC_PATH), since they built without -fpie +vpath %.c %.h $(SRC_PATH) QEMU_CFLAGS+=-I.. diff --git a/configure b/configure index cf1db862549e6a08de3091bbb324f1c8062f54a1..d815c7aa90cc9de144fe09c5bb8b97da1bb7808b 100755 --- a/configure +++ b/configure @@ -2652,3 +2652,6 @@ d=libuser mkdir -p $d rm -f $d/Makefile ln -s $source_path/Makefile.user $d/Makefile +if test "$static" = "no" -a "$user_pie" = "yes" ; then + echo "QEMU_CFLAGS+=-fpie" > $d/config.mak +fi