Bug 201762

Summary: misc/talkfilters crashes clang when building for AARCH64 (fixup value out of range)
Product: Ports & Packages Reporter: Sean Bruno <sbruno>
Component: Individual Port(s)Assignee: Andrew Turner <Andrew>
Status: Closed FIXED    
Severity: Affects Some People CC: Andrew, dim, ehaupt, emaste
Priority: --- Flags: bugzilla: maintainer-feedback? (ehaupt)
Version: Latest   
Hardware: arm64   
OS: Any   
URL: https://llvm.org/bugs/show_bug.cgi?id=24234
Bug Depends on:    
Bug Blocks: 201763    
Attachments:
Description Flags
.c and .sh output files from clang crashes. none

Description Sean Bruno freebsd_committer 2015-07-22 15:33:06 UTC
Created attachment 159067 [details]
.c and .sh output files from clang crashes.

fatal error: error in backend: fixup value out of range
cc: error: clang frontend command failed with exit code 70 (use -v to see invocation)
FreeBSD clang version 3.6.1 (tags/RELEASE_361/final 237755) 20150525
Target: aarch64-unknown-freebsd11.0
Thread model: posix
cc: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
cc: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
cc: note: diagnostic msg: /tmp/cockney-d900cb.c
cc: note: diagnostic msg: /tmp/cockney-d900cb.sh
cc: note: diagnostic msg: 

********************
*** [libtalkfilters_la-cockney.lo] Error code 1

make[2]: stopped in /wrkdirs/usr/ports/misc/talkfilters/work/talkfilters-2.3.8
--- b1ff ---
/nxb-bin/usr/bin/cc -O2 -pipe -fno-strict-aliasing -o b1ff b1ff.o common.o getopt.o getopt1.o   
--- austro ---
/nxb-bin/usr/bin/cc -O2 -pipe -fno-strict-aliasing -o austro austro.o common.o getopt.o getopt1.o   
--- fudd ---
/nxb-bin/usr/bin/cc -O2 -pipe -fno-strict-aliasing -o fudd fudd.o common.o getopt.o getopt1.o   
--- brooklyn ---
/nxb-bin/usr/bin/cc -O2 -pipe -fno-strict-aliasing -o brooklyn brooklyn.o common.o getopt.o getopt1.o   
--- libtalkfilters_la-funetak.lo ---
mv -f .deps/libtalkfilters_la-funetak.Tpo .deps/libtalkfilters_la-funetak.Plo
--- libtalkfilters_la-valspeak.lo ---
mv -f .deps/libtalkfilters_la-valspeak.Tpo .deps/libtalkfilters_la-valspeak.Plo
--- jive.o ---
mv -f .deps/jive.Tpo .deps/jive.Po
--- libtalkfilters_la-pirate.lo ---
--- libtalkfilters_la-jive.lo ---
fatal error: error in backend: fixup value out of range
cc: error: clang frontend command failed with exit code 70 (use -v to see invocation)
FreeBSD clang version 3.6.1 (tags/RELEASE_361/final 237755) 20150525
Target: aarch64-unknown-freebsd11.0
Thread model: posix
cc: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
cc: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
cc: note: diagnostic msg: /tmp/jive-37f4e8.c
cc: note: diagnostic msg: /tmp/jive-37f4e8.sh
cc: note: diagnostic msg: 

********************
*** [libtalkfilters_la-jive.lo] Error code 1

make[2]: stopped in /wrkdirs/usr/ports/misc/talkfilters/work/talkfilters-2.3.8
--- drawl.o ---
mv -f .deps/drawl.Tpo .deps/drawl.Po
--- libtalkfilters_la-drawl.lo ---
 /nxb-bin/usr/bin/cc -DHAVE_CONFIG_H -I. -DLIBRARY_MODE -O2 -pipe -fno-strict-aliasing -MT libtalkfilters_la-drawl.lo -MD -MP -MF .deps/libtalkfilters_la-drawl.Tpo -c drawl.c -o libtalkfilters_la-drawl.o >/dev/null 2>&1
--- libtalkfilters_la-redneck.lo ---
fatal error: error in backend: fixup value out of range
cc: error: clang frontend command failed with exit code 70 (use -v to see invocation)
FreeBSD clang version 3.6.1 (tags/RELEASE_361/final 237755) 20150525
Target: aarch64-unknown-freebsd11.0
Thread model: posix
cc: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
cc: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
cc: note: diagnostic msg: /tmp/redneck-19bdee.c
cc: note: diagnostic msg: /tmp/redneck-19bdee.sh
cc: note: diagnostic msg: 

