djondal
djondal

Reputation: 2541

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

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?

Upvotes: 6

Views: 4214

Answers (1)

simurg
simurg

Reputation: 1208

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.

Upvotes: 5

Related Questions