Skip to content

[clang] add llvm abi support #121123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {

// Check if the environment version is valid except wasm case.
llvm::Triple Triple = TC.getTriple();
if (!Triple.isWasm()) {
if (!Triple.isWasm() && Triple.getEnvironment() != llvm::Triple::LLVM) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong to me. Opting out of here makes me think there is something wrong with how the LLVM environment was implemented in the triple.

The Wasm case is special because (apparently) it is supported to pass arbitrary non-environment values in the triple (see discussion: #78655 (comment)).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I was running into was I'd get invalid version error. My assumption was that the LLVM ABI would not have a version because that would be the version of the entire LLVM stack. I didn't see any other ways when grepping the source that could disable the error.

StringRef TripleVersionName = Triple.getEnvironmentVersionString();
StringRef TripleObjectFormat =
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
Expand Down
10 changes: 10 additions & 0 deletions clang/test/Driver/invalid-version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@
// RUN: FileCheck --check-prefix=CHECK-WASM1 %s

// CHECK-WASM1: "-triple" "wasm32-unknown-wasi-pthread"

// RUN: %clang --target=aarch64-unknown-linux-llvm -c %s -### 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-AARCH64-LLVM %s

// CHECK-AARCH64-LLVM: "-triple" "aarch64-unknown-linux-llvm"

// RUN: %clang --target=x86_64-unknown-linux-llvm -c %s -### 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-X86-64-LLVM %s

// CHECK-X86-64-LLVM: "-triple" "x86_64-unknown-linux-llvm"
Loading