[PATCH] D40147: [MIPS] Handle cross-mode (regular <-> microMIPS) jumps

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 20:51:01 PST 2018


ruiu added inline comments.


================
Comment at: ELF/InputSection.cpp:469-474
+// Set the less-significant bit for a microMIPS symbol. This bit is used
+// to mark a microMIPS symbol when there is no information about symbol
+// table entry related to this symbol. The MIPS::relocateOne function gets
+// a symbol's value only, but needs to adjust a jump/branch instruction
+// if the jump crosses CPU mode boundaries, i.e. execution passes from
+// regular to microMIPS code or vice versa.
----------------
Oh, thank you for writing this. I think I finally understand what it does correctly. So, you are using the least significant bit just to signal to the later pass that this is a MicroMIPS code, right? I was thinking that jump instructions jumping to MicroMIPS code must be marked with LSB 1, but it looks like you cleared the last bit, so the bit you set in this function is not used there. You set the least significant bit just to encode some information that is consumed in the later pass.

That makes me wonder if that's the best way of doing that. Apparently, the side effect of embedding some information to the address isn't negligible -- you needed to update a lot of places to set/unset the least significant bit. That doesn't seem like a good way to encode that kind of out-of-bound information. Address should be just an address.

What if you pass Symbol to relocateOne? Does this solve the issue? I'm not suggesting you do right now, but I'm wondering that's what you wanted to do.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D40147





More information about the llvm-commits mailing list