diff --git a/app-tools/Makefile b/app-tools/Makefile index beb39b817..eb3e2bc41 100644 --- a/app-tools/Makefile +++ b/app-tools/Makefile @@ -83,6 +83,7 @@ ${TOOLOBJ}/${2}: ${1} Makefile ${TOOLOBJ} -e 's#!PLATFORM!#$(PLATFORM)#g;' \ -e 's#!CPPFLAGS!#$(BUILDRUMP_TOOL_CPPFLAGS)#g;' \ -e 's#!CFLAGS!#$(BUILDRUMP_TOOL_CFLAGS)#g;' \ + -e 's#!EXTRACCFLAGS!#$(EXTRACCFLAGS)#g;' \ -e 's#!CXXFLAGS!#$(BUILDRUMP_TOOL_CXXFLAGS)#g;' \ -e 's#!LDFLAGS_BAKE!#$(LDFLAGS_BAKE)#g;' chmod 755 $$@ diff --git a/app-tools/cc.in b/app-tools/cc.in index ef0db9a2d..4ea20a847 100644 --- a/app-tools/cc.in +++ b/app-tools/cc.in @@ -96,7 +96,7 @@ ferment) ${CC} ${CFLAGS} -no-integrated-cpp \ --sysroot !DESTDIR!/rumprun-!MACHINE_GNU_ARCH! \ -specs=!DESTDIR!/rumprun-!MACHINE_GNU_ARCH!/lib/specs-compile_or_ferment \ - -Wl,-r -Wl,-u,main \ + !EXTRACCFLAGS! -Wl,-r -Wl,-u,main \ "$@" !DESTDIR!/rumprun-!MACHINE_GNU_ARCH!/share/!TOOLTUPLE!-recipe.s ${EXTRALIBS} || die # If the presumed output file did not change, and the compiler diff --git a/app-tools/cookfs.in b/app-tools/cookfs.in index 4972b3fd8..16d8b2bc5 100644 --- a/app-tools/cookfs.in +++ b/app-tools/cookfs.in @@ -164,7 +164,7 @@ processonefile () ln -sf -- "${fabs}" ${LINKPATH} ${RUMPRUN_COOKFS_CC} !CFLAGS! !CPPFLAGS! -nostdlib \ - -Wl,-r,-b,binary -o ${TMPDIR}/d${fn}.o ${LINKPATH} + !EXTRACCFLAGS! -Wl,-r,-b,binary -o ${TMPDIR}/d${fn}.o ${LINKPATH} ${RUMPRUN_COOKFS_OBJCOPY} \ --redefine-sym ${LINKPATH_BIN}_start=${rf}_start \ @@ -233,7 +233,7 @@ exec 1>&3 3>&- unset IFS ${RUMPRUN_COOKFS_CC} !CFLAGS! !CPPFLAGS! -I${RUMPRUN_COOKFS_INCDIR} \ - -nostdlib -Wl,-r -o ${TMPDIR}/fin.o ${TMPDIR}/d*.o ${TMPDIR}/constr.c + -nostdlib !EXTRACCFLAGS! -Wl,-r -o ${TMPDIR}/fin.o ${TMPDIR}/d*.o ${TMPDIR}/constr.c ${RUMPRUN_COOKFS_OBJCOPY} ${LSYM} ${TMPDIR}/fin.o ${OUTFILE} totsize=$(${RUMPRUN_COOKFS_SIZE} ${OUTFILE} | awk 'NR == 2{print $4}') diff --git a/app-tools/rumprun-bake.in b/app-tools/rumprun-bake.in index b43195a2f..3d82bae27 100644 --- a/app-tools/rumprun-bake.in +++ b/app-tools/rumprun-bake.in @@ -397,8 +397,9 @@ done MACHINE_GNU_ARCH=${RUMPBAKE_TUPLE%%-*} + # Final link using cc to produce the unikernel image. -${runcmd} ${RUMPBAKE_BACKINGCC} ${RUMPBAKE_CFLAGS} \ +${runcmd} ${RUMPBAKE_BACKINGCC} ${RUMPBAKE_CFLAGS} !EXTRACCFLAGS! \ --sysroot ${RUMPBAKE_TOOLDIR}/rumprun-${MACHINE_GNU_ARCH} \ -specs=${RUMPBAKE_TOOLDIR}/rumprun-${MACHINE_GNU_ARCH}/lib/rumprun-${PLATFORM}/specs-bake \ -o ${OUTPUT} ${allobjs} \ diff --git a/build-rr.sh b/build-rr.sh index e361c327d..4627ee2d8 100755 --- a/build-rr.sh +++ b/build-rr.sh @@ -340,6 +340,7 @@ checktools () echo '>>' sleep ${delay} fi + } buildrump () @@ -493,6 +494,14 @@ makeconfig () else echo "CONFIG_CXX=no" >> ${1} fi + + # Check for if compiler supports -no-pie and save to EXTRACCFLAGS + gccnopie= + if [ -z "`echo 'int p=1;' | ${CC} -no-pie -S -o /dev/null -x c - 2>&1`" ]; then + gccnopie=-no-pie + fi + echo "EXTRACCFLAGS=${quote}${gccnopie}${quote}" >> ${1} + } dobuild ()