This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: mn10300: relaxing vs section merging
> > >> > You have to use section-relative relocs with section merging
> >
> > >> Why?
> >
> > > Because _bfd_elf_rela_local_sym() only adjusts STT_SECTION symbols.
> > > If you have other types of symbols, it doesn't seem to adjust the
> > > values properly.
> >
> > Hmm... Maybe it should be improved/fixed, then? I suppose whenever
> > we get called with a symbol, we should figure out in which section it
> > is, find the relocation for the section, and then apply the symbol
> > offset into the section again.
>
> Local symbols in SEC_MERGE sections are adjusted, but too late for
> you when doing relaxing. See elf_link_input_bfd. You can't do the
> adjustment until you know final section layout, because some symbols
> might end up pointing outside their section, or even outside their
> bfd. Of course, you can't make the final section layout until
> relaxing is complete..
>
> I suppose it would be possible to move all the local sym adjustments
> into _bfd_elf_rel{,a}_local_sym. Note that _bfd_elf_rel_local_sym
> looks like it handles any local sym. Beware! _bfd_elf_rel_local_sym
> should be (and is currently) only called on section syms.
Ok, so can I commit my patch then? It sounds like I'm doing the right
thing...