Bug 214971

Summary: clang + lld 3.9.1: Unhandled relocation 1031
Product: Base System Reporter: Shawn Webb <shawn.webb>
Component: binAssignee: freebsd-toolchain (Nobody) <toolchain>
Status: Closed FIXED    
Severity: Affects Many People CC: Andrew, emaste
Priority: --- Flags: emaste: mfc-stable11?
emaste: mfc-stable10-
emaste: mfc-stable9-
Version: CURRENT   
Hardware: arm64   
OS: Any   
Attachments:
Description Flags
Fix RTLD none

Description Shawn Webb 2016-12-01 02:20:49 UTC
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).
Comment 1 Shawn Webb 2016-12-19 19:09:06 UTC
Created attachment 178114 [details]
Fix RTLD
Comment 2 Shawn Webb 2017-01-08 17:29:47 UTC
Ping.
Comment 3 Ed Maste freebsd_committer freebsd_triage 2017-01-22 03:51:50 UTC
See also thread at https://lists.freebsd.org/pipermail/freebsd-arm/2017-January/015257.html
Comment 4 commit-hook freebsd_committer freebsd_triage 2017-01-25 17:36:18 UTC
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
Comment 5 Ed Maste freebsd_committer freebsd_triage 2017-04-26 17:08:53 UTC
This has been merged to stable/11 now too