D at 8-bit platform - some experiences

Dukc ajieskola at gmail.com
Sat Jul 8 09:04:33 UTC 2023


On Friday, 7 July 2023 at 15:00:41 UTC, kinke wrote:
> Thanks for the interesting write-up! :)
>
> I haven't thought about what to do with size/ptrdiff_t and 
> integer promotion rules for 8/16 bit targets yet. I guess the 
> least surprising behavior would be mimicking gcc/clang there.

I'm finding the current one (size/ptrdiff_t always at least 4 
bytes, but sizeof(T*) still 2) a practical choice. It follows 
that no changes to int promotion rules are needed (for 8/16 bits 
specially - there's still the question whether we want to change 
them in general though).

>
>> Another big limitation on AVR isn't due to the bit width, but 
>> it's Harvard architechture. LLVM considers pointers to program 
>> memory a different type from data pointers, but LDC declares 
>> function pointers as data pointers, resulting in LLVM type 
>> error trying to compile their usage code.
>
> Please file an LDC issue, fixing this shouldn't be rocket 
> science.

[okay](https://github.com/ldc-developers/ldc/issues/4432).

> Both `--function-sections` and `-L--gc-sections` should be the 
> default settings for bare-metal (and other) targets since LDC 
> v1.32 - LDC was probably a bit too conservative in this regard 
> before.

Great! I'm currently using a somewhat outdated compiler, namely 
1.30.0, but sooner or later I will update.




More information about the Digitalmars-d mailing list