share/mk: pass SHARED_CFLAGS to PIC and PIE from assembly

This matches what we do with C sources.  Document SHARED_CFLAGS.

PR:		286975
Reviewed by:	jhb, emaste
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D50466
This commit is contained in:
Brooks Davis
2025-05-24 00:35:21 +01:00
parent cba6bf5d95
commit 9c20010361
2 changed files with 9 additions and 4 deletions
+3
View File
@@ -197,6 +197,9 @@ LIBADD Additional libraries. This is for base system libraries
LIBADD.${.TARGET:T}
Libraries dependent on output file name.
SHARED_CFLAGS Additional compiler flags used when creating shared or
position independent object files.
COMPILER_FEATURES
A list of features that the compiler supports. Zero or
more of:
+6 -4
View File
@@ -60,12 +60,13 @@ PIEFLAG?=-fpie
.asm.pico:
${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \
${CFLAGS} ${ACFLAGS} \
${SHARED_CFLAGS} ${CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
.asm.nossppico:
${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \
${SHARED_CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} \
${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} \
${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
@@ -73,18 +74,19 @@ PIEFLAG?=-fpie
.asm.pieo:
${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PIEFLAG} -DPIC \
${CFLAGS} ${ACFLAGS} \
${SHARED_CFLAGS} ${CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
.S.pico:
${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC \
${CFLAGS} ${ACFLAGS} \
${SHARED_CFLAGS} ${CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
.S.nossppico:
${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC \
${SHARED_CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} \
${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} \
${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
@@ -92,7 +94,7 @@ PIEFLAG?=-fpie
.S.pieo:
${CC:N${CCACHE_BIN}} ${PIEFLAG} -DPIC \
${CFLAGS} ${ACFLAGS} \
${SHARED_CFLAGS} ${CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}