Permalink
Browse files

Add further -no-pie checks to Rumprun build tools

This builds upon the previous commit to add -no-pie anywhere the
relocatable flag (-Wl,-r) is used to handle compilers that enable -pie
by default (Such as Debian Stretch).
  • Loading branch information...
kent-mcleod committed Feb 14, 2018
1 parent 35d8119 commit b3c1033b090b65e8e86999ddd063c174502aa3f0
Showing with 14 additions and 4 deletions.
  1. +1 −0 app-tools/Makefile
  2. +1 −1 app-tools/cc.in
  3. +2 −2 app-tools/cookfs.in
  4. +2 −1 app-tools/rumprun-bake.in
  5. +8 −0 build-rr.sh
View
@@ -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 $$@
View
@@ -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
View
@@ -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}')
@@ -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} \
View
@@ -493,6 +493,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 ()

0 comments on commit b3c1033

Please sign in to comment.