[Bug 221107] -r322109 and -r322210 (so clang 5) TARGET_ARCH=powerpc agp.kld or agp.kld gets: R_PPC_PLTREL24 reloc against local symbol; could not read symbols: Bad value

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Aug 11 01:02:23 UTC 2017


--- Comment #4 from Mark Millard <markmi at dsl-only.net> ---
The "reloc against local symbol" text
is omitted by code from:


in its routine:

/* Look through the relocs for a section during the first phase, and
   allocate space in the global offset table or procedure linkage
   table.  */

static bfd_boolean
ppc_elf_check_relocs (bfd *abfd,
                      struct bfd_link_info *info,
                      asection *sec,
                      const Elf_Internal_Rela *relocs)


      tls_type = 0;
      r_type = ELF32_R_TYPE (rel->r_info);
. . .              
      switch (r_type)
. . .
        case R_PPC_PLT32:
        case R_PPC_PLTREL24:
        case R_PPC_PLTREL32:
        case R_PPC_PLT16_LO:
        case R_PPC_PLT16_HI:
        case R_PPC_PLT16_HA:
#ifdef DEBUG
          fprintf (stderr, "Reloc requires a PLT entry\n");
          /* This symbol requires a procedure linkage table entry.  We
             actually build the entry in finish_dynamic_symbol,
             because this might be a case of linking PIC code without
             linking in any dynamic objects, in which case we don't
             need to generate a procedure linkage table after all.  */

          if (h == NULL)
              /* It does not make sense to have a procedure linkage
                 table entry for a local symbol.  */
              (*_bfd_error_handler) (_("%B(%A+0x%lx): %s reloc against "
                                       "local symbol"),
                                     (long) rel->r_offset,
              bfd_set_error (bfd_error_bad_value);
              return FALSE;
              bfd_vma addend = 0;

              if (r_type == R_PPC_PLTREL24)
                  ppc_elf_tdata (abfd)->makes_plt_call = 1;
                  addend = rel->r_addend;
              h->needs_plt = 1;
              if (!update_plt_info (abfd, h, got2, addend))
                return FALSE;

where the earlier code for finding the h value is:

      r_symndx = ELF32_R_SYM (rel->r_info);
      if (r_symndx < symtab_hdr->sh_info)
        h = NULL;
          h = sym_hashes[r_symndx - symtab_hdr->sh_info];
          while (h->root.type == bfd_link_hash_indirect
                 || h->root.type == bfd_link_hash_warning)
            h = (struct elf_link_hash_entry *) h->root.u.i.link;

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list