This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Strange KEEP behavior in linker script
- From: Nick Clifton <nickc at redhat dot com>
- To: Denis FERRANTI <denis dot ferranti at st dot com>
- Cc: bu-sourceware <binutils at sourceware dot org>
- Date: Tue, 06 May 2008 15:17:52 +0100
- Subject: Re: Strange KEEP behavior in linker script
- References: <48205D37.4070102@st.com>
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