Bug 212249 - devel/binutils update breaks llvm3([567]|-cheri) builds
Summary: devel/binutils update breaks llvm3([567]|-cheri) builds
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Baptiste Daroussin
URL:
Keywords:
Depends on:
Blocks: 212212
  Show dependency treegraph
 
Reported: 2016-08-29 21:32 UTC by Brooks Davis
Modified: 2016-09-02 15:47 UTC (History)
7 users (show)

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


Attachments
bu.diff (602 bytes, patch)
2016-08-31 18:34 UTC, Antoine Brodin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brooks Davis freebsd_committer 2016-08-29 21:32:56 UTC
Even after removing the use of gold from i386, older llvm versions blow up in tbl-gen in various ways under 9.3, and in some reports 10.3.  Reverting to r416639 fixes 9.3 in my tests.
Comment 1 Brooks Davis freebsd_committer 2016-08-29 21:49:50 UTC
Here's an example build failure.  It looks like something is breaking LLVM's magic template based command line parser.

llvm[2]: ======= Finished Linking Release Executable llvm-tblgen (without symbols)
gmake[2]: Leaving directory '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/utils/TableGen'
gmake[1]: Leaving directory '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/utils'
gmake[1]: Entering directory '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/lib/IR'
llvm[1]: Building Intrinsics.gen.tmp from Intrinsics.td
llvm-tblgen: Unknown command line argument '-I'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3
.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/lib
/IR'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '-I'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3
.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/inc
lude'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '-I'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3
.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/inc
lude'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '-I'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3
.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/lib
/Target'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/inc
lude/llvm/IR/Intrinsics.td'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/Release/bin
/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '-o'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3
.6.2.src/Release/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/lib
/IR/Release/Intrinsics.gen.tmp'.  Try: '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/Release
/bin/llvm-tblgen -help'
llvm-tblgen: Unknown command line argument '-gen-intrinsic'.  Try: '/wrkdirs/usr/ports/devel/llvm36
/work/llvm-3.6.2.src/Release/bin/llvm-tblgen -help'
gmake[1]: *** [Makefile:24: /wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/lib/IR/Release/Intr
insics.gen.tmp] Error 1
gmake[1]: Leaving directory '/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/lib/IR'
gmake: *** [/wrkdirs/usr/ports/devel/llvm36/work/llvm-3.6.2.src/Makefile.rules:883: all] Error 1
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** [do-build] Error code 1

Stop in /usr/ports/devel/llvm36.
build of devel/llvm36 ended at Mon Aug 29 21:44:42 UTC 2016
build time: 00:01:07
!!! build failure encountered !!!
Comment 2 Baptiste Daroussin freebsd_committer 2016-08-30 20:59:36 UTC
Yeah I'm tracking it, but I really do not understand for how and wy llvm-tblgen is built linked, but the resulted binary is non usable...
Comment 3 Brooks Davis freebsd_committer 2016-08-30 21:30:54 UTC
I don't have any real idea what could have broken, but given that this is on the critical path to xorg-server, I think we need to revert the binutils changes until this can be resolved.

It's worth noting that LLVM's command line parsing is template based so linker bugs (or "fixes") could produce the sort of errors we're seeing.
Comment 4 Brooks Davis freebsd_committer 2016-08-30 22:13:15 UTC
From the latest pig-fallout mails, it looks like it's also breaking llvm35 and llvm-cheri.
Comment 5 Walter Schwarzenfeld freebsd_triage 2016-08-30 22:43:27 UTC
Also llvm38 with a little different error-message:
 [3/2402] Building Intrinsics.gen...
FAILED: include/llvm/IR/Intrinsics.gen.tmp 
cd /usr/ports/devel/llvm38/work/.build/include/llvm/IR && /usr/ports/devel/llvm38/work/.build/bin/llvm-tblgen -gen-intrinsic -I /usr/ports/devel/llvm38/work/llvm-3.8.1.src/include/llvm/IR -I /usr/ports/devel/llvm38/work/llvm-3.8.1.src/lib/Target -I /usr/ports/devel/llvm38/work/llvm-3.8.1.src/include /usr/ports/devel/llvm38/work/llvm-3.8.1.src/include/llvm/IR/Intrinsics.td -o /usr/ports/devel/llvm38/work/.build/include/llvm/IR/Intrinsics.gen.tmp
Assertion failed: (hasOptions() && "No options specified!"), function ParseCommandLineOptions, file /usr/ports/devel/llvm38/work/llvm-3.8.1.src/lib/Support/CommandLine.cpp, line 816.
[4/2402] Linking CXX static library lib/libLLVMSymbolize.a
ninja: build stopped: subcommand failed.


only llvm34 seems to build.
Comment 6 Baptiste Daroussin freebsd_committer 2016-08-31 07:34:35 UTC
further informations:

All C++ programs (even a simple hellowworld) segfaults when linked using binutils 2.27 on FreeBSD 9 (and only on FreeBSD 9)

I'm trying to figure in the history what happened. (something happened between 2.26 and 2.27)

Any help would be greatly appreciated :)
Comment 7 Antoine Brodin freebsd_committer 2016-08-31 18:34:03 UTC
Created attachment 174264 [details]
bu.diff

dim@ did a bissect and this seems to be caused by this commit:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=26e3a0c9ba4a8376fdf9f898637919d144d8b1d8

I'm testing the attached patch
Comment 8 Brooks Davis freebsd_committer 2016-08-31 20:30:36 UTC
The patch does seem to be sufficient to get llvm36 building again.
Comment 9 commit-hook freebsd_committer 2016-08-31 21:16:00 UTC
A commit references this bug:

Author: antoine
Date: Wed Aug 31 21:15:04 UTC 2016
New revision: 421193
URL: https://svnweb.freebsd.org/changeset/ports/421193

Log:
  Do not use .init_array/.fini_array sections on FreeBSD 9
  This should fix build failures of llvm37 and a few others

  PR:		212249
  With hat:	portmgr

Changes:
  head/devel/binutils/Makefile
Comment 10 Walter Schwarzenfeld freebsd_triage 2016-08-31 22:19:43 UTC
This does not work.
Also the patch in the link does not work patch rejected.
Comment 11 Walter Schwarzenfeld freebsd_triage 2016-08-31 22:43:36 UTC
Sorry, my error, overlooked something, seems ok.
Comment 12 Brooks Davis freebsd_committer 2016-09-02 15:47:06 UTC
r212249 resolved this issue.  Thanks antoine!