[lld] 9f9bab1 - [ELF] Replace some config->ekind with file->ekind. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 2 21:27:49 PDT 2022


Author: Fangrui Song
Date: 2022-10-02T21:27:41-07:00
New Revision: 9f9bab19e3f483752125e0ef5acb3c3cd36cdda8

URL: https://github.com/llvm/llvm-project/commit/9f9bab19e3f483752125e0ef5acb3c3cd36cdda8
DIFF: https://github.com/llvm/llvm-project/commit/9f9bab19e3f483752125e0ef5acb3c3cd36cdda8.diff

LOG: [ELF] Replace some config->ekind with file->ekind. NFC

Added: 
    

Modified: 
    lld/ELF/Arch/PPC64.cpp
    lld/ELF/Driver.cpp
    lld/ELF/InputFiles.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp
index f2ad3942d43d6..c2834f0bdee58 100644
--- a/lld/ELF/Arch/PPC64.cpp
+++ b/lld/ELF/Arch/PPC64.cpp
@@ -614,7 +614,7 @@ int PPC64::getTlsGdRelaxSkip(RelType type) const {
 }
 
 static uint32_t getEFlags(InputFile *file) {
-  if (config->ekind == ELF64BEKind)
+  if (file->ekind == ELF64BEKind)
     return cast<ObjFile<ELF64BE>>(file)->getObj().getHeader().e_flags;
   return cast<ObjFile<ELF64LE>>(file)->getObj().getHeader().e_flags;
 }

diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 47878a0e29eca..0271f31729c36 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -2424,7 +2424,7 @@ static uint32_t getAndFeatures() {
 }
 
 static void initSectionsAndLocalSyms(ELFFileBase *file, bool ignoreComdats) {
-  switch (config->ekind) {
+  switch (file->ekind) {
   case ELF32LEKind:
     cast<ObjFile<ELF32LE>>(file)->initSectionsAndLocalSyms(ignoreComdats);
     break;
@@ -2443,7 +2443,7 @@ static void initSectionsAndLocalSyms(ELFFileBase *file, bool ignoreComdats) {
 }
 
 static void postParseObjectFile(ELFFileBase *file) {
-  switch (config->ekind) {
+  switch (file->ekind) {
   case ELF32LEKind:
     cast<ObjFile<ELF32LE>>(file)->postParse();
     break;

diff  --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 98f974f6520f9..4550beff5243b 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -324,7 +324,7 @@ std::string InputFile::getSrcMsg(const Symbol &sym, InputSectionBase &sec,
                                  uint64_t offset) {
   if (kind() != ObjKind)
     return "";
-  switch (config->ekind) {
+  switch (ekind) {
   default:
     llvm_unreachable("Invalid kind");
   case ELF32LEKind:
@@ -561,9 +561,9 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
           check(this->getObj().getSectionContents(sec));
       StringRef name = check(obj.getSectionName(sec, shstrtab));
       this->sections[i] = &InputSection::discarded;
-      if (Error e = attributes.parse(contents, config->ekind == ELF32LEKind
-                                                   ? support::little
-                                                   : support::big)) {
+      if (Error e =
+              attributes.parse(contents, ekind == ELF32LEKind ? support::little
+                                                              : support::big)) {
         InputSection isec(*this, sec, name);
         warn(toString(&isec) + ": " + llvm::toString(std::move(e)));
       } else {


        


More information about the llvm-commits mailing list