How to port this GCC assembly to gdc?

drug drug2004 at bk.ru
Thu Oct 24 10:02:46 UTC 2019


Hello!

I have the following assebly:
```C
__asm__ __volatile__ (
	"990: nop\n"                                                 \
	".pushsection .note.stapsdt,\"?\",\"note\"\n"                \
	".balign 4\n"                                                \
	".4byte 992f-991f, 994f-993f, 3\n"                           \
	"991: .asciz \"stapsdt\"\n"                                  \
	"992: .balign 4\n"                                           \
	"993: .8byte 990b\n"                                         \
	".8byte _.stapsdt.base\n"                                    \
	".8byte 0\n"                                                 \
	".asciz \"myapp\"\n"                                         \
	".asciz \"func_call\"\n"                                     \
	".asciz \"%n[_SDT_S1]@%[_SDT_A1] %n[_SDT_S2]@%[_SDT_A2]\"\n" \
	"994: .balign 4\n"                                           \
	".popsection\n"
	:: [_SDT_S1] "n" (4),
	   [_SDT_A1] "nor" ((a)),
	   [_SDT_S2] "n" (4),
	   [_SDT_A2] "nor" ((b))
);
```
this code compiles by gcc but gdc ((Debian 6.3.0-18+deb9u1) 6.3.0 
20170516) fails. It doesn't like __volatile__ keyword and :: syntax

```D
__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))
);
```


More information about the D.gnu mailing list