So lld generates .gnu.hash sections that our ancient binutils doesn't grok. With the diff below (taken from FreeBSD's binutils, so GPLv2) fixes this.
ok? Index: gnu/usr.bin/binutils-2.17/bfd/elf.c =================================================================== RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/bfd/elf.c,v retrieving revision 1.12 diff -u -p -r1.12 elf.c --- gnu/usr.bin/binutils-2.17/bfd/elf.c 10 Aug 2016 20:46:08 -0000 1.12 +++ gnu/usr.bin/binutils-2.17/bfd/elf.c 24 Apr 2018 18:41:12 -0000 @@ -1825,6 +1825,7 @@ bfd_section_from_shdr (bfd *abfd, unsign case SHT_FINI_ARRAY: /* .fini_array section. */ case SHT_PREINIT_ARRAY: /* .preinit_array section. */ case SHT_GNU_LIBLIST: /* .gnu.liblist section. */ + case SHT_GNU_HASH: /* .gnu.hash section. */ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); case SHT_DYNAMIC: /* Dynamic linking information. */ @@ -2264,6 +2265,7 @@ static const struct bfd_elf_special_sect { ".gnu.version_r", 14, 0, SHT_GNU_verneed, 0 }, { ".gnu.liblist", 12, 0, SHT_GNU_LIBLIST, SHF_ALLOC }, { ".gnu.conflict", 13, 0, SHT_RELA, SHF_ALLOC }, + { ".gnu.hash", 9, 0, SHT_GNU_HASH, SHF_ALLOC }, { NULL, 0, 0, 0, 0 } }; @@ -2785,6 +2787,10 @@ elf_fake_sections (bfd *abfd, asection * case SHT_GROUP: this_hdr->sh_entsize = 4; break; + + case SHT_GNU_HASH: + this_hdr->sh_entsize = bed->s->arch_size == 64 ? 0 : 4; + break; } if ((asect->flags & SEC_ALLOC) != 0) @@ -3230,6 +3236,7 @@ assign_section_numbers (bfd *abfd, struc break; case SHT_HASH: + case SHT_GNU_HASH: case SHT_GNU_versym: /* sh_link is the section header index of the symbol table this hash table or version table is for. */ Index: gnu/usr.bin/binutils-2.17/include/elf/common.h =================================================================== RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/include/elf/common.h,v retrieving revision 1.7 diff -u -p -r1.7 common.h --- gnu/usr.bin/binutils-2.17/include/elf/common.h 25 Jan 2017 08:56:08 -0000 1.7 +++ gnu/usr.bin/binutils-2.17/include/elf/common.h 24 Apr 2018 18:41:12 -0000 @@ -343,6 +343,7 @@ #define SHT_LOOS 0x60000000 /* First of OS specific semantics */ #define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */ +#define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */ #define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */ /* The next three section types are defined by Solaris, and are named