From a5a59f0dae960b334db5428480b590b1949f047cf9c79227209909292351af08 Mon Sep 17 00:00:00 2001 From: Matthias Gerstner Date: Thu, 28 Jan 2021 11:16:25 +0000 Subject: [PATCH] - add fix_pie_linking.patch: fixes an error in the build system that causes the tss2 binary to be linked without passed LDFLAGS (like -pie), which causes the binary not to be position independent. OBS-URL: https://build.opensuse.org/package/show/security/tpm2.0-tools?expand=0&rev=64 --- fix_pie_linking.patch | 13 +++++++++++++ tpm2.0-tools.changes | 3 +++ tpm2.0-tools.spec | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 fix_pie_linking.patch diff --git a/fix_pie_linking.patch b/fix_pie_linking.patch new file mode 100644 index 0000000..f0d1ebc --- /dev/null +++ b/fix_pie_linking.patch @@ -0,0 +1,13 @@ +Index: tpm2-tools-5.0/Makefile.am +=================================================================== +--- tpm2-tools-5.0.orig/Makefile.am ++++ tpm2-tools-5.0/Makefile.am +@@ -45,7 +45,7 @@ lib_libcommon_a_SOURCES = $(LIB_SRC) + lib_libcommon_a_CFLAGS = -fPIC $(AM_CFLAGS) + + tools_fapi_tss2_CFLAGS = $(FAPI_CFLAGS) -DTSS2_TOOLS_MAX="$(words $(tss2_tools))" +-tools_fapi_tss2_LDFLAGS = $(TSS2_FAPI_LIBS) ++tools_fapi_tss2_LDFLAGS = $(EXTRA_LDFLAGS) $(TSS2_FAPI_LIBS) + tools_fapi_tss2_SOURCES = \ + tools/fapi/tss2_template.c \ + tools/fapi/tss2_template.h \ diff --git a/tpm2.0-tools.changes b/tpm2.0-tools.changes index ce6ed79..362d529 100644 --- a/tpm2.0-tools.changes +++ b/tpm2.0-tools.changes @@ -3,6 +3,9 @@ Thu Jan 28 09:49:06 UTC 2021 - Matthias Gerstner - add fix_warnings.patch: fixes a couple of build errors resulting from LTO linking and -Werror. +- add fix_pie_linking.patch: fixes an error in the build system that causes + the tss2 binary to be linked without passed LDFLAGS (like -pie), which + causes the binary not to be position independent. - update to major version 5.0: - Non Backwards Compatible Changes * Default hash algorithm is now sha256. Prior versions claimed sha1, but were diff --git a/tpm2.0-tools.spec b/tpm2.0-tools.spec index 9b84f89..f34d7d6 100644 --- a/tpm2.0-tools.spec +++ b/tpm2.0-tools.spec @@ -26,6 +26,7 @@ URL: https://github.com/tpm2-software/tpm2-tools/releases Source0: https://github.com/tpm2-software/tpm2-tools/releases/download/%{version}/tpm2-tools-%{version}.tar.gz Patch0: fix_bogus_warning.patch Patch1: fix_warnings.patch +Patch2: fix_pie_linking.patch BuildRequires: autoconf-archive BuildRequires: automake BuildRequires: gcc-c++ @@ -66,8 +67,11 @@ associated interfaces. %setup -q -n tpm2-tools-%{version} %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build +# TODO: remove autoreconf once fix_pie_linking patch is no longer needed +autoreconf -fvi %configure --disable-static make %{?_smp_mflags}