Page MenuHomeFreeBSD

D15283.diff
No OneTemporary

D15283.diff

Index: head/lib/libc/Makefile
===================================================================
--- head/lib/libc/Makefile
+++ head/lib/libc/Makefile
@@ -43,6 +43,7 @@
.endif
CLEANFILES+=tags
INSTALL_PIC_ARCHIVE=
+BUILD_NOSSP_PIC_ARCHIVE=
PRECIOUSLIB=
.ifndef NO_THREAD_STACK_UNWIND
Index: head/share/mk/bsd.README
===================================================================
--- head/share/mk/bsd.README
+++ head/share/mk/bsd.README
@@ -115,6 +115,8 @@
The profiled libraries are no longer built in a different directory than
the regular libraries. A new suffix, ".po", is used to denote a profiled
object, and ".pico" denotes a position-independent relocatable object.
+".nossppico" denotes a position-independent relocatable object without
+stack smashing protection.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Index: head/share/mk/bsd.dep.mk
===================================================================
--- head/share/mk/bsd.dep.mk
+++ head/share/mk/bsd.dep.mk
@@ -160,11 +160,14 @@
@rm -f ${.TARGET}
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
.if defined(LIB)
-CLEANFILES+= ${_D}.pico ${_D}.po
+CLEANFILES+= ${_D}.pico ${_D}.po ${_D}.nossppico
${_D}.pico: ${_DSRC} ${SOBJS:S/^${_D}.pico$//}
@rm -f ${.TARGET}
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
+ @rm -f ${.TARGET}
+ ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
+${_D}.nossppico: ${_DSRC} ${SOBJS:S/^${_D}.nossppico$//}
@rm -f ${.TARGET}
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
.endif
Index: head/share/mk/bsd.lib.mk
===================================================================
--- head/share/mk/bsd.lib.mk
+++ head/share/mk/bsd.lib.mk
@@ -21,9 +21,11 @@
# SHLIB_NAME will be defined only if we are to create a shared library.
# SHLIB_LINK will be defined only if we are to create a link to it.
# INSTALL_PIC_ARCHIVE will be defined only if we are to create a PIC archive.
+# BUILD_NOSSP_PIC_ARCHIVE will be defined only if we are to create a PIC archive.
.if defined(NO_PIC)
.undef SHLIB_NAME
.undef INSTALL_PIC_ARCHIVE
+.undef BUILD_NOSSP_PIC_ARCHIVE
.else
.if !defined(SHLIB) && defined(LIB)
SHLIB= ${LIB}
@@ -78,7 +80,8 @@
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
# .pico used for PIC object files
-.SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
+# .nossppico used for NOSSP PIC object files
+.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
.if !defined(PICFLAG)
.if ${MACHINE_CPUARCH} == "sparc64"
@@ -98,12 +101,19 @@
${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
+.c.nossppico:
+ ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//} ${CFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET}
+ ${CTFCONVERT_CMD}
+
.cc.po .C.po .cpp.po .cxx.po:
${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.cc.pico .C.pico .cpp.pico .cxx.pico:
${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+.cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico:
+ ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET}
+
.f.po:
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
${CTFCONVERT_CMD}
@@ -112,7 +122,11 @@
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
${CTFCONVERT_CMD}
-.s.po .s.pico:
+.f.nossppico:
+ ${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//} -o ${.TARGET} -c ${.IMPSRC}
+ ${CTFCONVERT_CMD}
+
+.s.po .s.pico .s.nossppico:
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
${CTFCONVERT_CMD}
@@ -126,6 +140,11 @@
${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
+.asm.nossppico:
+ ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \
+ ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+ ${CTFCONVERT_CMD}
+
.S.po:
${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \
-o ${.TARGET}
@@ -136,6 +155,11 @@
-c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
+.S.nossppico:
+ ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} \
+ -c ${.IMPSRC} -o ${.TARGET}
+ ${CTFCONVERT_CMD}
+
_LIBDIR:=${LIBDIR}
_SHLIBDIR:=${SHLIBDIR}
@@ -285,6 +309,19 @@
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
.endif
+.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
+NOSSPSOBJS+= ${OBJS:.o=.nossppico}
+DEPENDOBJS+= ${NOSSPSOBJS}
+CLEANFILES+= ${NOSSPSOBJS}
+_LIBS+= lib${LIB_PRIVATE}${LIB}_nossp_pic.a
+
+lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS}
+ @${ECHO} building special nossp pic ${LIB} library
+ @rm -f ${.TARGET}
+ ${AR} ${ARFLAGS} ${.TARGET} ${NOSSPSOBJS} ${ARADD}
+ ${RANLIB} ${RANLIBFLAGS} ${.TARGET}
+.endif
+
.endif # !defined(INTERNALLIB)
.if defined(_SKIP_BUILD)
@@ -423,6 +460,11 @@
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
.for _S in ${SRCS:N*.[hly]}
OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S}
+.endfor
+.endif
+.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
+.for _S in ${SRCS:N*.[hly]}
+OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.nossppico+= ${_S}
.endfor
.endif
Index: head/share/mk/meta.autodep.mk
===================================================================
--- head/share/mk/meta.autodep.mk
+++ head/share/mk/meta.autodep.mk
@@ -23,7 +23,7 @@
.if defined(SRCS)
# it would be nice to be able to query .SUFFIXES
-OBJ_EXTENSIONS+= .o .po .lo .pico
+OBJ_EXTENSIONS+= .o .po .lo .pico .nossppico
# explicit dependencies help short-circuit .SUFFIX searches
SRCS_DEP_FILTER+= N*.[hly]
@@ -179,7 +179,7 @@
@case "${.MAKE.META.FILES:T:M*.po.*}" in \
*.po.*) mv $@.${.MAKE.PID} $@;; \
*) { cat $@.${.MAKE.PID}; \
- sed 's,\.pico:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \
+ sed 's,\.nossppico:,.o:,;s,\.pico:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \
rm -f $@.${.MAKE.PID};; \
esac
.else
Index: head/share/mk/src.libnames.mk
===================================================================
--- head/share/mk/src.libnames.mk
+++ head/share/mk/src.libnames.mk
@@ -31,6 +31,7 @@
_INTERNALLIBS= \
amu \
bsnmptools \
+ c_nossp_pic \
cron \
elftc \
fifolog \
@@ -470,6 +471,9 @@
LIBPMCSTATDIR= ${OBJTOP}/lib/libpmcstat
LIBPMCSTAT?= ${LIBPMCSTATDIR}/libpmcstat.a
+
+LIBC_NOSSP_PICDIR= ${OBJTOP}/lib/libc
+LIBC_NOSSP_PIC?= ${LIBC_NOSSP_PICDIR}/libc_nossp_pic.a
# Define a directory for each library. This is useful for adding -L in when
# not using a --sysroot or for meta mode bootstrapping when there is no

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 1:16 PM (15 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15571340
Default Alt Text
D15283.diff (6 KB)

Event Timeline