[lld] 72a005b - [ELF] De-template getAndFeatures. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 29 20:12:04 PST 2022
Author: Fangrui Song
Date: 2022-01-29T20:11:59-08:00
New Revision: 72a005bf19ec51b282a99aa38e96f8d4976eee72
URL: https://github.com/llvm/llvm-project/commit/72a005bf19ec51b282a99aa38e96f8d4976eee72
DIFF: https://github.com/llvm/llvm-project/commit/72a005bf19ec51b282a99aa38e96f8d4976eee72.diff
LOG: [ELF] De-template getAndFeatures. NFC
Added:
Modified:
lld/ELF/Driver.cpp
lld/ELF/InputFiles.h
Removed:
################################################################################
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index e79788cc2ea8..46fc67a609b1 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -2179,14 +2179,14 @@ static void checkAndReportMissingFeature(StringRef config, uint32_t features,
//
// This is also the case with AARCH64's BTI and PAC which use the similar
// GNU_PROPERTY_AARCH64_FEATURE_1_AND mechanism.
-template <class ELFT> static uint32_t getAndFeatures() {
+static uint32_t getAndFeatures() {
if (config->emachine != EM_386 && config->emachine != EM_X86_64 &&
config->emachine != EM_AARCH64)
return 0;
uint32_t ret = -1;
- for (InputFile *f : objectFiles) {
- uint32_t features = cast<ObjFile<ELFT>>(f)->andFeatures;
+ for (ELFFileBase *f : objectFiles) {
+ uint32_t features = f->andFeatures;
checkAndReportMissingFeature(
config->zBtiReport, features, GNU_PROPERTY_AARCH64_FEATURE_1_BTI,
@@ -2472,7 +2472,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
// Read .note.gnu.property sections from input object files which
// contain a hint to tweak linker's and loader's behaviors.
- config->andFeatures = getAndFeatures<ELFT>();
+ config->andFeatures = getAndFeatures();
// The Target instance handles target-specific stuff, such as applying
// relocations or writing a PLT section. It also contains target-dependent
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index afe5ca87021c..2bac30f54081 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -211,6 +211,7 @@ class ELFFileBase : public InputFile {
uint32_t firstGlobal = 0;
public:
+ uint32_t andFeatures = 0;
bool hasCommonSyms = false;
};
@@ -267,8 +268,6 @@ template <class ELFT> class ObjFile : public ELFFileBase {
// R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations.
uint32_t mipsGp0 = 0;
- uint32_t andFeatures = 0;
-
// True if the file defines functions compiled with
// -fsplit-stack. Usually false.
bool splitStack = false;
More information about the llvm-commits
mailing list