-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm] Linker flags for UEFI #137878
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
[llvm] Linker flags for UEFI #137878
Conversation
Use appropriate linker flag format to match PE spec for UEFI.
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-llvm-ir Author: Prabhu Rajasekaran (Prabhuk) ChangesUse appropriate linker flag format to match PE spec for UEFI. Full diff: https://github.com/llvm/llvm-project/pull/137878.diff 1 Files Affected:
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";
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Is it possible to write (or modify existing) test? |
@petrhosek thanks for the quick review. I am beginning to think that this change is not necessary for UEFI context since dll export and import are not supported in the UEFI environment. I'll mark this patch as a draft for now and will abandon it if you agree that this is not needed as well. |
Updated existing tests. Not completely sure if this change is required for UEFI support though. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/138/builds/12508 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/12275 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/174/builds/17043 Here is the relevant piece of the build log for the reference
|
Use appropriate linker flag format to match PE spec for UEFI.
Use appropriate linker flag format to match PE spec for UEFI.
Use appropriate linker flag format to match PE spec for UEFI.
Use appropriate linker flag format to match PE spec for UEFI.
Use appropriate linker flag format to match PE spec for UEFI.
Use appropriate linker flag format to match PE spec for UEFI.