From owner-freebsd-ppc@freebsd.org Fri Jan 6 09:20:40 2017 Return-Path: Delivered-To: freebsd-ppc@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 D5B27CA01EA for ; Fri, 6 Jan 2017 09:20:40 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-12.reflexion.net [208.70.210.12]) (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 8A535147B for ; Fri, 6 Jan 2017 09:20:39 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 13601 invoked from network); 6 Jan 2017 09:20:39 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 6 Jan 2017 09:20:39 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v8.20.0) with SMTP; Fri, 06 Jan 2017 04:20:53 -0500 (EST) Received: (qmail 17832 invoked from network); 6 Jan 2017 09:20:53 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 6 Jan 2017 09:20:53 -0000 Received: from [192.168.1.111] (c-67-170-167-181.hsd1.or.comcast.net [67.170.167.181]) by iron2.pdx.net (Postfix) with ESMTPSA id 24B99EC913D; Fri, 6 Jan 2017 01:20:38 -0800 (PST) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Bug 215819: clang 3.9.1 for TARGET_ARCH=powerpc64 generated R_PPC64_ADDR16_DS instead of R_PPC64_TOC16_DS with .toc; 0(register) addressing results and crashes the kernel Message-Id: Date: Fri, 6 Jan 2017 01:20:37 -0800 To: FreeBSD Toolchain , FreeBSD PowerPC ML X-Mailer: Apple Mail (2.3259) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2017 09:20:40 -0000 [As stands I've no clue if this is unique to FreeBSD's clang somehow vs. if it is a general llvm powerpc64 problem. This may need a llvm submittal as well.] I have submitted FreeBSD bugzilla entry: Bug 215819 - head r311147's clang 3.9.1 for powerpc64: locore.o = generation messed up: generates R_PPC64_ADDR16_DS instead of = R_PPC64_TOC16_DS with .toc=20 Using objdump on locore.o I see variations based on clang vs. = xtoolchain, including the below relative to .toc handling: (- -> clang , + -> xtoolchain) RELOCATION RECORDS FOR [.text]: OFFSET TYPE VALUE=20 . . . -0000000000000046 R_PPC64_ADDR16_DS .toc +0000000000000046 R_PPC64_TOC16_DS .toc . . . -0000000000000182 R_PPC64_ADDR16_DS .toc +0000000000000182 R_PPC64_TOC16_DS .toc . . . -0000000000000916 R_PPC64_ADDR16_DS .toc . . . +0000000000000916 R_PPC64_TOC16_DS .toc . . . (The above is based on objdump output differences.) In the boot code (/boot/kernel/kernel) these match up with. . . . . . <.__start+0x44> ld r1,0(r2) # 100160+46 clang vs. <.__start+0x44> ld r1,-32760(r2) # 100120+46 xtoolchain . . . ld r1,0(r2) # 100160+182 clang vs. ld r1,-32760(r2) # 100120+182 xtoolchain . . . ld r1,0(r1) # 100160+916 clang vs. ld r1,-32760(r1) # 100120+916 xtoolchain (Based on more objdump output comparisons.) clang's code does not boot; xtoolchain's code does. In both cases devel/powerpc64-binutils was used instead of bootstrapped binutils to produce the kernel.full file and the like (because of the bootstrapped ld having its own problems). But if locore.o should have used R_PPC64_TOC16_DS for clang 3.9.1 then that is an earlier problem. =3D=3D=3D Mark Millard markmi at dsl-only.net