From owner-freebsd-toolchain@freebsd.org Sat Jan 9 18:55:59 2016 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BF12A69163 for ; Sat, 9 Jan 2016 18:55:59 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 028DA1A95 for ; Sat, 9 Jan 2016 18:55:58 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound2.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Sat, 9 Jan 2016 18:56:30 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id u09Itoee004893; Sat, 9 Jan 2016 11:55:50 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1452365750.1523.9.camel@freebsd.org> Subject: Re: Bug 205663 Clang getting Bus Errors (arm SCLTR Bit[12]==1 context): Reported fixed on llvm's trunk From: Ian Lepore To: Dimitry Andric , Mark Millard Cc: freebsd-arm , FreeBSD Toolchain Date: Sat, 09 Jan 2016 11:55:50 -0700 In-Reply-To: <39774562-F76E-41E9-85E7-ABE257B013D6@FreeBSD.org> References: <1452020032.1320.21.camel@freebsd.org> <7EE8F65E-7485-4FA9-A136-F22090DB107F@FreeBSD.org> <92264003-CF0E-4624-A28A-8AFB7C663BFB@dsl-only.net> <39774562-F76E-41E9-85E7-ABE257B013D6@FreeBSD.org> Content-Type: multipart/mixed; boundary="=-l6GbdNs55QDkue5/IPHe" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2016 18:55:59 -0000 --=-l6GbdNs55QDkue5/IPHe Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Sat, 2016-01-09 at 15:03 +0100, Dimitry Andric wrote: > On 09 Jan 2016, at 04:46, Mark Millard wrote: > > > > On 2016-Jan-7, at 2:57 PM, Dimitry Andric > > wrote: > ... > > > FYI, I have added a -mno-movt option for this purpose upstream, > > > and > > > imported a newer snapshot into the clang380-import branch. As of > > > r293384, it now uses the new option spelling for modules, if your > > > clang > > > is 3.8.0 or higher. > > > > > > -Dimitry > > > > I've not been able to get to the point of running clang++ 3.8 on > > the rpi2 yet: R_ARM_CALL and R_ARM_JUMP24 relocation truncations > > during the cross build's buildworld interfere. > > Yes, this is caused by too large call distances. In other words, the > clang executable is getting to big to link. Apparently we need to do > some tricks with -mlongcall to fix this. As I am no arm expert, I > welcome any patch submissions. :-) > > -Dimitry > Here's the patch I got from Andy for the clang380 branch, modified with Warner's suggestion to use MACHINE_CPUARCH instead of MACHINE. With this I can get a working arm world that will build a runnable helloworld.c (and .cc) on a dreamplug. (I.e., it appears clang 3.8.0 fixes the problem we had with clang 3.7.x where it wouldn't run at all on armv4/5 systems). I have not tried compling anything complex yet. -- Ian --=-l6GbdNs55QDkue5/IPHe Content-Disposition: inline; filename="arm_clang_longcall.diff" Content-Type: text/x-patch; name="arm_clang_longcall.diff"; charset="us-ascii" Content-Transfer-Encoding: 7bit Index: lib/clang/clang.lib.mk =================================================================== --- lib/clang/clang.lib.mk (revision 293584) +++ lib/clang/clang.lib.mk (working copy) @@ -6,4 +6,8 @@ LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm INTERNALLIB= +.if ${MACHINE_CPUARCH} == "arm" +STATIC_CXXFLAGS+=-mlong-calls +.endif + .include Index: lib/csu/arm/Makefile =================================================================== --- lib/csu/arm/Makefile (revision 293584) +++ lib/csu/arm/Makefile (working copy) @@ -23,7 +23,7 @@ CLEANFILES+= crt1.s gcrt1.s Scrt1.s # directly compiled to .o files. crt1.s: crt1.c - ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c + ${CC} ${CFLAGS} -mlong-calls -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} crt1.o: crt1.s @@ -30,7 +30,7 @@ crt1.o: crt1.s ${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s gcrt1.s: crt1.c - ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c + ${CC} ${CFLAGS} -mlong-calls -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} gcrt1.o: gcrt1.s Index: usr.bin/clang/clang/Makefile =================================================================== --- usr.bin/clang/clang/Makefile (revision 293584) +++ usr.bin/clang/clang/Makefile (working copy) @@ -11,7 +11,11 @@ SRCS= cc1_main.cpp \ .if ${MK_SHARED_TOOLCHAIN} == "no" NO_SHARED?= yes + +.if ${MACHINE_CPUARCH} == "arm" +CFLAGS+=-mlong-calls .endif +.endif LINKS= ${BINDIR}/clang ${BINDIR}/clang++ \ ${BINDIR}/clang ${BINDIR}/clang-cpp --=-l6GbdNs55QDkue5/IPHe--