Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2017 01:02:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [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
Message-ID:  <bug-221107-8-YcLbWhKGTL@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-221107-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-221107-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221107

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

/usr/src/contrib/binutils/bfd/elf32-ppc.c

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)

via:

      tls_type =3D 0;
      r_type =3D ELF32_R_TYPE (rel->r_info);
. . .=20=20=20=20=20=20=20=20=20=20=20=20=20=20
      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");
#endif
          /* 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 =3D=3D 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"),
                                     abfd,
                                     sec,
                                     (long) rel->r_offset,
                                     ppc_elf_howto_table[r_type]->name);
              bfd_set_error (bfd_error_bad_value);
              return FALSE;
            }
          else
            {
              bfd_vma addend =3D 0;

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

where the earlier code for finding the h value is:

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

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221107-8-YcLbWhKGTL>