[ELF] Replace some config->ekind with file->ekind. NFC
authorFangrui Song <i@maskray.me>
Mon, 3 Oct 2022 04:27:41 +0000 (21:27 -0700)
committerFangrui Song <i@maskray.me>
Mon, 3 Oct 2022 04:27:41 +0000 (21:27 -0700)
lld/ELF/Arch/PPC64.cpp
lld/ELF/Driver.cpp
lld/ELF/InputFiles.cpp

index f2ad394..c2834f0 100644 (file)
@@ -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;
 }
index 47878a0..0271f31 100644 (file)
@@ -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;
index 98f974f..4550bef 100644 (file)
@@ -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 {