Bug 237692 - lld: linking fails on aarch64 with 'Should not have claimed to be relaxable'
Summary: lld: linking fails on aarch64 with 'Should not have claimed to be relaxable'
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-01 15:24 UTC by mikael.urankar
Modified: 2019-05-03 14:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mikael.urankar 2019-05-01 15:24:28 UTC
I'm seeing the following issue when trying to link some lang/go executables on aarch64:

Should not have claimed to be relaxable
UNREACHABLE executed at /usr/src/contrib/llvm/tools/lld/ELF/Target.cpp:176!
cc: error: unable to execute command: Abort trap (core dumped)
cc: error: linker command failed due to signal (use -v to see invocation)

It seems to only be an issue with ld.lld from base/13-current. It works fine with lld from devel/llvm* and surprisingly it also works with ld.lld from base/12-stable.

If someone wants to look into it, I put a tarball and a build script to reproduce the issue:
http://mikael.urankar.free.fr/FreeBSD/go/go_lld_bug.tar.gz

see also:
https://github.com/golang/go/issues/24715#issuecomment-487195099
Comment 1 Ed Maste freebsd_committer 2019-05-02 13:20:09 UTC
Would you add lld --version info from the working/non-working cases? Most likely this will become an upstream lld bug report.
Comment 2 mikael.urankar 2019-05-02 14:18:38 UTC
Here are the results:

ld.lld from ports:
/usr/local/bin/ld.lld60 --version
LLD 6.0.1 (compatible with GNU linkers)

/usr/local/bin/ld.lld70 --version
LLD 7.0.1 (compatible with GNU linkers)

/usr/local/bin/ld.lld80 --version
LLD 8.0.0 (compatible with GNU linkers)


ld.lld from base:
12.0-release
ld.lld --version
LLD 6.0.1 (FreeBSD 335540-1200005) (compatible with GNU linkers)

12-stable (from a few days ago, for FreeBSD 12.0 (1200507))
ld.lld -version
LLD 8.0.0 (FreeBSD 356365-1200007) (compatible with GNU linkers)

13-current (from a few days ago, for FreeBSD 13.0 (1300021))
ld.lld --version
LLD 8.0.0 (FreeBSD 356365-1300003) (compatible with GNU linkers)

The only failure is with ld.lld from base/13-current.
Comment 3 mikael.urankar 2019-05-03 14:04:15 UTC
(In reply to mikael.urankar from comment #2)
It seems to be a problem with debug build of clang/lld, it works on head with this (ie, same as the release or stable branch):

Index: lib/clang/llvm.build.mk
===================================================================
--- lib/clang/llvm.build.mk     (revision 345171)
+++ lib/clang/llvm.build.mk     (working copy)
@@ -17,7 +17,7 @@
 CFLAGS+=       -DLLVM_BUILD_GLOBAL_ISEL
 CFLAGS+=       -D__STDC_LIMIT_MACROS
 CFLAGS+=       -D__STDC_CONSTANT_MACROS
-#CFLAGS+=      -DNDEBUG
+CFLAGS+=       -DNDEBUG
 
 TARGET_ARCH?=  ${MACHINE_ARCH}
 BUILD_ARCH?=   ${MACHINE_ARCH}