Skip to content

Commit ca6b846

Browse files
committed
[ELF] Avoid unneeded config->isLE and config->wordsize. NFC
1 parent fad1470 commit ca6b846

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lld/ELF/SyntheticSections.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,7 +2769,8 @@ readPubNamesAndTypes(const LLDDwarfObj<ELFT> &obj,
27692769

27702770
SmallVector<GdbIndexSection::NameAttrEntry, 0> ret;
27712771
for (const LLDDWARFSection *pub : {&pubNames, &pubTypes}) {
2772-
DWARFDataExtractor data(obj, *pub, config->isLE, config->wordsize);
2772+
DWARFDataExtractor data(obj, *pub, ELFT::Endianness == endianness::little,
2773+
ELFT::Is64Bits ? 8 : 4);
27732774
DWARFDebugPubTable table;
27742775
table.extract(data, /*GnuStyle=*/true, [&](Error e) {
27752776
warn(toString(pub->sec) + ": " + toString(std::move(e)));
@@ -3744,8 +3745,9 @@ template <typename ELFT> void elf::writeEhdr(uint8_t *buf, Partition &part) {
37443745
memcpy(buf, "\177ELF", 4);
37453746

37463747
auto *eHdr = reinterpret_cast<typename ELFT::Ehdr *>(buf);
3747-
eHdr->e_ident[EI_CLASS] = config->is64 ? ELFCLASS64 : ELFCLASS32;
3748-
eHdr->e_ident[EI_DATA] = config->isLE ? ELFDATA2LSB : ELFDATA2MSB;
3748+
eHdr->e_ident[EI_CLASS] = ELFT::Is64Bits ? ELFCLASS64 : ELFCLASS32;
3749+
eHdr->e_ident[EI_DATA] =
3750+
ELFT::Endianness == endianness::little ? ELFDATA2LSB : ELFDATA2MSB;
37493751
eHdr->e_ident[EI_VERSION] = EV_CURRENT;
37503752
eHdr->e_ident[EI_OSABI] = config->osabi;
37513753
eHdr->e_ident[EI_ABIVERSION] = getAbiVersion();

0 commit comments

Comments
 (0)