This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Adding custom sections to default linker script
- From: Jonas Maebe <jonas dot maebe at elis dot ugent dot be>
- To: binutils at sourceware dot org
- Date: Sat, 29 Aug 2015 16:03:19 +0200
- Subject: Adding custom sections to default linker script
- Authentication-results: sourceware.org; auth=none
Hi,
(the following is all on Linux platforms for various architectures)
Our compiler generates a few special sections:
* some which should always be kept/never be garbage collected
* some which should be inserted at a particular place
The way I'm currently trying to do this, is by adding the following to
the linker response file:
SECTIONS
{
.data :
{
KEEP (*(.fpc .fpc.n_version .fpc.n_links))
}
.threadvar _edata : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }
}
This generates the warning "./link.res contains output sections; did you
forget -T?". I did not "forget" -T, because I don't want to replace the
entire linker script, I just want to augment it.
So my question: is there a different, more appropriate way to do this?
The reason I don't want to completely replace/duplicate the default
linker script is primarily because it often contains Linux
distribution-specific library search paths, which moreover tend to
change every full moon.
Thanks,
Jonas