Page MenuHomeFreeBSD

bsd.compiler.mk: detect Apple Clang for cross-builds
ClosedPublic

Authored by arichardson on Apr 9 2021, 4:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 4:13 PM
Unknown Object (File)
Fri, Apr 12, 9:35 AM
Unknown Object (File)
Mon, Apr 8, 5:20 PM
Unknown Object (File)
Fri, Mar 29, 2:49 AM
Unknown Object (File)
Mar 18 2024, 5:03 AM
Unknown Object (File)
Mar 13 2024, 7:21 PM
Unknown Object (File)
Mar 7 2024, 6:26 PM
Unknown Object (File)
Feb 5 2024, 4:35 AM
Subscribers

Details

Summary

Apple clang uses a different versioning scheme, so if we enable or
disable certain warnings for Clang 11+, those might not be supported
in Apple Clang 11+. This adds 'apple-clang' to COMPILER_FEATURES, so that
bootstrap tools Makefiles can avoid warnings on macOS.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

share/mk/bsd.compiler.mk
187

Probably better off with an ${X_}CLANG_TYPE? Otherwise you'll have to use :M*clang in a load of places.

217โ€“218

๐Ÿ‘€

jrtc27 retitled this revision from [UPSTREAM] bsd.compiler.mk: detect Apple Clang for cross-builds to bsd.compiler.mk: detect Apple Clang for cross-builds.Apr 9 2021, 5:01 PM
share/mk/bsd.compiler.mk
187

That could also work. I just noticed the warning that is causing issues is a CheriBSD-local diff, so we might not need this after all.

217โ€“218

oops had some debugging .info statements here.

share/mk/bsd.compiler.mk
186

IMO we should explicitly mention Apple's versioning scheme to explain why there's a special apple-clang. Is there some site that cross-references Apple and upstream Clang revisions?

share/mk/bsd.compiler.mk
186

Wikipedia has a table at https://en.wikipedia.org/wiki/Xcode#Toolchain_versions which ultimately just gets the information from Apple's Swift LLVM fork via e.g. https://github.com/apple/llvm-project/blob/swift-5.3.2-RELEASE/llvm/CMakeLists.txt.

Use COMPILER_FEATURES instead

The new version uses COMPILER_FEATURES instead.

bmake[2]: "/Users/alex/cheri/cheribsd/share/mk/bsd.compiler.mk" line 253: COMPILER_FEATURES=apple-clang c++11 c++14 c++17 retpoline init-all
bmake[2]: "/Users/alex/cheri/cheribsd/share/mk/bsd.compiler.mk" line 254: COMPILER_TYPE=clang
bmake[2]: "/Users/alex/cheri/cheribsd/share/mk/bsd.compiler.mk" line 255: COMPILER_VERSION=120000
bmake[2]: "/Users/alex/cheri/cheribsd/share/mk/bsd.compiler.mk" line 256: X_COMPILER_FEATURES=c++11 c++14 c++17 retpoline init-all
bmake[2]: "/Users/alex/cheri/cheribsd/share/mk/bsd.compiler.mk" line 257: X_COMPILER_TYPE=clang
bmake[2]: "/Users/alex/cheri/cheribsd/share/mk/bsd.compiler.mk" line 258: X_COMPILER_VERSION=130000

This looks good as is, though I'd be inclined to use += in the place I tagged to future proof.

share/mk/bsd.compiler.mk
213

Do you want to use = or += here?

This revision is now accepted and ready to land.Apr 15 2021, 2:53 PM
share/mk/bsd.compiler.mk
213

Good point, might as well use += everywhere. Will make that change before committing

share/mk/bsd.compiler.mk
213

Looking at it again, it's guarded by !defined(${X_}COMPILER_FEATURES) so assigning might make more sense than using +=

share/mk/bsd.compiler.mk
213

Sounds good to me then. I hadn't noticed that would make = fine.