Skip to content
Merged
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
8 changes: 8 additions & 0 deletions clang/lib/Driver/ToolChains/BareMetal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ BareMetal::BareMetal(const Driver &D, const llvm::Triple &Triple,
}
}
}

if (Triple.getOS() == llvm::Triple::CheriotRTOS ||
Args.getLastArgValue(options::OPT_mcpu_EQ) == "cheriot" ||
Args.getLastArgValue(options::OPT_mabi_EQ) == "cheriot" ||
Args.getLastArgValue(options::OPT_mabi_EQ) == "cheriot-baremetal")
IsCheriot = true;
else
IsCheriot = false;
}

static void
Expand Down
9 changes: 9 additions & 0 deletions clang/lib/Driver/ToolChains/BareMetal.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ class LLVM_LIBRARY_VISIBILITY BareMetal : public Generic_ELF {
return UnwindTableLevel::None;
}

const char *getDefaultLinker() const override {
// XXX CHERIOT: Restore pre-clang21 behavior of defaulting to lld.
if (IsCheriot)
return "ld.lld";
return Generic_ELF::getDefaultLinker();
}

CXXStdlibType GetDefaultCXXStdlibType() const override;

RuntimeLibType GetDefaultRuntimeLibType() const override;
Expand Down Expand Up @@ -92,6 +99,8 @@ class LLVM_LIBRARY_VISIBILITY BareMetal : public Generic_ELF {
bool IsGCCInstallationValid;

SmallVector<std::string> MultilibMacroDefines;

bool IsCheriot;
};

} // namespace toolchains
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-lower-all.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s

; XFAIL: *
; Test to check if static LDS accesses in kernels without sanitize_address attribute are lowered if
; other kernels in module have sanitize_address attribute.
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -S -mtriple=amdgcn-amd-amdhsa | FileCheck %s
; XFAIL: *

; Test to check if LDS accesses are lowered correctly when a call is made to nested non-kernel.

Expand Down