Fix u-boot build
This commit is contained in:
parent
2e6c2c605c
commit
5fca53a252
2 changed files with 57 additions and 2 deletions
|
@ -5,13 +5,16 @@ pkgname=u-boot-rm
|
|||
pkgver=2016.05
|
||||
_gittag=97b35fdddf0077abd2e0f0409b94ef20adbe8565
|
||||
pkgrel=0
|
||||
|
||||
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
|
||||
|
||||
pkgdesc="u-boot bootloader common files"
|
||||
url="http://www.denx.de/wiki/U-Boot/"
|
||||
arch="armv7"
|
||||
license="GPL2"
|
||||
depends=""
|
||||
depends_dev=""
|
||||
makedepends="$depends_dev bc dtc"
|
||||
makedepends="$depends_dev bc dtc gcc$_cross"
|
||||
install=""
|
||||
source="https://github.com/reMarkable/uboot/archive/$_gittag.tar.gz
|
||||
README.txt
|
||||
|
@ -37,7 +40,7 @@ build() {
|
|||
touch include/config.h
|
||||
LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
|
||||
LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h
|
||||
|
||||
|
||||
local board_config board
|
||||
for board_config in $board_configs; do
|
||||
local configs="${board_config#*:}"
|
||||
|
|
52
user/u-boot-rm/fix-linking-with-ld.patch
Normal file
52
user/u-boot-rm/fix-linking-with-ld.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
From 58772283210e15f8d803db4aa67c877d668db867 Mon Sep 17 00:00:00 2001
|
||||
Patch-Source: https://github.com/u-boot/u-boot/commit/58772283210e15f8d803db4aa67c877d668db867
|
||||
From: Alistair Delva <adelva@google.com>
|
||||
Date: Wed, 20 Oct 2021 21:31:33 +0000
|
||||
Subject: [PATCH] x86: Fix linking u-boot with ld.lld
|
||||
|
||||
When linking the final u-boot binary with LLD, the following link errors
|
||||
are seen:
|
||||
|
||||
ld.lld: error: can't create dynamic relocation R_386_32 against local
|
||||
symbol in readonly segment; recompile object files with
|
||||
-fPIC or pass '-Wl,-z,notext' to allow text relocations
|
||||
in the output
|
||||
>>> defined in arch/x86/cpu/start.o
|
||||
>>> referenced by arch/x86/cpu/start.o:(.text.start+0x32)
|
||||
[...]
|
||||
>>> defined in arch/x86/cpu/start16.o
|
||||
>>> referenced by arch/x86/cpu/start16.o:(.start16+0x1C)
|
||||
|
||||
According to Nick Desaulniers:
|
||||
|
||||
"This is a known difference between GNU and LLVM linkers; the GNU
|
||||
linkers permit relocations in readonly segments (making them not read
|
||||
only), LLVM does not (by default)."
|
||||
|
||||
Since U-Boot apparently seems to use relocations in readonly segments,
|
||||
change the global linker flags to permit them when linking with LLD by
|
||||
specifying '-z notext'.
|
||||
|
||||
Signed-off-by: Alistair Delva <adelva@google.com>
|
||||
Cc: Nick Desaulniers <ndesaulniers@google.com>
|
||||
Cc: Simon Glass <sjg@chromium.org>
|
||||
Cc: Bin Meng <bmeng.cn@gmail.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
---
|
||||
Makefile | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index c0ea933cb636..286757986c02 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -776,6 +776,9 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),)
|
||||
LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
|
||||
endif
|
||||
|
||||
+# ld.lld support
|
||||
+LDFLAGS_u-boot += -z notext
|
||||
+
|
||||
# Normally we fill empty space with 0xff
|
||||
quiet_cmd_objcopy = OBJCOPY $@
|
||||
cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \
|
Loading…
Reference in a new issue