Bug 252842 - WITHOUT_LLD_BOOTSTRAP build option fails in /usr/src/usr.bin/gh-bc
Summary: WITHOUT_LLD_BOOTSTRAP build option fails in /usr/src/usr.bin/gh-bc
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-20 02:53 UTC by Michael Dexter
Modified: 2021-01-27 00:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Dexter 2021-01-20 02:53:48 UTC
The WITHOUT_LLD_BOOTSTRAP build option fails with:

--- all_subdir_usr.bin ---
--- all_subdir_usr.bin/gh-bc ---
--- gh-bc.full ---
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/tmp/usr/bin -O2 -pipe -fno-common -DMAINEXEC=bc -DNLSPATH=/usr/share/nls/%L/%N.cat -DBC_ENABLED -DBC_ENABLE_PROMPT -DBC_ENABLE_LONG_OPTIONS -DBC_ENABLE_EXTRA_MATH -DBC_ENABLE_HISTORY -DBC_ENABLE_RAND -DDC_ENABLED -DNDEBUG -DVERSION=3.2.4 -I/usr/src/contrib/bc/include -DBC_ENABLE_NLS=1 -flto -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 -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments    -o gh-bc.full args.o data.o file.o lang.o lex.o main.o num.o parse.o program.o read.o 
Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  -Qunused-arguments    -c /usr/src/sbin/fsck_ffs/pass3.c -o pass3.o
--- all_subdir_usr.bin ---
ld: error: args.o: Invalid record
--- all_subdir_usr.bin/ypcat ---
--- ypcat.1.gz ---
--- all_subdir_usr.sbin ---
--- .depend ---
--- all_subdir_usr.bin ---
--- all_subdir_usr.bin/gh-bc ---
cc: error: linker command failed with exit code 1 (use -v to see invocation)
--- all_subdir_lib ---
--- all_subdir_lib/libc ---
--- fts-compat11.po ---
--- all_subdir_secure ---
--- seed_cfb.po ---
--- all_subdir_usr.bin ---
--- all_subdir_usr.bin/msgs ---
--- msgs.1.gz ---
--- all_subdir_usr.bin/ypmatch ---
--- ypmatch.full ---
--- all_subdir_usr.bin/ypcat ---
gzip -cn /usr/src/usr.bin/ypcat/ypcat.1 > ypcat.1.gz
--- all_subdir_usr.sbin ---
echo nfsdumpstate.full: /usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/tmp/usr/lib/libc.a  >> .depend
--- all_subdir_lib ---
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/tmp/usr/bin -pg  -O2 -pipe -fno-common   -DNO__SCCSID -DNO__RCSID -I/usr/src/lib/libc/include -I/usr/src/include -I/usr/src/lib/libc/amd64 -DNLS  -D__DBINTERFACE_PRIVATE -I/usr/src/contrib/gdtoa -I/usr/src/contrib/libc-vis -DINET6 -I/usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/lib/libc -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libmd -I/usr/src/contrib/jemalloc/include -I/usr/src/contrib/tzcode/stdtime -I/usr/src/lib/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DWANT_HYPERV -DYP -DNS_CACHING -DSYMBOL_VERSIONING -g -MD  -MF.depend.fts-compat11.po -MTfts-compat11.po -std=gnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string--- all_subdir_usr.bin ---
--- all_subdir_usr.bin/msgs ---
gzip -cn /usr/src/usr.bin/msgs/msgs.1 > msgs.1.gz
--- all_subdir_lib ---
-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  -Qunused-arguments    -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/src/lib/libc/gen/fts-compat11.c -o fts-compat11.po
--- all_subdir_usr.bin ---
--- all_subdir_usr.bin/ypmatch ---
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/tmp/usr/bin -O2 -pipe -fno-common -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 -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-c
1 error

make[5]: stopped in /usr/obj/usr/src/tools/tools/bos-ng/_.tst/usr/src/amd64.amd64/rescue/rescue
*** [objs] Error code 2

make[4]: stopped in /usr/src/rescue/rescue
1 error

make[4]: stopped in /usr/src/rescue/rescue
--- all_subdir_cddl ---
--- all_subdir_lib ---
--- all_subdir_lib/msun ---
--- all_subdir_tests ---
--- all_subdir_tests/sys/capsicum ---
--- all_subdir_lib ---
--- all_subdir_lib/libc ---
--- all_subdir_share ---
--- all_subdir_share/colldef ---
--- all_subdir_lib ---
--- all_subdir_lib/libc++ ---
--- all_subdir_sbin ---
--- all_subdir_sbin/fsck_ffs ---
--- all_subdir_share ---
--- all_subdir_share/examples ---
--- all_subdir_stand ---
--- all_subdir_stand/libsa ---

Additional context available upon request.
Comment 1 Michael Dexter 2021-01-20 04:36:34 UTC
Output from a second run:

