Page MenuHomeFreeBSD

Add WITH_SYSTEM_LINKER, on by default, that avoids building lld when possible.
ClosedPublic

Authored by bdrewery on Jun 19 2018, 1:18 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 20 2024, 1:29 AM
Unknown Object (File)
Jan 9 2024, 7:31 AM
Unknown Object (File)
Jan 9 2024, 7:31 AM
Unknown Object (File)
Jan 9 2024, 7:31 AM
Unknown Object (File)
Jan 9 2024, 7:19 AM
Unknown Object (File)
Dec 20 2023, 2:53 AM
Unknown Object (File)
Dec 5 2023, 2:54 AM
Unknown Object (File)
Nov 6 2023, 9:51 PM
Subscribers

Details

Summary

This works similar to WITH_SYSTEM_COMPILER added in r300354. It only
supports lld via WITH_LLD_BOOTSTRAP.

When both SYSTEM_COMPILER and SYSTEM_LINKER logic passes then libclang
will not build in cross-tools. If either check fails though then
libclang is built.

The .info is reworked to notify when libclang will be built since if
either clang or lld needs to be rebuilt, but not the other, the
notification can lead to confusion on why "clang is building".

A new 'make test-system-linker' target is added to see the logic results.

-fuse-ld= is not used with this method so some combinations of compiler
and linker are expected to fail.

Makefile.inc1:

CROSS_BINUTILS_PREFIX support had to be moved higher up so that XLD
could be set and MK_LLD_BOOTSTRAP disabled before checking SYSTEM_LINKER
logic as done with SYSTEM_COMPILER.  This also required moving where
bsd.linker.mk was read since XLD needs to be set before parsing it.  This
creates a situation where src.opts.mk can not test LINKER_FEATURES or
add LLD_BOOTSTAP to BROKEN_OPTIONS.

Sponsored by: Dell EMC

Test Plan

Built WITHOUT_SYSTEM_LINKER=yes, and WITH, on my system which triggers
the skip logic. Built with various combinations of LD= and XLD= with
external toolchains. Did installworld for each. Verified in each case
when ld.lld was built/installed to WORLDTMP/usr/bin.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Also requires these fixes:

https://people.freebsd.org/~bdrewery/patches/x_vars_metadata.diff

and

commit d73c5b782be077e3012f29ef2fa7ea699854a743
Author: Bryan Drewery <bdrewery@FreeBSD.org>
Date:   Mon Jun 18 14:47:24 2018 -0700

    SYSTEM_COMPILER: Should use X_ vars for comparing wanted version.

    It is XCC used during the build of target binaries that replaces the
    bootstrap compiler.

    Also slightly tweak style.

    MFC after:      2 weeks
    Sponsored by:   Dell EMC

diff --git Makefile.inc1 Makefile.inc1
index d6ff032e4e78..a9085320805e 100644
--- Makefile.inc1
+++ Makefile.inc1
@@ -138,10 +138,10 @@ WANT_COMPILER_VERSION!= \
 .if ${MK_SYSTEM_COMPILER} == "yes" && \
     (${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \
     !make(showconfig) && !make(xdev*) && \
-    ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} && \
-    (${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
-    ${COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \
-    ${COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION}
+    ${X_COMPILER_TYPE} == ${WANT_COMPILER_TYPE} && \
+    (${X_COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
+    ${X_COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \
+    ${X_COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION}
 # Everything matches, disable the bootstrap compiler.
 MK_CLANG_BOOTSTRAP=    no
 MK_GCC_BOOTSTRAP=      no

Looks ok

Makefile.inc1
100–101 ↗(On Diff #44050)

Thanks for commenting this - definitely somewhat magic, so good to explain what's going on.

This comment was removed by bdrewery.

native-xtools didn't seem to matter much with this

This revision was not accepted when it landed; it landed in state Needs Review.Jun 20 2018, 4:10 PM
This revision was automatically updated to reflect the committed changes.