This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Linker script using INSERT AFTER
On Tue, Oct 27, 2009 at 10:23:43AM +0100, Jan Blunck wrote:
> On Mon, Oct 26, Daniel Jacobowitz wrote:
>
> > On Tue, Oct 27, 2009 at 09:56:34AM +1030, Alan Modra wrote:
> > > > Anyway, since I though that it isn't necessary to add an empty section (if
> > > > __start___markers isnt' there I know that the section will be empty anyway) I
> > > > thought that I can live with the following:
> > > >
> > > > SECTIONS
> > > > {
> > > > PROVIDE_HIDDEN(__start___markers = .);
> > > > PROVIDE_HIDDEN(__stop___markers = .);
> > > >
> > > > PROVIDE_HIDDEN(__start___tracepoints = .);
> > > > PROVIDE_HIDDEN(__stop___tracepoints = .);
> > > > }
> > > > INSERT AFTER .data;
> > > >
> > > > That actually works, but it seems to override the hidden symbol that comes
> > > > with on of the objects to link with. Somehow I think this isn't correct due to
> > > > the description of PROVIDE_HIDDEN().
> > >
> > > PROVIDE and PROVIDE_HIDDEN should only provide definitions for
> > > undefined or common symbols. Perhaps you have one of the latter?
> >
> > Is the symbol being overridden really in one of the input files? Or
> > is it linker created from a section named "__markers"? Maybe the
> > section symbols are being generated by ld after PROVIDE_HIDDEN is
> > processed.
>
> You are right, it is a symbol that is linker generated because it finds the
> section named __markers.
In that case, you may be able to fix this by explicitly placing
__markers instead.
SECTIONS
{
PROVIDE_HIDDEN(__start___markers = .);
*(__markers)
PROVIDE_HIDDEN(__stop___markers = .);
PROVIDE_HIDDEN(__start___tracepoints = .);
*(__tracepoints)
PROVIDE_HIDDEN(__stop___tracepoints = .);
}
--
Daniel Jacobowitz
CodeSourcery