Windows PDATA/XDATA for Clang Inline Assembly

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows PDATA/XDATA for Clang Inline Assembly

Manas via cfe-dev
I have found no way to give directives to the inline assembler such
that it generates the relevant pdata/xdata.

Is this a limitation or I'm being dense?

If I forgot inline assembly but still use lld-link will my object file
from say MASM get linked properly?
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Windows PDATA/XDATA for Clang Inline Assembly

Manas via cfe-dev
I managed to make it work with naked functions:
Compiling locally results in an object with .pdata/.xdata. I would expect you could use gcc-style inline asm here too if you like.

Generally, if you use these directives in a regular, non-naked (clothed?) function, you should expect to get errors from the assembler about directives outside the prologue. The compiler will assume it is responsible for the prologue, and emit the unwind info directives.

If you were to use masm instead, yes, I would expect lld-link to still accept it.

On Wed, Oct 14, 2020 at 2:20 AM Hayden Livingston via cfe-dev <[hidden email]> wrote:
I have found no way to give directives to the inline assembler such
that it generates the relevant pdata/xdata.

Is this a limitation or I'm being dense?

If I forgot inline assembly but still use lld-link will my object file
from say MASM get linked properly?
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Windows PDATA/XDATA for Clang Inline Assembly

Manas via cfe-dev
Thank you, Reid for this reply and all the work you (and others) do to
help Windows users of LLVM/Clang.

And this works for ARM64 as well?
https://lists.llvm.org/pipermail/llvm-dev/2018-July/124727.html which
is a couple of years old but you ask someone to see if they would add
support I don't know if that ever made it.

On Thu, Oct 15, 2020 at 10:33 AM Reid Kleckner <[hidden email]> wrote:

>
> I managed to make it work with naked functions:
> https://gcc.godbolt.org/z/9q5r7W
> Compiling locally results in an object with .pdata/.xdata. I would expect you could use gcc-style inline asm here too if you like.
>
> Generally, if you use these directives in a regular, non-naked (clothed?) function, you should expect to get errors from the assembler about directives outside the prologue. The compiler will assume it is responsible for the prologue, and emit the unwind info directives.
>
> If you were to use masm instead, yes, I would expect lld-link to still accept it.
>
> On Wed, Oct 14, 2020 at 2:20 AM Hayden Livingston via cfe-dev <[hidden email]> wrote:
>>
>> I have found no way to give directives to the inline assembler such
>> that it generates the relevant pdata/xdata.
>>
>> Is this a limitation or I'm being dense?
>>
>> If I forgot inline assembly but still use lld-link will my object file
>> from say MASM get linked properly?
>> _______________________________________________
>> cfe-dev mailing list
>> [hidden email]
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Windows PDATA/XDATA for Clang Inline Assembly

Manas via cfe-dev
On Fri, 16 Oct 2020, Hayden Livingston via cfe-dev wrote:

> Thank you, Reid for this reply and all the work you (and others) do to
> help Windows users of LLVM/Clang.
>
> And this works for ARM64 as well?
> https://lists.llvm.org/pipermail/llvm-dev/2018-July/124727.html which
> is a couple of years old but you ask someone to see if they would add
> support I don't know if that ever made it.

General support for unwind info code generation was added back then, and
was mostly complete around LLVM 8.

But support for generating unwind info in assembly (both inline and
external) wasn't added back then; that was added recently in the master
branch though. See e.g.
https://github.com/llvm/llvm-project/commit/5b86d130e2baed7221b09087c506f5974fe65f22#diff-2aa6bd21d4d021458b63376b56c919f9638fc172e1dfe2170d5d4653cde431a5 
and
https://github.com/llvm/llvm-project/commit/f5e2ea9a43221be9576056c4912796cf37331cd7#diff-2aa6bd21d4d021458b63376b56c919f9638fc172e1dfe2170d5d4653cde431a5 
for examples on the syntax. As the instruction set and unwind opcodes
differ between x86_64 and arm64, the assembly directives also differ
accordingly.

// Martin

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev