How to port this GCC assembly to gdc?

drug drug2004 at bk.ru
Thu Oct 24 20:17:35 UTC 2019


24.10.2019 22:51, Iain Buclaw пишет:
> On Thu, 24 Oct 2019 at 19:20, drug via D.gnu <d.gnu at puremagic.com> wrote:
>>
>> On 10/24/19 8:01 PM, Iain Buclaw wrote:
>>> You can do the following:
>>>
>>> void somefunc()
>>> {
>>>     asm {
>>>           "990: nop" ~
>>>           ".pushsection .note.stapsdt,\"?\",\"note\"" ~
>>>           ".balign 4" ~
>>>           ".4byte 992f-991f, 994f-993f, 3" ~
>>>           "991: .asciz \"stapsdt\"" ~
>>>           "992: .balign 4" ~
>>>           "993: .8byte 990b" ~
>>>           ".8byte _.stapsdt.base" ~
>>>           ".8byte 0" ~
>>>           ".asciz \"myapp\"" ~
>>>           ".asciz \"func_call\"" ~
>>>           ".asciz \"%n[_SDT_S1]@%[_SDT_A1] %n[_SDT_S2]@%[_SDT_A2]\"" ~
>>>           "994: .balign 4" ~
>>>           ".popsection\n"
>>>           :: [_SDT_S1] "n" (4),
>>>              [_SDT_A1] "nor" ((a)),
>>>              [_SDT_S2] "n" (4),
>>>              [_SDT_A2] "nor" ((b))
>>>     } // <= line 26
>>> }
>>>
>>> The instruction string can be generated at CTFE.
>>>
>> Unfortunately I doesn't work https://godbolt.org/z/ly2yBT
>> ```
>> source/app.d:26:3: error: expression expected, not '}'
>> ```
>>
> 
> That's correct, because I forgot the semicolon (the hint is in the
> latter message: found 'EOF' when expecting ';').
> 
>>From what little information I'm going off on that macro, it seems
> that you want it to do something like the following:
> https://explore.dgnu.org/z/TtTcij
> 

That's it! Thank you very much!


More information about the D.gnu mailing list