[PATCH] D44227: [ELF] Convert {read, write}*be to endianness-aware read/write.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 7 14:40:39 PST 2018
ruiu added inline comments.
================
Comment at: ELF/Arch/PPC64.cpp:116
- write32be(Buf, 0xf8410028); // std %r2, 40(%r1)
- write32be(Buf + 4, 0x3d620000 | applyPPCHa(Off)); // addis %r11, %r2, X at ha
- write32be(Buf + 8, 0xe98b0000 | applyPPCLo(Off)); // ld %r12, X at l(%r11)
- write32be(Buf + 12, 0xe96c0000); // ld %r11,0(%r12)
- write32be(Buf + 16, 0x7d6903a6); // mtctr %r11
- write32be(Buf + 20, 0xe84c0008); // ld %r2,8(%r12)
- write32be(Buf + 24, 0xe96c0010); // ld %r11,16(%r12)
- write32be(Buf + 28, 0x4e800420); // bctr
+ write32(Buf, 0xf8410028, E); // std %r2, 40(%r1)
+ write32(Buf + 4, 0x3d620000 | applyPPCHa(Off), E); // addis %r11, %r2, X at ha
----------------
I think it is better to define `write32` like this
void write32(uint8_t *Loc, uint32_t Val) { endian::write32(Loc, Val, Config->Endianness); }
and use it, instead of passing E for each function call.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D44227
More information about the llvm-commits
mailing list