This is the mail archive of the binutils@sources.redhat.com 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: [PATCH/RFA] sh-elf: Unnecessary relocations


On Fri, 27 Sep 2002, kaz Kojima wrote:
> Hans-Peter Nilsson <hp@bitrange.com> wrote:
> > On Fri, 27 Sep 2002, kaz Kojima wrote:
> >>  BFD_RELOC_SH_PCDISP12BY2
> >>  BFD_RELOC_SH_PCRELIMM8BY2
> >>  BFD_RELOC_SH_PCRELIMM8BY4
> >>  BFD_RELOC_8_PCREL
> >>  BFD_RELOC_SH_SWITCH16
> >>  BFD_RELOC_SH_SWITCH32

> > Either way, if ld.so can handle them (or whatever they turn into
> > in a DSO) in a DT_TEXTREL (sp?) DSO, they should make it to the
> > output.
>
> Yes, ld.so can't handle them.

I see.  I mistook BFD_RELOC_SH_SWITCH32 for R_SH_REL32.

> 2002-09-27  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
>
> 	* config/tc-sh.c (sh_force_relocation): Return 0 for
> 	some PC relative relocations when not relaxing.

With a comment as mentioned below, and a test-case, this is ok.
Sorry to be anuiscance, but when there's a bug fixed, there
should always be a test-case added to the test-suite, one like
in your first message about this.  Preferrably the test-case
covers all of these relocs that you can easily produce.  I
suggest using run_dump_test, adding a call from
gas/sh/basic.exp.

Thanks.

>  sh_force_relocation (fix)
>       fixS *fix;
>  {
> +  if (! sh_relax
> +      && (fix->fx_r_type == BFD_RELOC_SH_PCDISP8BY2

Add a comment to the code why it's not useful to "force" these
relocs despite symbol globalness.  Something like "they can't
make it into a DSO" or that "ld.so can't handle these anyway if
they make it to a DSO with DT_TEXTREL, so no use forcing them
for global symbols".

brgds, H-P


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