Bug 214971 - clang + lld 3.9.1: Unhandled relocation 1031
Summary: clang + lld 3.9.1: Unhandled relocation 1031
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Many People
Assignee: freebsd-toolchain (Nobody)
Depends on:
Reported: 2016-12-01 02:20 UTC by Shawn Webb
Modified: 2017-04-26 17:08 UTC (History)
2 users (show)

See Also:
emaste: mfc-stable11?
emaste: mfc-stable10-
emaste: mfc-stable9-

Fix RTLD (1.06 KB, patch)
2016-12-19 19:09 UTC, Shawn Webb
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
Comment 2 Shawn Webb 2017-01-08 17:29:47 UTC
Comment 3 Ed Maste freebsd_committer 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 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

  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

Comment 5 Ed Maste freebsd_committer 2017-04-26 17:08:53 UTC
This has been merged to stable/11 now too