The -T command to the GCC linker replaces the default linker script. But I don't want to replace the default linker script. I want to append my new section definitions to the existing default linker script.
How to add new memory sections to the default linker script?
I don't think there is a direct way to do what you want to.
What you could do though, is to have ld
print the default script file (with -Wl,-verbose
, the section between ===============
s is the linker script), put it in a file, modify the file with your additions and finally feed this to your link command as the linker script.
It should be fairly easy to write a script that does this and integrate it in your build scripts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With