Bug 237447 - make buildworld: linker failure on i386 platform
Summary: make buildworld: linker failure on i386 platform
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: i386 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2019-04-21 21:13 UTC by oz42
Modified: 2020-07-11 17:51 UTC (History)
1 user (show)

See Also:

src.conf (1.88 KB, text/plain)
2019-04-21 21:20 UTC, oz42
no flags Details
make.conf (484 bytes, text/plain)
2019-04-21 21:20 UTC, oz42
no flags Details
Makefile.inc.diff (67 bytes, patch)
2019-04-23 11:52 UTC, oz42
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description oz42 2019-04-21 21:13:36 UTC
===> stand/efi/loader_lua (all)
===> stand/efi/loader_simp (all)
===> stand/i386 (all)
===> stand/i386/mbr (all)
/usr/local/libexec/ccache/world/cc -O2 -pipe -I/usr/src/stand/i386/btx/lib -nostdinc -I/usr/obj/usr/src/i386.i386/stand/libsa -I/usr/src/stand/libsa -D_STANDALONE -I/usr/src/sys -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface -DLOADER_GELI_SUPPORT -I/usr/src/stand/libsa/geli -DLOADER_DISK_SUPPORT -ffreestanding -mno-mmx -mno-sse -mno-avx -mno-avx2 -msoft-float -march=i386 -I. -DNDEBUG -std=gnu99 -Wsystem-headers -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 -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Oz -Qunused-arguments  -e start -Ttext 0x600 -Wl,-N,-S,--oformat,binary -nostdlib -Wl,--no-rosegment -o mbr mbr.o  
/usr/bin/ld: unrecognized option '--no-rosegment'
/usr/bin/ld: use the --help option for usage information
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
Comment 1 oz42 2019-04-21 21:20:07 UTC
Created attachment 203873 [details]
Comment 2 oz42 2019-04-21 21:20:43 UTC
Created attachment 203874 [details]
Comment 3 oz42 2019-04-23 11:52:49 UTC
Created attachment 203919 [details]

simple patch for /usr/src/stand/i386/Makefile.inc
Comment 4 Ed Maste freebsd_committer 2019-04-23 15:30:27 UTC
(In reply to oz42 from comment #3)
The patch in comment #3 is invalid, and lld supports the --no-rosegment argument; your output

> /usr/bin/ld: unrecognized option '--no-rosegment'
> /usr/bin/ld: use the --help option for usage information

is from GNU ld, so I'm not sure what is happening here.  I suggest reporting on the freebsd-stable list and asking for suggestions.
Comment 5 oz42 2019-04-23 16:38:31 UTC
Sorry, what do you mean with list?
I only can tell that my patch worked for me. I have no idea why it is choosing GNU ld.
Comment 6 Ed Maste freebsd_committer 2019-04-23 16:51:15 UTC
(In reply to oz42 from comment #5)
I mean posting to the freebsd-stable mailing list is more likely to provide useful insight on build issues than a PR. https://lists.freebsd.org/mailman/listinfo/freebsd-stable

You can send the output of (from the top level source directory) there:
% ld --version

--no-rosegment is needed for (and supported by) lld, so removing it from the lld LDFLAGS is not correct.
Comment 7 oz42 2019-04-24 10:10:08 UTC
# ld --version
LLD 6.0.1 (FreeBSD 335540-1200005) (compatible with GNU linkers)

What I have found in the src.conf manpage:
             Set to use LLVM's LLD as the system linker, instead of GNU
             binutils ld.

             This is a default setting on amd64/amd64, arm/armv7 and

So this is not default on i386?
Comment 8 oz42 2019-04-25 07:24:53 UTC
This is from a machine that had built world successfully once (with my patch).

On a stock system, /usr/bin/ld ist GNU ld:

# ld --version
GNU ld 2.17.50 [FreeBSD] 2007-07-03
Comment 9 oz42 2019-06-17 08:47:31 UTC
The following does not change anything, I assume some Makefiles will have to be corrected.

setting LD to /usr/bin/ld.lld
adding LD=/usr/bin/ld.lld to make.conf
adding WITH_LLD_IS_LD=YES to src.conf


root@fb-12-0:/usr/src/stand/i386/mbr # cd /usr/bin/
root@fb-12-0:/usr/bin # rm ld
root@fb-12-0:/usr/bin # ln -s ld.lld ld