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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 17:35:05 PST 2018


ruiu added inline comments.


================
Comment at: ELF/Arch/Mips.cpp:491
+template <class ELFT>
+static void fixupCrossModeJump(uint8_t *Loc, RelType Type, uint64_t *Val) {
+  // Here we need to detect jump/branch from regular MIPS code
----------------
I'd return a new Val instead of mutating a given value through a pointer.


================
Comment at: ELF/InputSection.cpp:686-689
+    // Set the less-significant bit for microMIPS symbols
+    // to keep this information for a reader of this value.
+    if (Config->EMachine == EM_MIPS && (Sym.StOther & STO_MIPS_MICROMIPS))
+      Val |= 1;
----------------
Is this really unavaoidable to add this MIPS-specific code to this generic function?


================
Comment at: ELF/InputSection.cpp:723
 
+    if (Config->EMachine == EM_MIPS) {
+      // We have to set the less-significant bit for microMIPS symbols
----------------
Ditto -- adding more code to this function makes this function hard to understand.


================
Comment at: ELF/SyntheticSections.cpp:1025
+  Entries.push_back({Tag, [=] {
+                       if (Config->EMachine == EM_MIPS &&
+                           (Sym->StOther & STO_MIPS_MICROMIPS))
----------------
Ditto


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D40147





More information about the llvm-commits mailing list