[llvm] [llvm] Linker flags for UEFI (PR #137878)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 29 14:12:32 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Prabhu Rajasekaran (Prabhuk)
<details>
<summary>Changes</summary>
Use appropriate linker flag format to match PE spec for UEFI.
---
Full diff: https://github.com/llvm/llvm-project/pull/137878.diff
1 Files Affected:
- (modified) llvm/lib/IR/Mangler.cpp (+3-3)
``````````diff
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp
index 3b9c00cf993f3..37f4820320cdd 100644
--- a/llvm/lib/IR/Mangler.cpp
+++ b/llvm/lib/IR/Mangler.cpp
@@ -215,7 +215,7 @@ void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
const Triple &TT, Mangler &Mangler) {
if (GV->hasDLLExportStorageClass() && !GV->isDeclaration()) {
- if (TT.isWindowsMSVCEnvironment())
+ if (TT.isWindowsMSVCEnvironment() || TT.isUEFI())
OS << " /EXPORT:";
else
OS << " -export:";
@@ -223,7 +223,7 @@ void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
bool NeedQuotes = GV->hasName() && !canBeUnquotedInDirective(GV->getName());
if (NeedQuotes)
OS << "\"";
- if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) {
+ if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment() || TT.isUEFI()) {
std::string Flag;
raw_string_ostream FlagOS(Flag);
Mangler.getNameWithPrefix(FlagOS, GV, false);
@@ -249,7 +249,7 @@ void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
OS << "\"";
if (!GV->getValueType()->isFunctionTy()) {
- if (TT.isWindowsMSVCEnvironment())
+ if (TT.isWindowsMSVCEnvironment() || TT.isUEFI())
OS << ",DATA";
else
OS << ",data";
``````````
</details>
https://github.com/llvm/llvm-project/pull/137878
More information about the llvm-commits
mailing list