[llvm] [Object][COFF][NFC] Don't use inline function for COFFImportFile::printSymbolName. (PR #87195)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 31 09:26:49 PDT 2024
https://github.com/cjacek created https://github.com/llvm/llvm-project/pull/87195
Fixes BUILD_SHARED_LIBS builds after #87191 made helpers non-inline.
>From 4f9c1acd15ccd7193817e52c73ff9ad6876b297c Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek at codeweavers.com>
Date: Sun, 31 Mar 2024 18:21:39 +0200
Subject: [PATCH] [Object][COFF][NFC] Don't use inline function for
COFFImportFile::printSymbolName.
Fixes BUILD_SHARED_LIBS builds after #87191 made helpers non-inline.
---
llvm/include/llvm/Object/COFFImportFile.h | 21 +--------------------
llvm/lib/Object/COFFImportFile.cpp | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/llvm/include/llvm/Object/COFFImportFile.h b/llvm/include/llvm/Object/COFFImportFile.h
index 035bc17126da34..2c06f529ecdfc5 100644
--- a/llvm/include/llvm/Object/COFFImportFile.h
+++ b/llvm/include/llvm/Object/COFFImportFile.h
@@ -45,26 +45,7 @@ class COFFImportFile : public SymbolicFile {
void moveSymbolNext(DataRefImpl &Symb) const override { ++Symb.p; }
- Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override {
- switch (Symb.p) {
- case ImpSymbol:
- OS << "__imp_";
- break;
- case ECAuxSymbol:
- OS << "__imp_aux_";
- break;
- }
- const char *Name = Data.getBufferStart() + sizeof(coff_import_header);
- if (Symb.p != ECThunkSymbol && COFF::isArm64EC(getMachine())) {
- if (std::optional<std::string> DemangledName =
- getArm64ECDemangledFunctionName(Name)) {
- OS << StringRef(*DemangledName);
- return Error::success();
- }
- }
- OS << StringRef(Name);
- return Error::success();
- }
+ Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override;
Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override {
return SymbolRef::SF_Global;
diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp
index 477c5bf98249f7..48c3ea0ed8f4e4 100644
--- a/llvm/lib/Object/COFFImportFile.cpp
+++ b/llvm/lib/Object/COFFImportFile.cpp
@@ -84,6 +84,27 @@ StringRef COFFImportFile::getExportName() const {
return name;
}
+Error COFFImportFile::printSymbolName(raw_ostream &OS, DataRefImpl Symb) const {
+ switch (Symb.p) {
+ case ImpSymbol:
+ OS << "__imp_";
+ break;
+ case ECAuxSymbol:
+ OS << "__imp_aux_";
+ break;
+ }
+ const char *Name = Data.getBufferStart() + sizeof(coff_import_header);
+ if (Symb.p != ECThunkSymbol && COFF::isArm64EC(getMachine())) {
+ if (std::optional<std::string> DemangledName =
+ getArm64ECDemangledFunctionName(Name)) {
+ OS << StringRef(*DemangledName);
+ return Error::success();
+ }
+ }
+ OS << StringRef(Name);
+ return Error::success();
+}
+
static uint16_t getImgRelRelocation(MachineTypes Machine) {
switch (Machine) {
default:
More information about the llvm-commits
mailing list