********************
*** [libtalkfilters_la-redneck.lo] Error code 1

make[2]: stopped in /wrkdirs/usr/ports/misc/talkfilters/work/talkfilters-2.3.8
--- redneck.o ---
mv -f .deps/redneck.Tpo .deps/redneck.Po
--- libtalkfilters_la-drawl.lo ---
mv -f .deps/libtalkfilters_la-drawl.Tpo .deps/libtalkfilters_la-drawl.Plo
3 errors

make[2]: stopped in /wrkdirs/usr/ports/misc/talkfilters/work/talkfilters-2.3.8
*** [all] Error code 2

make[1]: stopped in /wrkdirs/usr/ports/misc/talkfilters/work/talkfilters-2.3.8
1 error

make[1]: stopped in /wrkdirs/usr/ports/misc/talkfilters/work/talkfilters-2.3.8
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/misc/talkfilters
Comment 1 Ed Maste freebsd_committer 2015-07-23 19:17:17 UTC
Reported upstream here: https://llvm.org/bugs/show_bug.cgi?id=24234
Comment 2 Emanuel Haupt freebsd_committer 2016-03-28 10:18:23 UTC
Unfortunately I don't have the possibility to test this but would adding 

CFLAGS_aarch64=	-O0

to the Makefile mitigate the problem?
Comment 3 Andrew Turner freebsd_committer 2016-09-01 17:32:50 UTC
The upstream issue is reported to be fixed with https://reviews.llvm.org/rL277331.
Comment 4 commit-hook freebsd_committer 2016-09-01 18:12:39 UTC
A commit references this bug:

Author: dim
Date: Thu Sep  1 18:11:44 UTC 2016
New revision: 305218
URL: https://svnweb.freebsd.org/changeset/base/305218

Log:
  Pull in r277331 from upstream llvm trunk (by Diana Picus):

    [AArch64] Return the correct size for TLSDESC_CALLSEQ

    The branch relaxation pass is computing the wrong offsets because it assumes
    TLSDESC_CALLSEQ eats up 4 bytes, when in fact it is lowered to an instruction
    sequence taking up 16 bytes. This can become a problem in huge files with lots
    of TLS accesses, as it may slowly move branch targets out of the range computed
    by the branch relaxation pass.

    Fixes PR24234 https://llvm.org/bugs/show_bug.cgi?id=24234

    Differential Revision: https://reviews.llvm.org/D22870

  This fixes "error in backend: fixup value out of range" when compiling
  the misc/talkfilters port for AArch64.

  Reported by:	sbruno
  PR:		201762
  MFC after:	3 days

Changes:
  head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
Comment 5 Dimitry Andric freebsd_committer 2016-09-01 18:17:47 UTC
(In reply to commit-hook from comment #4)
> URL: https://svnweb.freebsd.org/changeset/base/305218
> 
> Log:
>   Pull in r277331 from upstream llvm trunk (by Diana Picus):

I intend to merge this to stable/11, and I already merged it to the clang390-import branch.
Comment 6 Andrew Turner freebsd_committer 2016-09-02 15:27:41 UTC
This is fixed in in head with r305218
Comment 7 commit-hook freebsd_committer 2016-09-07 18:16:16 UTC
A commit references this bug:

Author: dim
Date: Wed Sep  7 18:16:06 UTC 2016
New revision: 305550
URL: https://svnweb.freebsd.org/changeset/base/305550

Log:
  MFC r305218:

  Pull in r277331 from upstream llvm trunk (by Diana Picus):

    [AArch64] Return the correct size for TLSDESC_CALLSEQ

    The branch relaxation pass is computing the wrong offsets because it assumes
    TLSDESC_CALLSEQ eats up 4 bytes, when in fact it is lowered to an instruction
    sequence taking up 16 bytes. This can become a problem in huge files with lots
    of TLS accesses, as it may slowly move branch targets out of the range computed
    by the branch relaxation pass.

    Fixes PR24234 https://llvm.org/bugs/show_bug.cgi?id=24234

    Differential Revision: https://reviews.llvm.org/D22870

  This fixes "error in backend: fixup value out of range" when compiling
  the misc/talkfilters port for AArch64.

  Reported by:	sbruno
  PR:		201762

Changes:
_U  stable/11/
  stable/11/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
Comment 8 Dimitry Andric freebsd_committer 2016-09-07 18:17:24 UTC
Fixed in head (r305218) and stable/11 (r305550).