Source: optee-os
Version: 4.2.0-3
Severity: wishlist
Tags: patch

Hi,

While automatically importing and building optee-os in Ubuntu with the
default dpkg-buildflags there, it failed to build when using:
LDFLAGS=-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto 
-Wl,-z,relro

LDFLAGS from dpkg-buildflags are typically prefixed with -Wl, but
optee_os calls ld directly, in which case -Wl, won't be accepted; also,
ld's -f flags may not be used without -shared but optee_os is built as
-pie.

I'm attaching a patch to strip -Wl, from flags from LDFLAGS and filter
out the -f flags altogether.

(BTW nice, short and sweet Make usage in your debian/rules!)

Best,
- Loïc Minier
diff -Nru optee-os-4.2.0/debian/changelog optee-os-4.2.0/debian/changelog
--- optee-os-4.2.0/debian/changelog	2024-04-30 15:07:30.000000000 +0000
+++ optee-os-4.2.0/debian/changelog	2024-06-09 17:41:04.000000000 +0000
@@ -1,3 +1,10 @@
+optee-os (4.2.0-3ubuntu1) oracular; urgency=medium
+
+  * Strip -Wl, from LDFLAGS as optee_os calls ld directly.
+  * Remove -f flags from LDFLAGS as optee_os is built as -pie.
+
+ -- Loïc Minier <loic.min...@ubuntu.com>  Sun, 09 Jun 2024 17:41:04 +0000
+
 optee-os (4.2.0-3) unstable; urgency=medium
 
   * Upload to unstable
diff -Nru optee-os-4.2.0/debian/rules optee-os-4.2.0/debian/rules
--- optee-os-4.2.0/debian/rules	2024-04-30 15:07:30.000000000 +0000
+++ optee-os-4.2.0/debian/rules	2024-06-09 17:41:04.000000000 +0000
@@ -27,10 +27,13 @@
 	$(eval platform := $(1))
 	$(eval debug := $(if $(2), $(2), 0))
 	$(eval subplatforms := $(if $($(platform)_subplatforms), $($(platform)_subplatforms), $(platform)))
+	# LDFLAGS from dpkg-buildflags are prefixed with -Wl, but optee_os
+	# calls ld directly; also, -f flags may not be used without -shared but
+	# optee_os is built as -pie
 	$(foreach subplatform, $(subplatforms), \
 		CROSS_COMPILE=aarch64-linux-gnu-  \
 		CFLAGS='$($(platform)_CFLAGS)' CPPFLAGS='$($(platform)_CPPFLAGS)' \
-		CXXFLAGS='$($(platform)_CXXFLAGS)' LDFLAGS='$($(platform)_LDFLAGS)' \
+		CXXFLAGS='$($(platform)_CXXFLAGS)' LDFLAGS='$(filter-out -f%,$($(platform)_LDFLAGS:-Wl,%=%))' \
 		make PLATFORM=$(platform) $($(subplatform)_assigns) DEBUG=$(debug) V=1; \
 	)
 endef

Reply via email to