From 9f9bab19e3f483752125e0ef5acb3c3cd36cdda8 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 2 Oct 2022 21:27:41 -0700 Subject: [PATCH] [ELF] Replace some config->ekind with file->ekind. NFC --- lld/ELF/Arch/PPC64.cpp | 2 +- lld/ELF/Driver.cpp | 4 ++-- lld/ELF/InputFiles.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp index f2ad394..c2834f0 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>(file)->getObj().getHeader().e_flags; return cast>(file)->getObj().getHeader().e_flags; } diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 47878a0..0271f31 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>(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>(file)->postParse(); break; diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 98f974f..4550bef 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 void ObjFile::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 { -- 2.7.4