RFC: Remove empty output sections
H. J. Lu
hjl@lucon.org
Tue Mar 15 20:38:00 GMT 2005
On Tue, Mar 15, 2005 at 11:58:24AM -0800, H. J. Lu wrote:
> On Tue, Mar 15, 2005 at 08:45:44AM +1030, Alan Modra wrote:
> > On Mon, Mar 14, 2005 at 08:10:48AM -0800, H. J. Lu wrote:
> > > On Mon, Mar 14, 2005 at 07:05:15PM +1030, Alan Modra wrote:
> > > > On Sun, Mar 13, 2005 at 10:31:41PM -0800, H. J. Lu wrote:
> > > > > @@ -4883,7 +4893,7 @@ lang_process (void)
> > > > > lang_check_section_addresses ();
> > > > >
> > > > > /* Final stuffs. */
> > > > > -
> > > > > + lang_mark_used_section ();
> > > > > ldemul_finish ();
> > > > > lang_finish ();
> > > > > }
> > > >
> > > > Isn't this too late to strip sections? What happens if one of the
> > > > sections stripped has a dynamic section symbol?
> > >
> > > An empty section has a dynamic section symbol. Do you have a testcase
> > > for that?
> >
> > Easy. This also demonstrates another potential problem with removing
> > empty sections; Their alignment can affect layout of other sections.
> >
>
> Here is the output from readelf -Sls after removing empty sections.
> Removing an empty section will certainly change the layout of other
> sections. I don't think it should be a problem. I believe that
> anything depending on alignment of an empty section is broken.
>
> 3 local entries in .dynsym have UND index since they are removed. It
> is hard to remove them since it is done too late. I don't think it
> should cause any probleme though.
>
FYI, removing empty sections doesn't change the layout. I will see
if I can remove those UND entries in .dynsym.
H.J.
More information about the Binutils
mailing list