[ELF] Use endianness-aware read32 to avoid dispatch. NFC
authorFangrui Song <i@maskray.me>
Wed, 16 Mar 2022 06:51:11 +0000 (23:51 -0700)
committerFangrui Song <i@maskray.me>
Wed, 16 Mar 2022 06:51:11 +0000 (23:51 -0700)
lld/ELF/SyntheticSections.cpp

index aa6ed9265ec6b8eae0a45098aba88debba23299a..dc2cd83b10dfb575e36a2e5e2292c9f357130a30 100644 (file)
@@ -409,7 +409,8 @@ void EhFrameSection::addRecords(EhInputSection *sec, ArrayRef<RelTy> rels) {
       return;
 
     size_t offset = piece.inputOff;
-    uint32_t id = read32(piece.data().data() + 4);
+    const uint32_t id =
+        endian::read32<ELFT::TargetEndianness>(piece.data().data() + 4);
     if (id == 0) {
       offsetToCie[offset] = addCie<ELFT>(piece, rels);
       continue;