D at 8-bit platform - some experiences
kinke
noone at nowhere.com
Fri Jul 7 15:00:41 UTC 2023
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.
> 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.
> Third, you have the tools to make the object code as compact as
> you want. For some reason, the linker doesn't recognise unused
> functions by default, even with `-L--gc-sections` and
> `--fvisibility=hidden`. I spent a long time fighting the
> linker, once finally finding out that `--function-sections`
> flag for the compiler is needed.
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.
More information about the Digitalmars-d
mailing list