I wasn’t sure if this would go in IR, code gen, or clang, so I put it here, cause its my first post anyways :).
Are there any known issues with generating position independed code using jump tables? I have a case where when I enable fPIC, I get jump table entries that look PI (they are offsets in to the text section), but the appropriate ALU to offset from the current PC isn’t generated, so it attempts to jump directly to the offset.
In this case, it is using the pc to calc the location of the jump table, but then jumps directly to the value in the jump table. In PIC, I would think it would need to do some new calculation based on the PC (via another AUIPC instr or reusing the value in a2), as when the jump table generates, it does not know the address of the jump…
That’s position-dependent, yes. For position-independent code, your ld a1, 0(a1) becomes lw a1, 0(a1); add a1, a1, a2 as the offsets in the table are 32-bit table-relative addresses.
So I’m not sure what your question is; it sounded like a bug report, but so far you haven’t produced a proper bug report, and the above demonstrates the expected behaviour working fine.