You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generates a data section containing one long initialized to four, as you'd expect. As Rafael noted, adding a symbol to the RHS like this:
.data
a = b + 4
.long a
Generates a data section with an external relocation for 'a' (not 'b').
This "feature" goes back at least to the cctools implementation of as.
My gut reaction is that we should either add a warning, or fix this behavior, or add a warning, wait a while for people to fix their horrible code, then fix this behavior.
Extended Description
$ cat test1.s
.data
a = b + 4
.long a
Sandman:llvm respindola$ cat test2.s
.data
a = b + 8
.long a
$ llvm-mc -filetype=obj test1.s -o test1.o -triple=x86_64-apple-darwin
$ llvm-mc -filetype=obj test2.s -o test2.o -triple=x86_64-apple-darwin
$ cmp test1.o test2.o
We should probably include the 4 and 8 in the relocation or produce an error if that is not possible.
The text was updated successfully, but these errors were encountered: