[DTrace probe] is there a [portable] way to add section to elf executable?
drug
drug2004 at bk.ru
Wed Oct 23 15:24:13 UTC 2019
I'd like to add (and modify) section to ELF executable to implement
DTrace probes. DTrace does it in probe assembly:
```
__asm__ __volatile__ (
"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"
:: [_SDT_S1] "n" (SNIPPED_ONE),
[_SDT_A1] "nor" ((a)),
[_SDT_S2] "n" (SNIPPED_TWO),
[_SDT_A2] "nor" ((b))
);
```
So I need a way to add no op operation and define some data in
`.note.stapsdt` section. This page https://dlang.org/spec/iasm.html does
not contain any information about sections
More information about the Digitalmars-d-learn
mailing list