[PATCH] D54154: [ELF][MIPS] Use MIPS R6 `sigrie` as a trap instruction
Simon Atanasyan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 6 14:46:17 PST 2018
atanasyan added inline comments.
================
Comment at: ELF/Arch/Mips.cpp:61
+ // Set `sigrie 1` as a trap instruction.
+ if (Config->IsLE == sys::IsLittleEndianHost)
+ write32le(&TrapInstr, 0x04170001);
----------------
jrtc27 wrote:
> Maybe I'm being stupid, but won't this do the wrong thing on a big-endian host? If, say, we're building for mips64 on mips64, `Config->IsLE` and `sys::IsLittleEndianHost` will both be false, so we'll take the `write32le` path, which will write `0x04170001` (represented in-memory natively as big-endian) as a little-endian value, i.e. incorrectly byte-swapping? It seems to me like this should be just a check for `if (Config->IsLE)`?
Thanks a lot. The only remaining question - how could I write this nice piece of code? :)
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D54154
More information about the llvm-commits
mailing list