[PATCH] D121868: [cc1as] Add support for emitting the build version load command for -darwin-target-variant

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 21 04:45:42 PDT 2022


thakis added a comment.

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?



================
Comment at: clang/test/Misc/cc1as-darwin-target-variant-triple.s:2
+// Run cc1as using darwin-target-variant-triple
+// RUN: %clang -cc1as -triple x86_64-apple-macos10.9 -darwin-target-variant-triple x86_64-apple-ios13.1-macabi -filetype obj %s -o - \
+// RUN: | llvm-readobj --file-headers --macho-version-min - \
----------------
bc-lee wrote:
> MaskRay wrote:
> > `-filetype obj` on the `%clang -cc1as` line seems weird.
> Without this, I cannot create object file and validate it using `llvm-readobj`.
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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121868/new/

https://reviews.llvm.org/D121868



More information about the cfe-commits mailing list