Testing GDC (GCC 7.1) on Runtime-less ARM Cortex-M
Iain Buclaw via D.gnu
d.gnu at puremagic.com
Sun Jun 25 06:40:56 PDT 2017
On 25 June 2017 at 13:30, Mike via D.gnu <d.gnu at puremagic.com> wrote:
> On Sunday, 25 June 2017 at 10:53:35 UTC, Mike wrote:
>
>> I'm not really interested in that because its too blunt of an instrument.
>> I'd like to use TypeInfo, but only if I'm doing dynamic casts or other
>> things that require such runtime information. Also, I'd only want the
>> TypeInfo for the types that need it in my binary. I've said this before but
>> I'll repeat: I like TypeInfo; I just don't like dead code.
>
>
> Just a little more information about this. It doesn't appear that the
> entire TypeInfo object is remaining in the binary. It appears to only be
> the `name` of the type that the linker just can't seem to "garbage
> collection" from the .rodata section.
>
> Mike
>
>
Ah ha! It seems that for whatever reason, binutils can't strip
strings. But if you wrap that string around a static symbol, then has
no problem removing it.
Using your small test here: https://issues.dlang.org/show_bug.cgi?id=14758
Making the following modifications for gdc.
---
long syscall(long code, long arg1 = 0, in void* arg2 = null, long arg3 = 0)
{
long result = void;
asm { "syscall"
: /* "=a" (result) ??? No output operands == asm volatile?
That seems wrong... */
: "a" (code), "D" (arg1), "S" (arg2), "d" (arg3);
}
return result;
}
---
Compiling with -fdata-sections -Os shows that .rodata now only contains:
Contents of section .rodata:
40010e 48656c6c 6f0a00 Hello..
I'll make a formal PR when I have some time later.
Iain.
More information about the D.gnu
mailing list