[lld] ca6b846 - [ELF] Avoid unneeded config->isLE and config->wordsize. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 12:20:34 PDT 2024
Author: Fangrui Song
Date: 2024-04-10T12:20:28-07:00
New Revision: ca6b8469c16edfe1713e9050dca3cd68bd585410
URL: https://github.com/llvm/llvm-project/commit/ca6b8469c16edfe1713e9050dca3cd68bd585410
DIFF: https://github.com/llvm/llvm-project/commit/ca6b8469c16edfe1713e9050dca3cd68bd585410.diff
LOG: [ELF] Avoid unneeded config->isLE and config->wordsize. NFC
Added:
Modified:
lld/ELF/SyntheticSections.cpp
Removed:
################################################################################
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 550659464a440a..d8791e83dc9e51 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -2769,7 +2769,8 @@ readPubNamesAndTypes(const LLDDwarfObj<ELFT> &obj,
SmallVector<GdbIndexSection::NameAttrEntry, 0> ret;
for (const LLDDWARFSection *pub : {&pubNames, &pubTypes}) {
- DWARFDataExtractor data(obj, *pub, config->isLE, config->wordsize);
+ DWARFDataExtractor data(obj, *pub, ELFT::Endianness == endianness::little,
+ ELFT::Is64Bits ? 8 : 4);
DWARFDebugPubTable table;
table.extract(data, /*GnuStyle=*/true, [&](Error e) {
warn(toString(pub->sec) + ": " + toString(std::move(e)));
@@ -3744,8 +3745,9 @@ template <typename ELFT> void elf::writeEhdr(uint8_t *buf, Partition &part) {
memcpy(buf, "\177ELF", 4);
auto *eHdr = reinterpret_cast<typename ELFT::Ehdr *>(buf);
- eHdr->e_ident[EI_CLASS] = config->is64 ? ELFCLASS64 : ELFCLASS32;
- eHdr->e_ident[EI_DATA] = config->isLE ? ELFDATA2LSB : ELFDATA2MSB;
+ eHdr->e_ident[EI_CLASS] = ELFT::Is64Bits ? ELFCLASS64 : ELFCLASS32;
+ eHdr->e_ident[EI_DATA] =
+ ELFT::Endianness == endianness::little ? ELFDATA2LSB : ELFDATA2MSB;
eHdr->e_ident[EI_VERSION] = EV_CURRENT;
eHdr->e_ident[EI_OSABI] = config->osabi;
eHdr->e_ident[EI_ABIVERSION] = getAbiVersion();
More information about the llvm-commits
mailing list