Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Apr 2017 16:38:31 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        tech-lists <tech-lists@zyxst.net>
Cc:        freebsd-toolchain@freebsd.org
Subject:   Re: clang/lld 4.0.0 arm64 link failure in sys/boot/efi/boot1 on arm64
Message-ID:  <3E6F5B1D-CA52-474B-AAB5-F90A51F4292E@dsl-only.net>
In-Reply-To: <eb0cd2cf-460a-b6d3-5c68-0f548f7e6c33@zyxst.net>
References:  <eb0cd2cf-460a-b6d3-5c68-0f548f7e6c33@zyxst.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2017-Apr-30, at 3:47 PM, tech-lists <tech-lists at zyxst.net> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E6F5B1D-CA52-474B-AAB5-F90A51F4292E>