[PATCH] D125582: [llvm-ml] Add support for extern proc
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 16 03:57:27 PDT 2022
hans added a comment.
> Interestingly enough, under MSVC the following is allowed:
>
> extern foo:proc
>
> mov eax, foo
>
> MSVC will output:
>
> mov eax, 0
>
> while llvm-ml will currently output:
>
> mov eax, dword ptr [foo]
>
> (since foo is an extern)
>
> Arguably, llvm-ml's output makes more sense, even though it's
> inconsistent with MSVC ml. However, since moving an extern proc symbol
> to a register doesn't really make sense in the first place, we'll treat
> it as undefined behavior for now.
Maybe I'm just not familiar enough with MASM, but both outputs seem odd to me. I would expect MSVC's output to be accompanied by a relocation, but it seems that's not the case?
"mov eax, foo" reads like "move the address of foo into eax" to me, which seems like it would be a sensible thing to do. What llvm-ml does is more like "load from foo into eax" which seems odd if "foo" is a function.
In any case, if we can't support it in a sensible way, can we at least error about it? And there should be a test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125582/new/
https://reviews.llvm.org/D125582
More information about the llvm-commits
mailing list