summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2019-01-05 09:36:32 -0600
committerSamuel Holland <samuel@sholland.org>2019-01-05 09:36:32 -0600
commitd186323a2db1f8bf65b24236ce8d2ddff1b4385a (patch)
tree9a6b8cb275db8d142924eabc82ec9204a55ae5f9 /Makefile
parentde9e45d7f27dfe70634e9add7c3348aa3628a68e (diff)
downloadgcompat-d186323a2db1f8bf65b24236ce8d2ddff1b4385a.tar.gz
gcompat-d186323a2db1f8bf65b24236ce8d2ddff1b4385a.tar.bz2
gcompat-d186323a2db1f8bf65b24236ce8d2ddff1b4385a.tar.xz
gcompat-d186323a2db1f8bf65b24236ce8d2ddff1b4385a.zip
Fix compatibility with Linux 4.17+
The gcompat loader compiled as a static binary doesn't work on Linux since commit a4ff8e8620d3f4, failing with the error: ``` Uhuuh, elf segment at 0000000000400000 requested but the memory is mapped already ``` This is because the binary we are the ELF interpreter for is also loaded at 0x400000. While it's actually okay to overlap the binary, since we're going to call `execve` again, the kernel doesn't allow the overlap anymore. Fix that by compiling the loader as static PIE, so it can be loaded at a different address. Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 0f18af0..6a36129 100644
--- a/Makefile
+++ b/Makefile
@@ -73,7 +73,7 @@ ${LIBGCOMPAT_NAME}: ${LIBGCOMPAT_OBJ}
${LIBGCOMPAT_OBJ}: ${LIBGCOMPAT_INCLUDE}
${LOADER_NAME}: ${LOADER_OBJ}
- ${CC} ${CFLAGS} ${LDFLAGS} -static -o ${LOADER_NAME} ${LOADER_OBJ}
+ ${CC} ${CFLAGS} ${LDFLAGS} -static-pie -o ${LOADER_NAME} ${LOADER_OBJ}
.c.o:
${CC} ${CPPFLAGS} ${CFLAGS} -c -D_BSD_SOURCE \