devel/binutils at powerpc64 ( powerpc64-unknown-freebsd13.0-ld ) unbounded loop in bfd/elf64-ppc.c : the source code and values

Mark Millard marklmi at yahoo.com
Mon Dec 30 18:13:45 UTC 2019


I ran into the following ubounded loop
(via the continue) in bfd/elf64-ppc.c
while trying to do a
devel/freebsd-gcc9 at powerpc64 based
buildworld buildkernel :

            /* Read the relocations.  */
            relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL,
                                                  info->keep_memory);
            if (relstart == NULL)
              return FALSE;

            relend = relstart + sec->reloc_count;
            for (rel = relstart; rel < relend; )
              {
                enum elf_ppc64_reloc_type r_type;
                unsigned long r_symndx;
                asection *sym_sec;
                struct elf_link_hash_entry *h;
                Elf_Internal_Sym *sym;
                unsigned char *tls_maskp;

                r_type = ELF64_R_TYPE (rel->r_info);
                if (r_type != R_PPC64_PLTCALL
                    && r_type != R_PPC64_PLTCALL_NOTOC)
                  continue;

Nothing is done before the continue to make rel
progress towards relend (or relend towards
relstart). It just repeats the same activity
over and over on the same rel value.

This was in:

devel/binutils/work-powerpc64/binutils-2.33.1/bfd/elf64-ppc.c

The 1st line quoted above was line 7455 according to vi.

Ref reference, both of the stuck links (clang.full and
lld.full) have:

(gdb) print r_type
$1 = R_PPC64_REL16_HA
(gdb) print/x *rel
$3 = {r_offset = 0x2, r_info = 0x18000000fc, r_addend = 0x2}


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-ports mailing list