This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange KEEP behavior in linker script


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]