[Object,ELFType] Rename TargetEndianness to Endianness (#86604)
`TargetEndianness` is long and unwieldy. "Target" in the name is confusing. Rename it to "Endianness".
I cannot find noticeable out-of-tree users of `TargetEndianness`, but
keep `TargetEndianness` to make this patch safer. `TargetEndianness`
will be removed by a subsequent change.
GitOrigin-RevId: 276335389133d6acf5f9d7d2f8ce09f9c610cb9c
diff --git a/ELF/Arch/Mips.cpp b/ELF/Arch/Mips.cpp
index b02ad10..e36e9d5 100644
--- a/ELF/Arch/Mips.cpp
+++ b/ELF/Arch/Mips.cpp
@@ -380,7 +380,7 @@
template <class ELFT>
int64_t MIPS<ELFT>::getImplicitAddend(const uint8_t *buf, RelType type) const {
- const endianness e = ELFT::TargetEndianness;
+ const endianness e = ELFT::Endianness;
switch (type) {
case R_MIPS_32:
case R_MIPS_REL32:
@@ -521,7 +521,7 @@
// to a microMIPS target and vice versa. In that cases jump
// instructions need to be replaced by their "cross-mode"
// equivalents.
- const endianness e = ELFT::TargetEndianness;
+ const endianness e = ELFT::Endianness;
bool isMicroTgt = val & 0x1;
bool isCrossJump = (isMicroTgt && isBranchReloc(type)) ||
(!isMicroTgt && isMicroBranchReloc(type));
@@ -567,7 +567,7 @@
template <class ELFT>
void MIPS<ELFT>::relocate(uint8_t *loc, const Relocation &rel,
uint64_t val) const {
- const endianness e = ELFT::TargetEndianness;
+ const endianness e = ELFT::Endianness;
RelType type = rel.type;
if (ELFT::Is64Bits || config->mipsN32Abi)
diff --git a/ELF/DWARF.h b/ELF/DWARF.h
index 1b9a3e3..d568952 100644
--- a/ELF/DWARF.h
+++ b/ELF/DWARF.h
@@ -74,7 +74,7 @@
StringRef getLineStrSection() const override { return lineStrSection; }
bool isLittleEndian() const override {
- return ELFT::TargetEndianness == llvm::endianness::little;
+ return ELFT::Endianness == llvm::endianness::little;
}
std::optional<llvm::RelocAddrEntry> find(const llvm::DWARFSection &sec,
diff --git a/ELF/InputFiles.cpp b/ELF/InputFiles.cpp
index 42761b6..725c6f1 100644
--- a/ELF/InputFiles.cpp
+++ b/ELF/InputFiles.cpp
@@ -971,8 +971,8 @@
const uint8_t *place = desc.data();
if (desc.size() < 8)
reportFatal(place, "program property is too short");
- uint32_t type = read32<ELFT::TargetEndianness>(desc.data());
- uint32_t size = read32<ELFT::TargetEndianness>(desc.data() + 4);
+ uint32_t type = read32<ELFT::Endianness>(desc.data());
+ uint32_t size = read32<ELFT::Endianness>(desc.data() + 4);
desc = desc.slice(8);
if (desc.size() < size)
reportFatal(place, "program property is too short");
@@ -983,7 +983,7 @@
// accumulate the bits set.
if (size < 4)
reportFatal(place, "FEATURE_1_AND entry is too short");
- featuresSet |= read32<ELFT::TargetEndianness>(desc.data());
+ featuresSet |= read32<ELFT::Endianness>(desc.data());
}
// Padding is present in the note descriptor, if necessary.
diff --git a/ELF/InputSection.cpp b/ELF/InputSection.cpp
index c34bf08..4f88313 100644
--- a/ELF/InputSection.cpp
+++ b/ELF/InputSection.cpp
@@ -1258,10 +1258,10 @@
msg = "CIE/FDE too small";
break;
}
- uint64_t size = endian::read32<ELFT::TargetEndianness>(d.data());
+ uint64_t size = endian::read32<ELFT::Endianness>(d.data());
if (size == 0) // ZERO terminator
break;
- uint32_t id = endian::read32<ELFT::TargetEndianness>(d.data() + 4);
+ uint32_t id = endian::read32<ELFT::Endianness>(d.data() + 4);
size += 4;
if (LLVM_UNLIKELY(size > d.size())) {
// If it is 0xFFFFFFFF, the next 8 bytes contain the size instead,
diff --git a/ELF/SyntheticSections.cpp b/ELF/SyntheticSections.cpp
index 650bd6c..8708bfe 100644
--- a/ELF/SyntheticSections.cpp
+++ b/ELF/SyntheticSections.cpp
@@ -415,7 +415,7 @@
for (EhSectionPiece &cie : sec->cies)
offsetToCie[cie.inputOff] = addCie<ELFT>(cie, rels);
for (EhSectionPiece &fde : sec->fdes) {
- uint32_t id = endian::read32<ELFT::TargetEndianness>(fde.data().data() + 4);
+ uint32_t id = endian::read32<ELFT::Endianness>(fde.data().data() + 4);
CieRecord *rec = offsetToCie[fde.inputOff + 4 - id];
if (!rec)
fatal(toString(sec) + ": invalid CIE reference");
@@ -448,7 +448,7 @@
if (hasLSDA(cie))
ciesWithLSDA.insert(cie.inputOff);
for (EhSectionPiece &fde : sec.fdes) {
- uint32_t id = endian::read32<ELFT::TargetEndianness>(fde.data().data() + 4);
+ uint32_t id = endian::read32<ELFT::Endianness>(fde.data().data() + 4);
if (!ciesWithLSDA.contains(fde.inputOff + 4 - id))
continue;