[llvm] MIPS: Adding a check for JAL argument in PIC mode to prevent crashing on getExpr (PR #120356)

Renat Idrisov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 19:57:57 PST 2024


================
@@ -2108,6 +2108,10 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
   if ((Opcode == Mips::JAL || Opcode == Mips::JAL_MM) && inPicMode()) {
     warnIfNoMacro(IDLoc);
 
+    if (!Inst.getOperand(0).isExpr()) {
+      return Error(IDLoc, "jal needs a symbolic expression in PIC mode");
----------------
parsifal-47 wrote:

sounds good, updated to the same message, thank you!

https://github.com/llvm/llvm-project/pull/120356


More information about the llvm-commits mailing list