When using clang/lld 3.9.1 to build ports-mgmt/pkg on the RPI3, clang and/or lld generates relocation entries the FreeBSD RTLD doesn't know what to do with. Relocation 1031 is R_AARCH64_TLSDESC, which the RTLD supports for PLT-based relocations, but not non-PLT relocations (src/libexec/rtld-elf/aarch64/reloc.c:395).
Created attachment 178114 [details] Fix RTLD
Ping.
See also thread at https://lists.freebsd.org/pipermail/freebsd-arm/2017-January/015257.html
A commit references this bug: Author: andrew Date: Wed Jan 25 17:35:11 UTC 2017 New revision: 312764 URL: https://svnweb.freebsd.org/changeset/base/312764 Log: Pull the R_AARCH64_TLSDESC code out into a common function and use them in both the plt and non-plt case. This fixes an issue where libraries built with LLD can fail with "Unhandled relocation 1031" PR: 214971 Obtained from: 1 week Sponsored by: DARPA, AFRL Changes: head/libexec/rtld-elf/aarch64/reloc.c
This has been merged to stable/11 now too