[llvm] MIPS: Adding a check for JAL argument in PIC mode to prevent crashing on getExpr (PR #120356)
YunQiang Su via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 19:24:38 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");
----------------
wzssyqa wrote:
gas gives the error message like:
```
k.s: Assembler messages:
k.s:2: Error: unsupported constant in relocation
```
I think that we should keep them same.
https://github.com/llvm/llvm-project/pull/120356
More information about the llvm-commits
mailing list