New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 779130 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Blocking:
issue 779127



Sign in to add a comment

sys-boot/coreboot does not build with ld.gold as default linker for aarch64-cros-linux-gnu.

Project Member Reported by rahulchaudhry@chromium.org, Oct 27 2017

Issue description

See https://chromium-review.googlesource.com/#/c/chromiumos/chromite/+/740668/ and https://chromium-review.googlesource.com/#/c/chromiumos/overlays/chromiumos-overlay/+/740671/ for switching to ld.gold as default linker in the aarch64-cros-linux-gnu toolchain.

With this change, sys-boot/coreboot does not build:

kevin-release: https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/16729
elm-release: https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/16728

The build fails with these errors:
coreboot-0.0.1-r2314:   LD      /build/elm/tmp/portage/sys-boot/coreboot-0.0.1-r2314/work/coreboot-0.0.1/build/3rdparty/arm-trusted-firmware/bl31/bl31.elf
coreboot-0.0.1-r2314: /usr/x86_64-pc-linux-gnu/aarch64-cros-linux-gnu/binutils-bin/2.27.0/ld.gold.real: error: /build/elm/tmp/portage/sys-boot/coreboot-0.0.1-r2314/work/coreboot-0.0.1/build/3rdparty/arm-trusted-firmware/bl31/bl31.ld:27:13: syntax error, unexpected NEXT
coreboot-0.0.1-r2314: /usr/x86_64-pc-linux-gnu/aarch64-cros-linux-gnu/binutils-bin/2.27.0/ld.gold.real: fatal error: unable to parse script file /build/elm/tmp/portage/sys-boot/coreboot-0.0.1-r2314/work/coreboot-0.0.1/build/3rdparty/arm-trusted-firmware/bl31/bl31.ld
coreboot-0.0.1-r2314: make[1]: *** [Makefile:556: /build/elm/tmp/portage/sys-boot/coreboot-0.0.1-r2314/work/coreboot-0.0.1/build/3rdparty/arm-trusted-firmware/bl31/bl31.elf] Error 1
coreboot-0.0.1-r2314: make: *** [src/arch/arm64/Makefile.inc:176: build/bl31.elf] Error 2

 
Components: Infra

Comment 2 by mmoss@chromium.org, Jan 2 2018

Components: -Infra Infra>Client>ChromeOS
[It appears that a bunch of old cros issues bulk-added the "Infra" component recently, but they should probably be "Infra>Client>ChromeOS".]
Status: Archived (was: Untriaged)
Components: -Infra>Client>ChromeOS
Status: Available (was: Archived)
Owner: rahulchaudhry@chromium.org
Status: Assigned (was: Available)
Cc: jwer...@chromium.org
coreboot ebuild includes 3rdparty/arm-trusted-firmware, which contains the problematic linker script: bl31/bl31.ld.S

The problem is that this linker script uses the NEXT builtin function, which gold linker doesn't support.

We probably want to continue linking arm-trusted-firmware with the bfd linker.
It's a small patch to the Makefile that will do this for Chromium OS builds:

--- Makefile
+++ Makefile
@@ -119,9 +119,9 @@ export HOSTCC
 CC                     :=      ${CROSS_COMPILE}gcc
 CPP                    :=      ${CROSS_COMPILE}cpp
 AS                     :=      ${CROSS_COMPILE}gcc
 AR                     :=      ${CROSS_COMPILE}ar
-LD                     :=      ${CROSS_COMPILE}ld
+LD                     :=      ${CROSS_COMPILE}ld.bfd
 OC                     :=      ${CROSS_COMPILE}objcopy
 OD                     :=      ${CROSS_COMPILE}objdump
 NM                     :=      ${CROSS_COMPILE}nm
 PP                     :=      ${CROSS_COMPILE}gcc -E

If we decide to do this, I'm not sure where the change should go.

3rdparty/arm-trusted-firmware is cloned from ~/trunk/src/third_party/arm-trusted-firmware, which is cloned from https://chromium.googlesource.com/chromiumos/third_party/arm-trusted-firmware, which is a mirror of https://github.com/ARM-software/arm-trusted-firmware.
However, the mirroring updates seem to be paused right now. The "cros/upstream_mirror/master" branch is still syncing with master branch on github, but the "cros/master" branch is frozen since 2017-09-13.

If this change is not suitable for upstream, we can always apply it as a local patch in the coreboot ebuild.

Julius, can you suggest the proper way to handle this?
We want to make sure that coreboot continues building after we switch the default linker for arm64 to ld.gold.

Cc: rahulchaudhry@chromium.org
Owner: jwer...@chromium.org
Uprevving the cros branch is a manual process. We just do it whenever needed. But the cros branch still needs to be a direct mirror of upstream from a certain point and can not take local patches.

I can try to submit a patch upstream to detect and use ld.bfd if it exists, but they're not generally doing any fancy toolchain yet so I'm not sure if they'll take it. If not, we can try changing the make invocation from coreboot's build system to pass an explicit LD variable instead.
Uploaded a patch to https://github.com/ARM-software/arm-trusted-firmware/pull/1220, let's see what happens.
Ping! Any progress on the upstream pull request?

There was a bit of back and forth on the implementation details. I just uploaded another version, let's hope this one will get accepted.
Merged upstream. It'll take maybe a week or so for it to trickle from the integration branch back into master, then we can pull it.
Thanks for the follow up.
Please let us know when it has landed in Chromium OS.

Components: Tools>ChromeOS-Toolchain
Owner: rahulchaudhry@chromium.org
Okay, change has landed in Chromium OS, please try again!
Status: Fixed (was: Assigned)

Sign in to add a comment