-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LLD][ELF] Import ObjFile::importCmseSymbols
at call site
#68025
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
Conversation
Before this patch, with MSVC I was seeing the following warnings: ``` [304/334] Building CXX object tools\lld\ELF\CMakeFiles\lldELF.dir\InputFiles.cpp.obj C:\git\llvm-project\lld\ELF\InputFiles.h(327): warning C4661: 'void lld::elf::ObjFile<llvm::object::ELF32LE>::importCmseSymbols(void)': no suitable definition provided for explicit template instantiation request C:\git\llvm-project\lld\ELF\InputFiles.h(291): note: see declaration of 'lld::elf::ObjFile<llvm::object::ELF32LE>::importCmseSymbols' C:\git\llvm-project\lld\ELF\InputFiles.h(327): warning C4661: 'void lld::elf::ObjFile<llvm::object::ELF32LE>::redirectCmseSymbols(void)': no suitable definition provided for explicit template instantiation request C:\git\llvm-project\lld\ELF\InputFiles.h(292): note: see declaration of 'lld::elf::ObjFile<llvm::object::ELF32LE>::redirectCmseSymbols' ``` This patch removes `redirectCmseSymbols` which is not defined. And it imports `importCmseSymbols` in InputFiles.cpp, because it is already explicitly instantiated in ARM.cpp.
@llvm/pr-subscribers-lld @llvm/pr-subscribers-lld-elf ChangesBefore this patch, with MSVC I was seeing the following warnings:
This patch removes Full diff: https://github.com/llvm/llvm-project/pull/68025.diff 2 Files Affected:
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index fa0731854689b94..bb86269d49499cd 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -40,6 +40,13 @@ using namespace llvm::support::endian;
using namespace lld;
using namespace lld::elf;
+// This function is explicity instantiated in ARM.cpp, don't do it here to avoid
+// warnings with MSVC.
+extern template void ObjFile<ELF32LE>::importCmseSymbols();
+extern template void ObjFile<ELF32BE>::importCmseSymbols();
+extern template void ObjFile<ELF64LE>::importCmseSymbols();
+extern template void ObjFile<ELF64BE>::importCmseSymbols();
+
bool InputFile::isInGroup;
uint32_t InputFile::nextGroupId;
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index cc658bdc231988e..41c2ba4e307b36b 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -289,7 +289,6 @@ template <class ELFT> class ObjFile : public ELFFileBase {
void initSectionsAndLocalSyms(bool ignoreComdats);
void postParse();
void importCmseSymbols();
- void redirectCmseSymbols();
private:
void initializeSections(bool ignoreComdats,
|
@@ -40,6 +40,13 @@ using namespace llvm::support::endian; | |||
using namespace lld; | |||
using namespace lld::elf; | |||
|
|||
// This function is explicity instantiated in ARM.cpp, don't do it here to avoid | |||
// warnings with MSVC. | |||
extern template void ObjFile<ELF32LE>::importCmseSymbols(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be placed directly before doParseArmCMSEImportLib
for clarity.
ObjFile::importCmseSymbols
at point of usage
ObjFile::importCmseSymbols
at point of usageObjFile::importCmseSymbols
at call site
Before this patch, with MSVC I was seeing the following warnings:
This patch removes
redirectCmseSymbols
which is not defined. And it importsimportCmseSymbols
in InputFiles.cpp, because it is already explicitly instantiated in ARM.cpp.