Bug 257727

Summary: 12.2/13.0: MK_RETPOLINE always prints NO
Product: Base System Reporter: Dani I. <i.dani>
Component: confAssignee: Ed Maste <emaste>
Status: Closed Not A Bug    
Severity: Affects Many People CC: emaste
Priority: ---    
Version: Unspecified   
Hardware: amd64   
OS: Any   

Description Dani I. 2021-08-10 07:01:24 UTC
Steps to reproduce:
- Set in /etc/src.conf:
WITH_KERNEL_RETPOLINE=
WITH_RETPOLINE=
- Run "make buildworld" or make "buildkernel"
- Printed output(MK_RETPOLINE=no):
--------------------------------------------------------------
>>> stage 1.2: bootstrap tools
--------------------------------------------------------------
cd /usr/src; INSTALL="sh /usr/src/tools/install.sh"  TOOLS_PREFIX=/usr/obj/usr/src/amd64.amd64/tmp  PATH=/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/libexec:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/usr/obj/usr/src/amd64.amd64/tmp  MAKEFLAGS="-m /usr/src/tools/build/mk  -j 8 -J 15,16 -m /usr/src/share/mk" make  -f Makefile.inc1  DESTDIR=  OBJTOP='/usr/obj/usr/src/amd64.amd64/tmp/obj-tools'  OBJROOT='${OBJTOP}/'  MAKEOBJDIRPREFIX=  BOOTSTRAPPING=1300514  BWPHASE=bootstrap-tools  SSP_CFLAGS=  MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes  -DNO_PIC MK_PROFILE=no -DNO_SHARED  -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no  MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no  MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no  MK_INCLUDES=yes MK_LLVM_TARGET_ALL=no bootstrap-tool

- The build commands still look fine (-mretpoline is set):
cc -target x86_64-unknown-freebsd12.2 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -c -O2 -pipe -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MD  -MF.depend.cam_iosched.o -MTcam_iosched.o -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -mretpoline -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-e--- cam_periph.o ---

What we tested (thanks to the freebsd irc channel):
- WITH_RETPOLINE=, WITH_RETPOLINE=yes and WITH_RETPOLINE=YES in src.conf
- FSBD 12.2 RELEASE, FBSD 13.0 STABLE / RELEASE
Comment 1 Ed Maste freebsd_committer freebsd_triage 2021-08-10 23:56:52 UTC
Note the build stage you quoted:
>>> stage 1.2: bootstrap tools

Many options are forced off for the bootstrap tools, because the system toolchain used to build them may not support the option and because there is little or no value in setting them for the bootstrap or build tools. You can look at Makefile.inc1 for the list of options that are forced off (look for BSARGS, TMAKE, KTMAKE, NXBMAKEARGS).

You can use `make -V` to see how config has been parsed:

$ make -V MK_RETPOLINE
yes