--- all_subdir_usr.bin ---
mv dc_tests.tmp dc_tests
--- Kyuafile ---
--- gh-bc.full ---
--- all_subdir_lib ---
--- isinf.po ---
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/tcpdump ---
--- print-tftp.o ---
--- all_subdir_lib ---
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -pg  -O2 -pipe -fno-common   -DNO__SCCSID -DNO__RCSID -I/usr/src/lib/libc/include -I/usr/src/include -I/usr/src/lib/libc/amd64 -DNLS  -D__DBINTERFACE_PRIVATE -I/usr/src/contrib/gdtoa -I/usr/src/contrib/libc-vis -DINET6 -I/usr/obj/usr/src/amd64.amd64/lib/libc -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libmd -I/usr/src/contrib/jemalloc/include -I/usr/src/contrib/tzcode/stdtime -I/usr/src/lib/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DWANT_HYPERV -DYP -DNS_CACHING -DSYMBOL_VERSIONING -g -MD  -MF.depend.isinf.po -MTisinf.po -std=gnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-u--- all_subdir_usr.bin ---
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -O2 -pipe -fno-common -DMAINEXEC=bc -DNLSPATH=/usr/share/nls/%L/%N.cat -DBC_ENABLED -DBC_ENABLE_PROMPT -DBC_ENABLE_LONG_OPTIONS -DBC_ENABLE_EXTRA_MATH -DBC_ENABLE_HISTORY -DBC_ENABLE_RAND -DDC_ENABLED -DNDEBUG -DVERSION=3.2.4 -I/usr/src/contrib/bc/include -DBC_ENABLE_NLS=1 -flto -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 -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments    -o gh-bc.full args.o data.o file.o lang.o lex.o main.o num.o parse.o program.o read.o vector.o vm.o--- all_subdir_lib ---
nused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  -Qunused-arguments    -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/src/lib/libc/gen/isinf.c -o isinf.po
--- all_subdir_usr.bin ---
 bc.o bc_lex.o bc_parse.o dc.o dc_lex.o dc_parse.o history.o library.o bc_help.o dc_help.o lib.o lib2.o opt.o rand.o  
--- all_subdir_usr.sbin ---
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin  -O2 -pipe -fno-common   -I/usr/src/usr.sbin/tcpdump/tcpdump -I/usr/src/contrib/tcpdump -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -DINET6 -DHAVE_OS_IPV6_SUPPORT -DLBL_ALIGN -DHAVE_CASPER -I/usr/obj/usr/src/amd64.amd64/tmp/usr/include/openssl -DHAVE_LIBCRYPTO -DHAVE_OPENSSL_EVP_H -DHAVE_NET_PFVAR_H -DHAVE_NET_IF_PFLOG_H -g -MD  -MF.depend.print-tftp.o -MTprint-tftp.o -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 -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member  -Qunused-arguments    -c /usr/src/contrib/tcpdump/print-tftp.c -o print-tftp.o
--- all_subdir_usr.bin ---
--- all_subdir_usr.bin/cpio ---
--- test_option_xz.o ---
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin  -O2 -pipe -fno-common -DPLATFORM_CONFIG_H=\"/usr/src/lib/libarchive/config_freebsd.h\" -I/usr/src/lib/libarchive -I/usr/obj/usr/src/amd64.amd64/usr.bin/cpio/tests -I/usr/obj/usr/src/amd64.amd64/usr.bin/cpio/tests -I/usr/src/contrib/libarchive/cpio -I/usr/src/contrib/libarchive/cpio/test -I/usr/src/contrib/libarchive/libarchive -I/usr/src/contrib/libarchive/libarchive_fe -I/usr/src/contrib/libarchive/test_utils   -g -MD  -MF.depend.bsdcpio_test.test_option_xz.o -MTtest_option_xz.o -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 -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable  -Qunused-arguments  -c /usr/src/contrib/libarchive/cpio/test/test_option_xz.c -o test_option_xz.o
--- all_subdir_usr.bin/gh-bc ---
ld: error: args.o: Invalid record
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [gh-bc.full] Error code 1

make[4]: stopped in /usr/src/usr.bin/gh-bc
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/acpi ---
--- all_subdir_kerberos5 ---
--- ca.po ---
--- all_subdir_usr.bin ---
--- all_subdir_kerberos5 ---
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/tcpdump ---
--- all_subdir_usr.sbin/bhyve ---
--- all_subdir_secure ---
--- all_subdir_libexec ---
--- all_subdir_cddl ---
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/bluetooth ---
--- all_subdir_usr.sbin/ppp ---
--- all_subdir_usr.sbin/ntp ---
--- all_subdir_stand ---
--- all_subdir_stand/liblua32 ---
--- all_subdir_stand/efi ---
--- all_subdir_rescue ---
*** [dhclient_make] Error code 2

