[PATCH] D20337: [MC] Support symbolic expressions in assembly directives
Rafael Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Wed May 25 07:29:46 PDT 2016
> 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.
For the sake of argument lets say it is clang creating that expression.
If someone is running "clang -S test.c && clang -c test.s" we will
report an error in the .s. There is no way around it: the .s doesn't
have a way to cary the location for use in the error message.
If someone is running "clang -c test.c" we will not use the asm streamer.
> 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.
If there is no error, that property is not broken.
If there is an error, that property doesn't exist already. It is
perfectly possible to create a .s that will not assemble.
If there is the desire to change that, what I think should happen is
for -S to create and discard an object file in memory. Without
creating an actual assembler we will never know for sure if a .s can
or cannot be assembled, but that is independent from this change.
More information about the llvm-commits