-fno-rtti (disable TypeInfo) support ready for testing

Johannes Pfau via D.gnu d.gnu at puremagic.com
Mon May 11 10:02:58 PDT 2015


Am Mon, 11 May 2015 12:20:46 +0000
schrieb "Mike" <none at none.com>:

> On Sunday, 10 May 2015 at 17:45:30 UTC, Johannes Pfau wrote:
> > I've just opened a pull request for -fno-rtti at [1]. The 
> > frontend part
> > needs to go into DMD but I'd like some testing feedback first. 
> > This is
> > especially important as I had literally no time to test this
> > updated code ;-) Please provide feedback here or at [1].
> >
> 
> Thanks for doing this!
> 
> I tested my LCD demo and I get the following errors,
> 
> Compiler command
> ----------------
> arm-none-eabi-gdc -c -O3 -nophoboslib -nostdinc -nodefaultlibs 
> -nostdlib -mthumb -mcpu=cortex-m4 -fno-bounds-check 
> -fno-invariants -fno-in -fno-out -fno-emit-moduleinfo -fno-rtti 
> -ffunction-sections -fdata-sections {some_imports} 
> {my_source_files} -o binary/firmware.o
> 
> Compiler output
> ---------------
> source/stm32f42/trace.d:58:5: error: Can't use array literal: 
> TypeInfo disabled using -fno-rtti switch.
>       [
>       ^
I really need to make that test smarter. Static array init of course
doesn't require TypeInfo. As a workaround you could remove this check:
https://github.com/D-Programming-GDC/GDC/pull/100/files#diff-5960d486a42197785b9eee4ba95c6b95L4082

> cc1d: error: Can't use typeid: TypeInfo disabled using -fno-rtti 
> switch.
> source/gcc/attribute.d:10:12: error: template instance 
> gcc.attribute.Attribute!string error instantiating
>       return Attribute!A(args);
>              ^
> source/gcc/attribute.d:13:45: note: instantiated from here: 
> attribute!(string)
>   public enum inline = gcc.attribute.attribute("forceinline");
> 

Strange. I'll debug this later this week.

> 
> Here's the code causing the error
> ---------------------------------
> 
> https://github.com/JinShil/stm32f42_discovery_demo/blob/master/source/stm32f42/trace.d#L57
> private void semihostingWrite(in void* ptr, in uint length)
> {
>    uint[3] message = [ 2, cast(uint)ptr, length];  // line 58
>    semihostingInvoke(0x05, &message);
> }
> 
> // attribute.d
> /*************/
> private struct Attribute(A...)
> {
>    A args;
> }
> 
> https://github.com/JinShil/stm32f42_discovery_demo/blob/master/source/gcc/attribute.d
> auto attribute(A...)(A args) if(A.length > 0 && is(A[0] == 
> string))
> {
>    // line 10
>    return Attribute!A(args);
> }
> 
> //line 13
> public enum inline = gcc.attribute.attribute("forceinline");
> public enum naked = gcc.attribute.attribute("naked");
> 
> 
> Without the -fno-rtti switch, everything builds fine.
> 
> Mike




More information about the D.gnu mailing list