From d1ab614007535e7979798ee53681751fb489bb76a05edff07acb3711007e00ce Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 10 Oct 2019 08:15:48 +0000 Subject: [PATCH] Accepting request 736746 from home:StefanBruens:branches:multimedia:apps - Fix configure checks when compiling with LTO. Due to the broken checks, linking fails. + Add fix_configure_checks_with_LTO.patch - Some spec file cleanup (license macro). OBS-URL: https://build.opensuse.org/request/show/736746 OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/tvheadend?expand=0&rev=36 --- fix_configure_checks_with_LTO.patch | 80 +++++++++++++++++++++++++++++ tvheadend.changes | 8 +++ tvheadend.spec | 13 ++--- 3 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 fix_configure_checks_with_LTO.patch diff --git a/fix_configure_checks_with_LTO.patch b/fix_configure_checks_with_LTO.patch new file mode 100644 index 0000000..9743e94 --- /dev/null +++ b/fix_configure_checks_with_LTO.patch @@ -0,0 +1,80 @@ +From 77ef695f0e76a5f989febfccdc19972ec438fa37 Mon Sep 17 00:00:00 2001 +From: StefanBruens +Date: Wed, 9 Oct 2019 01:52:50 +0200 +Subject: [PATCH] Avoid configure checks being optimized away with LTO + +In case the checks are compiled with CFLAGS including "-O1 -flto" (or any +other optimization level), a "test()" function not referenced by by main +will be optimized away and discarded prior to the final linking step, and +there will be no undefined symbols, thus the checks always succeeds. + +This at least affects the "strlcpy"/"strlcat" checks, but may affects other +checks as well. +--- + configure | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/configure b/configure +index e5f6f593b6..e76760479a 100755 +--- a/configure ++++ b/configure +@@ -177,27 +177,31 @@ else + fi + + check_cc_snippet strlcat '#include +-int test(int argc, char **argv) { ++#define TEST test ++int test() { + char dst[10]; + strlcat("test", dst, sizeof(dst)); + return 0; + }' + + check_cc_snippet strlcpy '#include +-int test(int argc, char **argv) { ++#define TEST test ++int test() { + char dst[10]; + strlcpy("test", dst, sizeof(dst)); + return 0; + }' + + check_cc_snippet fdatasync '#include +-int test(int argc, char **argv) { ++#define TEST test ++int test() { + fdatasync(0); + return 0; + }' + + check_cc_snippet getloadavg '#include +-void test() { getloadavg(NULL,0); }' ++#define TEST test ++int test() { return getloadavg(NULL,0); }' + + check_cc_snippet atomic32 '#include + int test(int *ptr){ +@@ -222,6 +226,7 @@ return __sync_fetch_and_add(ptr, (void *)1); + }' + + check_cc_snippet bitops64 '#include ++#define TEST test + int test(void){ + int l = sizeof(long); + return l == 8 ? 0 : 1; +@@ -312,6 +317,7 @@ int test(void) + # note that iconv routines are mandatory + check_cc_snippet libiconv ' + #include ++#define TEST test + int test(void) + { + iconv_t ic = iconv_open("ASCII", "ASCII"); +@@ -327,6 +333,7 @@ fi + + check_cc_snippet ifnames ' + #include ++#define TEST test + int test(void) + { + struct if_nameindex *ifnames = if_nameindex(); diff --git a/tvheadend.changes b/tvheadend.changes index 9143646..0f65e9c 100644 --- a/tvheadend.changes +++ b/tvheadend.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Oct 9 00:04:02 UTC 2019 - Stefan BrĂ¼ns + +- Fix configure checks when compiling with LTO. Due to the broken + checks, linking fails. + + Add fix_configure_checks_with_LTO.patch +- Some spec file cleanup (license macro). + ------------------------------------------------------------------- Tue Feb 12 21:09:46 UTC 2019 - bjorn.lie@gmail.com diff --git a/tvheadend.spec b/tvheadend.spec index a562e2e..d36ece9 100644 --- a/tvheadend.spec +++ b/tvheadend.spec @@ -1,7 +1,7 @@ # # spec file for package tvheadend # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2016 Packman Team # # All modifications and additions to the file contributed by third parties @@ -13,7 +13,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -42,6 +42,8 @@ Source3: %{name}_super Source4: dvb-scan-git20190112.tar.gz # PATCH-FIX-OPENSUSE tvheadend-fix-service-dependency.patch -- do not wait for or require syslog Patch2: %{name}-fix-service-dependency.patch +# PATCH-FIX-UPSTREAM -- fix unsufficient configure checks when using LTO (check optimized away) +Patch3: fix_configure_checks_with_LTO.patch BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: pkgconfig @@ -57,9 +59,7 @@ BuildRequires: pkgconfig(libssl) BuildRequires: pkgconfig(libswscale) BuildRequires: pkgconfig(liburiparser) BuildRequires: pkgconfig(zlib) -%if 0%{?suse_version} > 1320 Requires(pre): group(%{htsgroup}) -%endif %{?systemd_requires} %description @@ -73,6 +73,7 @@ day-to-day operations, such as searching the electronic program guide %prep %setup -q %patch2 -p1 +%patch3 -p1 sed -e "s/-u \([^ ]*\) -g \([^ ]*\)/-u %{htsuser} -g %{htsgroup}/" -i rpm/%{name}.sysconfig sed -e '/^TVH_ARGS/cTVH_ARGS="-C"' -i debian/%{name}.default @@ -132,8 +133,8 @@ getent passwd %htsuser >/dev/null || %{_sbindir}/useradd -g %{htsgroup} -m -d %{ %service_del_postun %{name}.service %files -%defattr(-,root,root) -%doc CONTRIBUTING.md LICENSE.md +%doc CONTRIBUTING.md +%license LICENSE.md %{_bindir}/tvheadend %{_datadir}/tvheadend %{_mandir}/man1/tvheadend.1%{?ext_man}