riscv64 build fails with binutils 2.33.1: ``` /usr/local/bin/riscv64-unknown-freebsd12.0-gcc --sysroot=/scratch/tmp/lwhsu/obj/scratch/tmp/lwhsu/src/riscv.riscv64/tmp -B/usr/local/riscv64-unknown-freebsd12.0/bin/ -O2 -pipe -march=rv64imafdc -mabi=lp64d -I. -I/scratch/tmp/lwhsu/src/usr.sbin/jail -DINET6 -DINET -g -std=gnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-error=address -Wno-error=array-bounds -Wno-error=attributes -Wno-error=bool-compare -Wno-error=cast-align -Wno-error=clobbered -Wno-error=deprecated-declarations -Wno-error=enum-compare -Wno-error=extra -Wno-error=inline -Wno-error=logical-not-parentheses -Wno-error=strict-aliasing -Wno-error=uninitialized -Wno-error=unused-but-set-variable -Wno-error=unused-function -Wno-error=unused-value -Wno-error=misleading-indentation -Wno-error=nonnull-compare -Wno-error=shift-negative-value -Wno-error=tautological-compare -Wno-error=unused-const-variable -Wno-error=bool-operation -Wno-error=deprecated -Wno-error=expansion-to-defined -Wno-error=format-overflow -Wno-error=format-truncation -Wno-error=implicit-fallthrough -Wno-error=int-in-bool-context -Wno-error=memset-elt-size -Wno-error=noexcept-type -Wno-error=nonnull -Wno-error=pointer-compare -Wno-error=stringop-overflow -Wno-error=aggressive-loop-optimizations -Wno-error=cast-function-type -Wno-error=catch-value -Wno-error=multistatement-macros -Wno-error=restrict -Wno-error=sizeof-pointer-memaccess -Wno-error=stringop-truncation -o jail.full jail.o command.o config.o state.o jaillex.o jailparse.o -ljail -lkvm -lutil jailparse.o: in function `yyparse': /scratch/tmp/lwhsu/src/usr.sbin/jail/jailparse.y:75:(.text+0xfe): relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' collect2: error: ld returned 1 exit status *** [jail.full] Error code 1 make[4]: stopped in /scratch/tmp/lwhsu/src/usr.sbin/jail 1 error ``` Workaround patch at https://reviews.freebsd.org/D22457
A commit references this bug: Author: lwhsu Date: Wed Nov 20 16:20:49 UTC 2019 New revision: 354896 URL: https://svnweb.freebsd.org/changeset/base/354896 Log: Workaround riscv64 build when using binutils 2.33.1 PR: 242109 Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22457 Changes: head/usr.sbin/jail/Makefile
A commit references this bug: Author: lwhsu Date: Wed Nov 20 16:35:59 UTC 2019 New revision: 354899 URL: https://svnweb.freebsd.org/changeset/base/354899 Log: Limit the workaround to riscv only PR: 242109 Sponsored by: The FreeBSD Foundation Changes: head/usr.sbin/jail/Makefile
A commit references this bug: Author: lwhsu Date: Wed Nov 20 16:54:22 UTC 2019 New revision: 354900 URL: https://svnweb.freebsd.org/changeset/base/354900 Log: Use the correct variable, also limit the scope to bfd PR: 242109 Reported by: jhb Sponsored by: The FreeBSD Foundation Changes: head/usr.sbin/jail/Makefile
build is failing in cirrus-ci with --- cleandir_subdir_usr.sbin --- make[4]: "/tmp/cirrus-ci-build/usr.sbin/jail/Makefile" line 21: Malformed conditional (${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv") https://cirrus-ci.com/task/6720128841940992?command=main#L11090
A commit references this bug: Author: emaste Date: Thu Nov 21 13:56:17 UTC 2019 New revision: 354950 URL: https://svnweb.freebsd.org/changeset/base/354950 Log: revert r354935 and apply fix for cleandir failure This reapplies the RISC-V GNU ld workaround from r354896, r354899, and 354900, along with a fix for the build failure during cleandir. LINKER_TYPE was not being set during cleandir, resulting in Malformed conditional (${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv") from Cirrus-CI. PR: 242109 Sponsored by: The FreeBSD Foundation Changes: head/contrib/amd/amd/amd.8 head/contrib/amd/amd/amd.c head/usr.sbin/jail/Makefile
This appears to be due to a regression in binutils 2.33. I narrowed it down to the offending commit and reported it at: https://sourceware.org/bugzilla/show_bug.cgi?id=25258
sourceware.org bug had an update 2019-12-10 but no activity since then
Sourceware bug had an update on 2021-04-19 asking about reproducibility. We'll need to try removing the workaround from usr.sbin/jail/Makefile and see if it's reproducible.