From owner-freebsd-toolchain@freebsd.org Sun Apr 30 23:38:35 2017 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 8A874D57382 for ; Sun, 30 Apr 2017 23:38:35 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-51.reflexion.net [208.70.210.51]) (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 3F53A171B for ; Sun, 30 Apr 2017 23:38:34 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 27465 invoked from network); 30 Apr 2017 23:38:33 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 30 Apr 2017 23:38:33 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v8.40.0) with SMTP; Sun, 30 Apr 2017 19:38:33 -0400 (EDT) Received: (qmail 12479 invoked from network); 30 Apr 2017 23:38:33 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 30 Apr 2017 23:38:33 -0000 Received: from [192.168.1.106] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 60EB7EC7D48; Sun, 30 Apr 2017 16:38:32 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: clang/lld 4.0.0 arm64 link failure in sys/boot/efi/boot1 on arm64 From: Mark Millard In-Reply-To: Date: Sun, 30 Apr 2017 16:38:31 -0700 Cc: freebsd-toolchain@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <3E6F5B1D-CA52-474B-AAB5-F90A51F4292E@dsl-only.net> References: To: tech-lists X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 23:38:35 -0000 On 2017-Apr-30, at 3:47 PM, tech-lists wrote: > hi toolchain@, >=20 > I'm trying to buildworld on a raspberrypi3 HardenedBSD-12 context. >=20 > FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on > LLVM 4.0.0) > Target: aarch64-unknown-freebsd12.0 > Thread model: posix > InstalledDir: /usr/bin >=20 > LLVM (http://llvm.org/): > LLVM version 4.0.0 > Optimized build. > Default target: aarch64-unknown-freebsd12.0 > Host CPU: (unknown) >=20 > It's failing in sys/boot/efi/boot1 with this sort of error: >=20 > /ldscript.arm64 -Wl,-Bsymbolic -shared -nostdlib -Wl,-z,relro = -Wl,-z,now > -o boot1.sym.full boot1.o self_reloc.o start.o ufs_module.o -lstand > /usr/bin/ld: error: /hd0/src/lib/libstand/printf.c:(.rodata+0x0): = can't > create dynamic relocation R_AARCH64_ABS64 against local symbol in > readonly segment defined in /usr/lib/libstand.a(printf.o) > /usr/bin/ld: error: /hd0/src/lib/libstand/printf.c:(.rodata+0x8): = can't > create dynamic relocation R_AARCH64_ABS64 against local symbol in > readonly segment defined in /usr/lib/libstand.a(printf.o) >=20 > I've refreshed to very latest sources but get the same error. Full > output is here: >=20 > = http://www.zyxst.net/~bofh/rpi3/2017-04-29.buildworldfail.hbsd12-aarch64.t= xt Your toolchain configuration is using: -Wl,-z,relro (Its use is shown in 2017-04-29.buildworldfail.hbsd12-aarch64.txt .) See later below for more notes about that. But I'll also note that 2017-04-29.buildworldfail.hbsd12-aarch64.txt shows: cc: error: unable to execute command: Segmentation fault (core dumped) cc: error: linker command failed due to signal (use -v to see = invocation) *** Error code 254 not just what you report above. > I note that a very similar error involving a different efi directory = was > reported back in January: >=20 > = http://freebsd.1045724.x6.nabble.com/clang-lld-4-0-0-arm64-link-failure-in= -sys-boot-efi-loader-td6161866.html This old issue was caused (at least in part) by use of a toolchain configured to use: -Wl,-z,relro . relro puts more stuff in read-only areas, such as .rodata . Being in such areas limits what can be done and overall the tool chain may not be set up fully for respecting/handling that. > ...but no resolution/fix. Is there anything I can do? Use of -Wl,-z,relro is experimental at this point as I understand, in part because of such potential issues. Avoiding -Wl,-z,relro likely is necessary but may not be sufficient for your builds to complete. =3D=3D=3D Mark Millard markmi at dsl-only.net