combreloc patches for s390, s390x, ppc

Jakub Jelinek jakub@redhat.com
Fri Aug 24 12:15:00 GMT 2001


On Fri, Aug 24, 2001 at 08:19:29PM +0200, Andreas Jaeger wrote:
> +    case R_PPC_REL24:
> +    case R_PPC_REL14:
> +    case R_PPC_REL14_BRTAKEN:
> +    case R_PPC_REL14_BRNTAKEN:
> +    case R_PPC_REL32:

I think these are wrong.
reloc_class_relative are the ones that count into DT_REL*COUNT.
Looking at powerpc/dl-machine.h:
  if (rinfo == R_PPC_RELATIVE
      || (sym->st_shndx != SHN_UNDEF
          && ELF32_ST_BIND (sym->st_info) == STB_LOCAL))
    {
      /* Has already been relocated.  */
      loadbase = map->l_addr;
      finaladdr = loadbase + reloc->r_addend;
    }
  else
    {
      loadbase = (Elf32_Word) (char *) (RESOLVE (&sym, version,
which shows that IMHO only R_PPC_RELATIVE should be here.

reloc_class_plt are those for which glibc elf_machine_lookup_noplt_p
returns 1, ie. I think R_PPC_REL24 and R_PPC_ADDR24 too.
The thing is that PLT relocs have different lookup rules, likewise with
copy relocs, and thus mixing them together with other relocs means lookup
cache will be less effective.
reloc_class_copy should be obvious (R_*_COPY only, in other words
elf_machine_lookup_noexec_p in glibc).

> +    case R_PPC_RELATIVE:
> +      return reloc_class_relative;
> +    case R_PPC_JMP_SLOT:
> +      return reloc_class_plt;
> +    case R_PPC_COPY:
> +      return reloc_class_copy;
> +    default:
> +      return reloc_class_normal;
...
> +    case R_390_PC16:
> +    case R_390_PC16DBL:
> +    case R_390_PC32:

Again, only R_390_RELATIVE.

> +    case R_390_RELATIVE:
> +      return reloc_class_relative;
> +    case R_390_JMP_SLOT:
> +      return reloc_class_plt;
> +    case R_390_COPY:
> +      return reloc_class_copy;
> +    default:
> +      return reloc_class_normal;
...
> +    case R_390_PC16:
> +    case R_390_PC16DBL:
> +    case R_390_PC32:
> +    case R_390_PC32DBL:
> +    case R_390_PC64:

Likewise.

> +    case R_390_RELATIVE:
> +      return reloc_class_relative;
> +    case R_390_JMP_SLOT:
> +      return reloc_class_plt;
> +    case R_390_COPY:
> +      return reloc_class_copy;
> +    default:
> +      return reloc_class_normal;

	Jakub



More information about the Binutils mailing list