[PATCH] D20337: [MC] Support symbolic expressions in assembly directives

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 07:03:50 PDT 2016

niravd added inline comments.

Comment at: lib/MC/MCAsmStreamer.cpp:828
@@ +827,3 @@
+  MCStreamer::emitFill(NumBytes, FillValue);
rafael wrote:
> niravd wrote:
> > I believe it still is. Consider the case where the symbolic expression emitted for NumBytes is eventually evaluated to a non-positive number or is invalid? Errors in the compilation of the output assembly would point to location in the output asm file not the original as it should. 
> > 
> > 
> This is the asm streamer, so it will just print a negative number in the .s.
That's not the case that I'm concerned about. 

Let's say it's an expression (TEST1 - TEST0 - 4) for which we don't know should cause an error until we generate an object. With this we will to output this to the file without checking. If it's a problem, we will absolutely error when we attempt to generate an object but we've lost the original location of the error and we'll instead get the location from the new file which we do not gaurantee to be the same. 

This breaks the property that generating an assembly and then making an object file has the same output as just generating the object file directly. 



More information about the llvm-commits mailing list