Add -mno-relax to CFLAGS in bsd.prog/lib.mk instead of bsd.cpu.mk.

bsd.cpu.mk is included by bsd.init.mk before bsd.linker.mk, so it
was always setting the flag since LINKER_FEATURES wasn't defined.

Reported by:	mhorne
Reviewed by:	imp, mhorne
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D23076
This commit is contained in:
John Baldwin 2020-01-08 17:49:34 +00:00
parent f26c30a5f3
commit 79f5991559
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356504
3 changed files with 8 additions and 4 deletions

View File

@ -375,10 +375,6 @@ CFLAGS += -march=rv64imac -mabi=lp64
.else
CFLAGS += -march=rv64imafdc -mabi=lp64d
.endif
.if ${LINKER_FEATURES:U:Mriscv-relaxations} == ""
CFLAGS += -mno-relax
.endif
.endif
# NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk

View File

@ -98,6 +98,10 @@ STATIC_CFLAGS+= -ftls-model=initial-exec
STATIC_CXXFLAGS+= -ftls-model=initial-exec
.endif
.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == ""
CFLAGS += -mno-relax
.endif
.include <bsd.libnames.mk>
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries

View File

@ -57,6 +57,10 @@ LDFLAGS+= -Wl,-zretpolineplt
.endif
.endif
.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == ""
CFLAGS += -mno-relax
.endif
.if defined(CRUNCH_CFLAGS)
CFLAGS+=${CRUNCH_CFLAGS}
.else