Strange KEEP behavior in linker script
Nick Clifton
nickc@redhat.com
Tue May 6 14:18:00 GMT 2008
Hi Denis,
The changes in behaviour have happened because of various bug fixes.
> Shouldn't the KEEP() statement force the generation of the output
> section in the ELF file, even if there are no input sections.
No, the KEEP statement will ensure that any input sections matching its
argument will be copied into the output section containing it. But if
there are no matching input sections, then nothing will be copied and
hence the output section might be discarded. If you want to ensure that
a section is present in the output file, make sure that some data is
placed into it. eg:
.mysec :
{
mysec_start = .;
KEEP(*(.mysec));
mysec_end = .;
LONG(0)
}
Cheers
Nick
More information about the Binutils
mailing list