llvm-project/clang/test/Misc/cc1as-darwin-target-variant-sdk-version.s
Daniel Rodríguez Troitiño d11b9fa3bf [clang][macho] Add support for -darwin-target-variant-sdk-version in cc1as
D121868 provided support for -darwin-target-variant-triple, but the
support for -darwin-target-variant-sdk-version was still missing for
cc1as. These changes build upon the previous and provides such support.

- Extracted the common code to handle -darwin-target-variant-triple and
  -darwin-target-variant-sdk-version in the Darwin toolchain to a method
  that can be used for both the cc1 and the cc1as job construction.
  cc1as does not support some of the parameters that were provided to
  cc1, so the same code cannot be used for both.
- Invoke that new common code when constructing a cc1as invocation.
- Parse the new -darwin-target-variant-sdk-version in the cc1as driver.
  Apply its value to the MCObjectFileInfo to generate the right values
  in the object files.
- Includes two new tests that check that cc1as uses the provided values
  in -darwin-target-variant-sdk and that the Clang driver creates the
  jobs with the correct arguments.

Differential Revision: https://reviews.llvm.org/D135729
2022-10-14 14:33:10 -07:00

35 lines
1.3 KiB
ArmAsm

// Run cc1as using darwin-target-variant-sdk-version
// REQUIRES: x86-registered-target
// RUN: %clang -cc1as -triple x86_64-apple-macos10.9 -darwin-target-variant-triple x86_64-apple-ios13.1-macabi -target-sdk-version=11.1 -darwin-target-variant-sdk-version=14.1 -filetype obj %s -o - \
// RUN: | llvm-readobj --file-headers --macho-version-min - \
// RUN: | FileCheck --check-prefix=CHECK %s
// CHECK: File: <stdin>
// CHECK-NEXT: Format: Mach-O 64-bit x86-64
// CHECK-NEXT: Arch: x86_64
// CHECK-NEXT: AddressSize: 64bit
// CHECK-NEXT: MachHeader {
// CHECK-NEXT: Magic: Magic64 (0xFEEDFACF)
// CHECK-NEXT: CpuType: X86-64 (0x1000007)
// CHECK-NEXT: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
// CHECK-NEXT: FileType: Relocatable (0x1)
// CHECK-NEXT: NumOfLoadCommands: 3
// CHECK-NEXT: SizeOfLoadCommands: 192
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Reserved: 0x0
// CHECK-NEXT: }
// CHECK-NEXT: MinVersion {
// CHECK-NEXT: Cmd: LC_VERSION_MIN_MACOSX
// CHECK-NEXT: Size: 16
// CHECK-NEXT: Version: 10.9
// CHECK-NEXT: SDK: n/a
// CHECK-NEXT: }
// CHECK-NEXT: MinVersion {
// CHECK-NEXT: Cmd: LC_BUILD_VERSION
// CHECK-NEXT: Size: 24
// CHECK-NEXT: Platform: macCatalyst
// CHECK-NEXT: Version: 13.1
// CHECK-NEXT: SDK: 14.1
// CHECK-NEXT: }