Skip to content

Commit d60fbb3

Browse files
committed
Allow label+offset combination for relocation
1 parent 78af857 commit d60fbb3

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

llvm/lib/Target/X86/AsmParser/X86Operand.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,11 @@ struct X86Operand final : public MCParsedAsmOperand {
421421
bool isDispImm8() const {
422422
if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getMemDisp()))
423423
return isImmSExti64i8Value(CE->getValue());
424-
return false;
424+
return true;
425425
}
426426

427427
bool isAbsMem8() const {
428-
return isAbsMem() && isMem8() &&
429-
(isa<MCSymbolRefExpr>(getMemDisp()) || isDispImm8());
428+
return isAbsMem() && isMem8() && isDispImm8();
430429
}
431430

432431
bool isMemUseUpRegs() const override { return UseUpRegs; }

llvm/test/MC/X86/intel-syntax.s

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: FileCheck < %t %s
33
// RUN: FileCheck --check-prefix=CHECK-STDERR < %t.err %s
44

5+
_nop_label:
6+
nop
7+
58
_test:
69
xor EAX, EAX
710
ret
@@ -825,6 +828,9 @@ fucomip st, st(2)
825828
// CHECK: fcompi %st(2)
826829
// CHECK: fucompi %st(2)
827830

831+
jrcxz _nop_label
832+
jecxz _nop_label + 1
833+
828834
loopz _foo
829835
loopnz _foo
830836
// CHECK: loope _foo

llvm/test/MC/X86/validate-inst-intel.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
# CHECK: ^
1515

1616
.text
17-
loop BYTE PTR [SYM+4]
17+
loop WORD PTR [SYM+4]
1818
# CHECK: error: invalid operand for instruction
19-
# CHECK: loop BYTE PTR [SYM+4]
19+
# CHECK: loop WORD PTR [SYM+4]
2020
# CHECK: ^
2121

2222
.text

0 commit comments

Comments
 (0)