make[5]: stopped in /usr/obj/usr/src/amd64.amd64/rescue/rescue
--- sed_make ---
*** [sed_make] Error code 2

make[5]: stopped in /usr/obj/usr/src/amd64.amd64/rescue/rescue
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/sendmail ---
--- all_subdir_lib ---
--- all_subdir_lib/libc++ ---
--- all_subdir_rescue ---
--- less_make ---
*** [less_make] Error code 2

make[5]: stopped in /usr/obj/usr/src/amd64.amd64/rescue/rescue
--- bzip2_make ---
*** [bzip2_make] Error code 2

make[5]: stopped in /usr/obj/usr/src/amd64.amd64/rescue/rescue
--- all_subdir_lib ---
--- all_subdir_lib/msun ---
--- ctrig_test ---
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/bsnmpd ---
--- all_subdir_lib ---
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/unbound ---
1 warning generated.
--- all_subdir_rescue ---
--- gzip_make ---
*** [gzip_make] Error code 2

make[5]: stopped in /usr/obj/usr/src/amd64.amd64/rescue/rescue
5 errors

make[5]: stopped in /usr/obj/usr/src/amd64.amd64/rescue/rescue
*** [objs] Error code 2

make[4]: stopped in /usr/src/rescue/rescue
1 error

make[4]: stopped in /usr/src/rescue/rescue
--- all_subdir_usr.sbin ---
--- all_subdir_usr.sbin/wpa ---
--- all_subdir_tests ---
--- all_subdir_tests/sys/capsicum ---
Comment 2 Stefan Eßer freebsd_committer freebsd_triage 2021-01-23 23:04:30 UTC
I consider this a false positive:

Upgrading between major versions (12 -> 13) with explicit skipping of required bootstrap tools is just insane.

The error is reported due to building gh-bc with -flto and then attempting to link with an old linker that does not support the "object files" produced by the upgraded CLANG (upgraded as a bootstrap tool) with -flto.

I have tried to reproduce this issue on -CURRENT which has for a long time (at least 1 year) provided a LLD version that works in this case.

I'm going to close the PR for the reason that it is a user error to suppress the building of (part of the) bootstrap tools leading to incompatible compiler and linked when performing an upgrade to a new FreeBSD major version.

There is no practical fix for this issue: Overriding WITHOUT_LLD_BOOTSTRAP for major version upgrades would prevent this "user error", but going from 13 to 14 will not require a LLD bootstrap and thus such an override would be superfluous for major version upgrades after 12->13.
Comment 3 Michael Dexter 2021-01-23 23:07:12 UTC
Please note the results I have sent you building FreeBSD 13.0-ALPHA2 on 13.0-ALPHA2.
Comment 4 Stefan Eßer freebsd_committer freebsd_triage 2021-01-24 00:10:55 UTC
The ALPHA2 build failed due to an issue in Makefile.inc1 which AFAIK has been fixed, meanwhile.

It has nothing to do with the gh-bc sources, which failed during the 12->13 update with WITHOUT_LLD_BOOTSTRAP and I have explained why you should not use that option during a major version upgrade: the bootstrap feature exists just for the purpose of allowing a seemless upgrade from one major version to another and skipping part of the bootstrap during such an upgrade is just foot-shooting.

You should not use such non-default options if you do not understand the purpose of the default case that you override.
Comment 5 Michael Dexter 2021-01-24 00:15:00 UTC
Thank you!
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-01-24 17:26:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b23665f3169b7b0364416060855541b450204d6d

commit b23665f3169b7b0364416060855541b450204d6d
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-01-24 17:22:01 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-01-24 17:22:01 +0000

    Remove Binutils from src.conf(5) option descriptions

    All binutils remnants have been removed before FreeBSD 13.

    PR:             252842
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation

 tools/build/options/WITHOUT_LLD_BOOTSTRAP | 3 +--
 tools/build/options/WITHOUT_LLD_IS_LD     | 7 ++++++-
 tools/build/options/WITH_LLD_IS_LD        | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)
Comment 7 Michael Dexter 2021-01-24 22:08:03 UTC
Changing status to fixed. Thanks Ed!
Comment 8 commit-hook freebsd_committer freebsd_triage 2021-01-27 00:27:42 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=03d837b565a96b450d62b904ee108677f23122f8

commit 03d837b565a96b450d62b904ee108677f23122f8
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-01-24 17:22:01 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-01-27 00:26:16 +0000

    Remove Binutils from src.conf(5) option descriptions

    All binutils remnants have been removed before FreeBSD 13.

    PR:             252842
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit b23665f3169b7b0364416060855541b450204d6d)

 tools/build/options/WITHOUT_LLD_BOOTSTRAP | 3 +--
 tools/build/options/WITHOUT_LLD_IS_LD     | 7 ++++++-
 tools/build/options/WITH_LLD_IS_LD        | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)