This is the mail archive of the 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: Section (.sdata2) being omitted but SIZEOF(.sdata2) is not zero?

> Most of the time, there's no actual content in .sdata2 so the only thing in that output section is the padding
>  (there's probably a better way to do this, but this has been working for a long time so we're reluctant to
> touch it).  We've recently started using the -gc-sections linker option.  This works most of the time, but the
> problem is that sometimes (as far as I can tell, only when the size  of .header plus .text is a multiple of
> 512 bytes) the output elf file does not contain a .sdata2 section.  This would be fine, but what isn't fine is
> that SIZEOF(.sdata2) is not zero.  __CODE_SIZE is the size of .text plus the size of the phantom .sdata2
> section that wasn't actually output.  .data is still aligned on a 4KB boundary, but there's a gap between the end of .text
> and the beginning of .data that is not reflected in any output elf section.

Actually this isn't even consistent.  Here's a case where .sdata2 was not output but additionally the following .data
segment wasn't even aligned on a 4KB boundary.  Note that the text segment ends at a multiple of 0x200 bytes, which
seems to always be the case when this happens.

Idx Name          Size      VMA       LMA       File off  Algn
  0 .header     00000040  01640000  01640000  00010000  2**2
                          CONTENTS, ALLOC, LOAD, DATA
  1 .text           00639dc0  01640040  01640040  00010040  2**5
                          CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .data          00045738  01c7a200  01c7a200  0064a200  2**3
                          CONTENTS, ALLOC, LOAD, DATA


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