This patch extends cc1as to export the build version load command with
LC_VERSION_MIN_MACOSX.
This is especially important for Mac Catalyst as Mac Catalyst uses
the MacOS's compiler rt built-ins.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Driver/ToolChains/Darwin.h | ||
---|---|---|
495 | Do you mean to modify the method in clang/include/clang/Driver/ToolChain.h? |
clang/test/Misc/cc1as-darwin-target-variant-triple.s | ||
---|---|---|
3 | Without this, I cannot create object file and validate it using llvm-readobj. |
Hm, is adding this flag the right thing to do? Looking at clang's -S output for (say) -target arm64-apple-macos -darwin-target-variant arm64-apple-ios13.1-macabi, it emits lines like:
.build_version macos, 12, 0 sdk_version 12, 3 .build_version macCatalyst, 14, 0 sdk_version 15, 4
That suggests that this should be part of the .s file instead of a flag to cc1as (?)
As you confirmed at https://crbug.com/1259122#c21, there is a problem with assembly files like floatundidf.S and this patch is intended to fix it. C/C++ files are fine.
Xcode's clang seems to support this:
% clang -target arm64-apple-macos -target-variant arm64-apple-ios13.1-macabi foo.s -c % otool -l foo.o | rg -A2 BUILD cmd LC_BUILD_VERSION cmdsize 24 platform 1 -- cmd LC_BUILD_VERSION cmdsize 24 platform 6
But normal clang doesn't:
% out/gn/bin/clang -target arm64-apple-macos -darwin-target-variant arm64-apple-ios13.1-macabi foo.s -isysroot $(xcrun -show-sdk-path) -c % otool -l foo.o | rg -A2 BUILD cmd LC_BUILD_VERSION cmdsize 24 platform 1
So based on that, I agree it's good to land this.
You have commit permissions, right?
clang/test/Misc/cc1as-darwin-target-variant-triple.s | ||
---|---|---|
3 | If you use emit-obj I think this test needs a REQUIRES: x86-registered-target. I'm not sure if piping binary data works on Windows – it might have stdout in text mode, which will do some byte replacements. |
Add REQUIRES: x86-registered-target on the test.
clang/test/Misc/cc1as-darwin-target-variant-triple.s | ||
---|---|---|
3 | A search for -o -.*\n.*RUN.*llvm-readobj in the LLVM codebase suggests that there are already several tests using that pattern. Does that really matter? |
Thanks!
clang/test/Misc/cc1as-darwin-target-variant-triple.s | ||
---|---|---|
3 | Well, if it works, it doesn't matter :) I'll land this and the bots can tell us if it works. |
llvm::None