This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH][gold] gold/PR16711 Linker script causes gold to include .bss in output file.
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Igor Kudrin <ikudrin at accesssoftek dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Sun, 11 Dec 2016 20:46:04 -0800
- Subject: Re: [PATCH][gold] gold/PR16711 Linker script causes gold to include .bss in output file.
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com>
> If a linker script is used, all output sections of a segment are stored
> in the first item of output_lists_. On the other hand, when calculating
> the file size of segments, gold adds sections from all chunks of
> output_lists_ up to index ORDER_SMALL_BSS. As a result, if a linker
> script with SECTIONS clause is used, all the sections contribute to the
> file size of the segment, even though some of them might be BSS.
> This patch addresses the issue by analyzing section types, excluding
> BSS sections at the end of the sequence from contributing to the file
> offset, regardless of their index in output_lists_.
This particular problem turned out to be more complicated than I
expected. Your patch is generally the right approach, but I ended up
doing it a bit differently, and it had a domino effect as I tried to
clean up other problems exposed by this fix.
Thanks for the contribution!