summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/InputFiles.cpp11
-rw-r--r--lld/ELF/InputFiles.h7
2 files changed, 10 insertions, 8 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index d9df6abbf23..406db8e57eb 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -132,13 +132,13 @@ StringRef ObjectFile<ELFT>::getShtGroupSignature(const Elf_Shdr &Sec) {
}
template <class ELFT>
-ArrayRef<typename ObjectFile<ELFT>::GroupEntryType>
+ArrayRef<typename ObjectFile<ELFT>::uint32_X>
ObjectFile<ELFT>::getShtGroupEntries(const Elf_Shdr &Sec) {
const ELFFile<ELFT> &Obj = this->ELFObj;
- ErrorOr<ArrayRef<GroupEntryType>> EntriesOrErr =
- Obj.template getSectionContentsAsArray<GroupEntryType>(&Sec);
+ ErrorOr<ArrayRef<uint32_X>> EntriesOrErr =
+ Obj.template getSectionContentsAsArray<uint32_X>(&Sec);
error(EntriesOrErr);
- ArrayRef<GroupEntryType> Entries = *EntriesOrErr;
+ ArrayRef<uint32_X> Entries = *EntriesOrErr;
if (Entries.empty() || Entries[0] != GRP_COMDAT)
error("Unsupported SHT_GROUP format");
return Entries.slice(1);
@@ -187,8 +187,7 @@ void ObjectFile<ELFT>::initializeSections(DenseSet<StringRef> &ComdatGroups) {
Sections[I] = &InputSection<ELFT>::Discarded;
if (ComdatGroups.insert(getShtGroupSignature(Sec)).second)
continue;
- for (GroupEntryType E : getShtGroupEntries(Sec)) {
- uint32_t SecIndex = E;
+ for (uint32_t SecIndex : getShtGroupEntries(Sec)) {
if (SecIndex >= Size)
error("Invalid section index in group");
Sections[SecIndex] = &InputSection<ELFT>::Discarded;
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index 9c54a9328f8..45d403c0125 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -91,10 +91,13 @@ template <class ELFT> class ObjectFile : public ELFFileBase<ELFT> {
typedef typename llvm::object::ELFFile<ELFT>::Elf_Word Elf_Word;
typedef typename llvm::object::ELFFile<ELFT>::uintX_t uintX_t;
+ // uint32 in ELFT's byte order
typedef llvm::support::detail::packed_endian_specific_integral<
- uint32_t, ELFT::TargetEndianness, 2> GroupEntryType;
+ uint32_t, ELFT::TargetEndianness, 2>
+ uint32_X;
+
StringRef getShtGroupSignature(const Elf_Shdr &Sec);
- ArrayRef<GroupEntryType> getShtGroupEntries(const Elf_Shdr &Sec);
+ ArrayRef<uint32_X> getShtGroupEntries(const Elf_Shdr &Sec);
public:
static bool classof(const InputFile *F) {
OpenPOWER on IntegriCloud