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]
See also thread at https://lists.freebsd.org/pipermail/freebsd-arm/2017-January/015257.html
A commit references this bug:
Date: Wed Jan 25 17:35:11 UTC 2017
New revision: 312764
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"
Obtained from: 1 week
Sponsored by: DARPA, AFRL
This has been merged to stable/11 now too