[PATCH] D46703: [MC] Relax .fill size requirements
Nirav Dave via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 10 09:40:07 PDT 2018
niravd created this revision.
niravd added reviewers: rnk, peter.smith, echristo, jyknight.
Herald added a subscriber: hiraditya.
Avoid requirement that size must be known for some byte-sized fills at
assembler time.
Fixes PR33586.
Repository:
rL LLVM
https://reviews.llvm.org/D46703
Files:
llvm/lib/MC/MCObjectStreamer.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/test/MC/X86/pr33586.s
Index: llvm/test/MC/X86/pr33586.s
===================================================================
--- /dev/null
+++ llvm/test/MC/X86/pr33586.s
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -triple i686-unknown-unknown %s -filetype=obj -o /dev/null
+
+.text
+early_idt_handler_array:
+ i = 0
+ .rept 32
+ .ifeq (0x00027d00 >> i) & 1
+ push $0
+.endif
+ push $i
+ jmp early_idt_handler_common
+ i = i + 1
+ .fill (early_idt_handler_array - .) + i*9 , 1, 0xcc
+ .endr
+.type early_idt_handler_array, @function
+early_idt_handler_common:
Index: llvm/lib/MC/MCParser/AsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/AsmParser.cpp
+++ llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3141,7 +3141,6 @@
Warning(ExprLoc, "'.fill' directive pattern has been truncated to 32-bits");
getStreamer().emitFill(*NumValues, FillSize, FillExpr, NumValuesLoc);
-
return false;
}
Index: llvm/lib/MC/MCObjectStreamer.cpp
===================================================================
--- llvm/lib/MC/MCObjectStreamer.cpp
+++ llvm/lib/MC/MCObjectStreamer.cpp
@@ -644,6 +644,12 @@
int64_t Expr, SMLoc Loc) {
int64_t IntNumValues;
if (!NumValues.evaluateAsAbsolute(IntNumValues, getAssemblerPtr())) {
+ // Byte fills don't need to know NumValues.
+ if (Size == 1) {
+ emitFill(NumValues, Expr, Loc);
+ return;
+ }
+
getContext().reportError(Loc, "expected absolute expression");
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46703.146146.patch
Type: text/x-patch
Size: 1502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180510/8519859e/attachment.bin>
More information about the llvm-commits
mailing list