[PATCH] D54154: [ELF][MIPS] Use MIPS R6 `sigrie` as a trap instruction

James Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 14:30:54 PST 2018


jrtc27 requested changes to this revision.
jrtc27 added inline comments.
This revision now requires changes to proceed.


================
Comment at: ELF/Arch/Mips.cpp:61
+  // Set `sigrie 1` as a trap instruction.
+  if (Config->IsLE == sys::IsLittleEndianHost)
+    write32le(&TrapInstr, 0x04170001);
----------------
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)`?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D54154





More information about the llvm-commits mailing list