cryptfs-tpm2: fix LDFLAGS expansion

When LDFLAGS expands, The -fmacro-prefix-map and -fdebug-prefix-map will
be prefixed with -Wl, which will cause compilation error:
ld: -f may not be used without -shared

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
This commit is contained in:
Yi Zhao
2021-08-20 11:28:38 +08:00
committed by Jia Zhang
parent 66a1d0582c
commit e004d37650
2 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
From 8d510daad66f59cbd182d9e193f6fe246fc0bd55 Mon Sep 17 00:00:00 2001
From: Yi Zhao <yi.zhao@windriver.com>
Date: Fri, 20 Aug 2021 10:57:06 +0800
Subject: [PATCH] env.mk: fix LDFLAGS expansion
When LDFLAGS expands, The -fmacro-prefix-map and -fdebug-prefix-map will
be prefixed with -Wl, which will cause compilation error:
ld: -f may not be used without -shared
Upstream-Status: Pending
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
env.mk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/env.mk b/env.mk
index b6b554c..f250d3a 100644
--- a/env.mk
+++ b/env.mk
@@ -33,8 +33,8 @@ passphrase_secret ?= h31i05
# The byte code used to encrypt/decrypt secrets
secret_xor_byte_code ?= 0x48
-LDFLAGS := --warn-common --no-undefined --fatal-warnings \
- $(patsubst $(join -Wl,,)%,%,$(EXTRA_LDFLAGS))
+LDFLAGS := -Wl,--warn-common -Wl,--no-undefined -Wl,--fatal-warnings \
+ $(EXTRA_LDFLAGS)
CFLAGS := -D_GNU_SOURCE -std=gnu99 -O2 -Wall -Werror \
$(addprefix -I, $(TOPDIR)/src/include \
$(tpm2_tss_includedir) $(tpm2_tabrmd_includedir) \
@@ -42,7 +42,7 @@ CFLAGS := -D_GNU_SOURCE -std=gnu99 -O2 -Wall -Werror \
$(addprefix $(join -L,), $(tpm2_tss_libdir)) \
`$(PKG_CONFIG) --cflags glib-2.0` \
`$(PKG_CONFIG) --libs glib-2.0` \
- $(EXTRA_CFLAGS) $(addprefix $(join -Wl,,),$(LDFLAGS))
+ $(EXTRA_CFLAGS) $(LDFLAGS)
ifneq ($(TSS2_VER), 1)
CFLAGS += -ldl -ltss2-sys -ltss2-tcti-mssim -ltss2-tcti-device
--
2.25.1

View File

@@ -26,6 +26,7 @@ SRC_URI = "\
file://0002-luks-setup.sh-Updated-TPM-Tools.patch \
file://0001-lib-Makefile-set-correct-soname-for-libcryptfs-tpm2.patch \
file://0001-Remove-build-time-from-show_banner.patch \
file://0001-env.mk-fix-LDFLAGS-expansion.patch \
"
SRCREV = "87c35c63090a33d4de437f518b8da9f2d1f1d828"