Bug 235282 - devel/llvm80: fails to build with Clang 7 on armv6
Summary: devel/llvm80: fails to build with Clang 7 on armv6
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Only Me
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks: 230355
  Show dependency treegraph
 
Reported: 2019-01-28 17:07 UTC by Jan Beich
Modified: 2019-02-18 22:50 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brooks)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2019-01-28 17:07:31 UTC
/usr/local/bin/ld: BFD (GNU Binutils) 2.31.1 assertion fail elflink.c:2920
/usr/local/bin/ld: BFD (GNU Binutils) 2.31.1 assertion fail elflink.c:2920
c++: error: linker command failed with exit code 1 (use -v to see invocation)

http://beefy8.nyi.freebsd.org/data/head-armv6-default/p491221_s343459/logs/errors/llvm80-8.0.0.r1.log

/usr/local/bin/ld: BFD (GNU Binutils) 2.30 assertion fail elflink.c:2824
/usr/local/bin/ld: BFD (GNU Binutils) 2.30 assertion fail elflink.c:2824
c++: error: linker command failed with exit code 1 (use -v to see invocation)

https://ptpb.pw/nJAQ
Comment 1 Jan Beich freebsd_committer 2019-01-28 22:32:13 UTC
llvm80 builds fine with Clang 6.0.1 from 12.0 base system: https://ptpb.pw/v34W. I didn't try llvm60 because that'd be too slow with qemu-user-static.
Comment 2 Brooks Davis freebsd_committer 2019-01-28 23:00:21 UTC
Given it works with 6.0.1, this sounds like a 7.0.1 regression.
Comment 3 Dimitry Andric freebsd_committer 2019-01-30 11:53:47 UTC
The question is if it'll work with lld, though. I guess clang 8 uses something that BFD ld can't handle.
Comment 4 Ed Maste freebsd_committer 2019-01-30 15:19:01 UTC
Should this not (also?) be a devel/binutils bug? Even if exposed by the update to LLVM 8 it's detecting an internal inconsistency in BFD.
Comment 5 Jan Beich freebsd_committer 2019-01-31 05:50:14 UTC
(In reply to Dimitry Andric from comment #3)
LDFLAGS_armv6=-fuse-ld=lld does help: https://ptpb.pw/xbs6 . However, I've tried it only after upgrading my jail to clang800-import and testing that Clang 8 alone didn't help.
Comment 6 Jan Beich freebsd_committer 2019-01-31 12:46:12 UTC
11.2 armv6 doesn't need -fuse-ld=lld but also builds fine with it: https://ptpb.pw/8DNd
However, LLD 6 in 11.2 base spews
/usr/bin/ld.lld: warning: lld uses extended branch encoding, no object with architecture supporting feature detected.
/usr/bin/ld.lld: warning: lld may use movt/movw, no object with architecture supporting feature detected.
Comment 7 Ed Maste freebsd_committer 2019-01-31 14:20:14 UTC
(In reply to Jan Beich from comment #6)
lld 6 supports only armv7+
Comment 8 commit-hook freebsd_committer 2019-02-06 19:02:11 UTC
A commit references this bug:

Author: brooks
Date: Wed Feb  6 19:01:23 UTC 2019
New revision: 492319
URL: https://svnweb.freebsd.org/changeset/ports/492319

Log:
  Attempt to work around a problem with binutils not liking the armv6 code
  generated buy LLVM 7.

  PR:		235282

Changes:
  head/devel/llvm80/Makefile
Comment 9 Jan Beich freebsd_committer 2019-02-12 13:39:48 UTC
armv7 is also affected ( https://ptpb.pw/gAzw ) but wasn't previously ( https://ptpb.pw/PirA ). Probably, ports r451923 needs to be partially reverted: armv7 can use lld on all supported FreeBSD releases.
Comment 10 Brooks Davis freebsd_committer 2019-02-12 16:57:45 UTC
(In reply to Jan Beich from comment #9)

r451923 should have no effect on armv7 unless there is some completely absurd handling of LDFLAGS_${ARCH}.  All it does is conditionally set:

LDFLAGS_armv6=-fuse-ld=lld
Comment 11 Jan Beich freebsd_committer 2019-02-12 19:28:04 UTC
(In reply to Brooks Davis from comment #10)
LDFLAGS_armv6 was added by r492319 while I'm talking about r451923 which made armv7 use COMPILER_PATH=${LOCALBASE}/bin.
Comment 12 Brooks Davis freebsd_committer 2019-02-12 19:32:28 UTC
(In reply to Jan Beich from comment #11)
Ah, is the fix then to remove the:

|| ${ARCH} == "armv7"
Comment 13 Jan Beich freebsd_committer 2019-02-13 21:20:51 UTC
Correct. This can be done in all devel/llvm* ports.

12.0 armv7 (lld 6): 
- devel/llvm40: https://ptpb.pw/731b
- devel/llvm50: https://ptpb.pw/DYes
- devel/llvm60: https://ptpb.pw/PgCb
- devel/llvm70: https://ptpb.pw/0dRm
- devel/llvm80: https://ptpb.pw/xRX9

13.0 armv7 (lld 8):
- devel/llvm50: https://ptpb.pw/9P0t
- devel/llvm60: https://ptpb.pw/f14A
- devel/llvm70: https://ptpb.pw/X1gv
- devel/llvm80: https://ptpb.pw/mx5v
Comment 14 commit-hook freebsd_committer 2019-02-18 21:52:53 UTC
A commit references this bug:

Author: brooks
Date: Mon Feb 18 21:52:50 UTC 2019
New revision: 493328
URL: https://svnweb.freebsd.org/changeset/ports/493328

Log:
  Don't override the compiler on armv7.

  The base system compiler is now sufficent to build and link.

  No version bump.  While technically required for armv7, forcing everyone
  to rebuild for this minor change that doesn't effect actual use is not
  justifiable.

  PR:		235282
  Submitted by:	jbeich

Changes:
  head/devel/llvm40/Makefile
  head/devel/llvm50/Makefile
  head/devel/llvm60/Makefile
  head/devel/llvm70/Makefile
Comment 15 Brooks Davis freebsd_committer 2019-02-18 22:50:23 UTC
I believe this is now fixed.