Skip to contentSkip to conversation

arm/hafnium: fix kernel tool linking

PATCH New Ross Burton 1 participant 1 message Nov 10, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/hafnium: fix kernel tool linking

We need to be sure that the host linker flags are passed to the kernel build, as otherwise it is possible that binaries are incorrectly linked. For example:

HOSTCC scripts/extract-cert
ld: .../recipe-sysroot-native/usr/lib/pkgconfig/../../../usr/lib/libcrypto.so: undefined reference to `pthread_once@GLIBC_2.34'

---
 .../recipes-bsp/hafnium/hafnium/host-ld.patch | 21 +++++++++++++++++++
 meta-arm/recipes-bsp/hafnium/hafnium_2.5.bb   |  1 +
 2 files changed, 22 insertions(+)
 create mode 100644 meta-arm/recipes-bsp/hafnium/hafnium/host-ld.patch
meta-arm/recipes-bsp/hafnium/hafnium/host-ld.patch new file +21 -0
new file mode 100644
index 00000000..8e7fee25
@@ -0,0 +1,21 @@
+We need to be sure that the host linker flags are passed to the kernel build,
+as otherwise it is possible that binaries are incorrectly linked. For example:
+
+HOSTCC scripts/extract-cert
+ld: .../recipe-sysroot-native/usr/lib/pkgconfig/../../../usr/lib/libcrypto.so: undefined reference to `pthread_once@GLIBC_2.34'
+
+Upstream-Status: Inappropriate
+Signed-off-by: Ross Burton <[email protected]>
+
+diff --git a/build/linux/linux.gni b/build/linux/linux.gni
+index 65cc9df..19adbfb 100644
+--- a/build/linux/linux.gni
++++ b/build/linux/linux.gni
+@@ -69,6 +70,7 @@ template("linux_kernel") {
+     "GCC_TOOLCHAIN_DIR=" + rebase_path("//prebuilts/linux-x64/gcc/bin"),
+     "ARCH=arm64",
+     "CROSS_COMPILE=aarch64-linux-gnu-",
++    "HOSTLDFLAGS=" + getenv("BUILD_LDFLAGS"),
+ 
+     # Build out-of-tree in `target_out_dir`.
+     "O=" + rebase_path(target_out_dir),
meta-arm/recipes-bsp/hafnium/hafnium_2.5.bb +1 -0
index dc248e48..fe24a904 100644
@@ -11,6 +11,7 @@ inherit deploy python3native pkgconfig
 
 SRC_URI = "gitsm://git.trustedfirmware.org/hafnium/hafnium.git;protocol=https \
            file://hashbang.patch \
+           file://host-ld.patch \
            file://pkg-config-native.patch \
            file://native-dtc.patch"
 SRCREV = "3a149eb219467c0d9336467ea1fb9d3fb65da94b"
Signature · 1 line
2.25.1