Can't add the allocated section to elf file using inline assembly
drug
drug2004 at bk.ru
Tue Nov 5 12:20:14 UTC 2019
On 11/5/19 2:13 PM, kinke wrote:
> On Tuesday, 5 November 2019 at 09:49:35 UTC, drug wrote:
>> Is it a bug or I misuse something? Is there way to work around it?
>
> I assume you're looking for module-level assembly, not contained in a
> function; that's what we lower DMD-style asm to, but isn't supported for
> __asm AFAIK.
>
> Anyway, I recommend comparing the generated assembly by clang (`-S`
> IIRC) and LDC (-output-s) to figure out the difference.
Thanks for hint! Output of clang and ldc is identical
clang:
```
#NO_APP
#APP
.section .stapsdt.base,"aG", at progbits,.stapsdt.base,comdat
.weak _.stapsdt.base
.hidden _.stapsdt.base
_.stapsdt.base:
.zero 1
.size _.stapsdt.base, 1
.text
```
ldc
```
.section .stapsdt.base,"aG", at progbits,.stapsdt.base,comdat
.weak _.stapsdt.base
.hidden _.stapsdt.base
_.stapsdt.base:
.zero 1
.size _.stapsdt.base, 1
```
Moreover, if I remove 'a' from "aG" the section appears in the binary.
So I guess the generated assembly is correct and the problem is in
another place.
How can I compile .s file? I tried
```
clang app.s -L/path/to/ldc/lib/ -ldruntime-ldc -lphobos2-ldc -Wl,pie -o app2
```
but I get
```
app.s:33187:2: error: unknown section type
.hidden DW.ref._d_eh_personality
```
More information about the digitalmars-d-ldc
mailing list