Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new memory sections to the GCC default linker script?

Tags:

c

gcc

linker

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?

like image 283
djondal Avatar asked Apr 08 '15 09:04

djondal


Video Answer


1 Answers

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.

like image 184
simurg Avatar answered Sep 27 '22 19:09

simurg