File 0001-Backport-d8f423b575e8be387d33bc3af176baf978efacbb.patch of Package rpmlint.17311

From 790482dbc83f6cd67d29697ce6904dfc962bf576 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 2 Jan 2019 13:22:40 +0100
Subject: [PATCH] Backport d8f423b575e8be387d33bc3af176baf978efacbb:

Come up with lto-bytecode check for ELF files.
---
 BinariesCheck.py                              |  14 +++++++++++++-
 .../libreiserfscore-devel-3.6.27-0.x86_64.rpm | Bin 0 -> 1005964 bytes
 test/test_binaries.py                         |   5 +++++
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 test/binary/libreiserfscore-devel-3.6.27-0.x86_64.rpm

Index: rpmlint-rpmlint-1.10/BinariesCheck.py
===================================================================
--- rpmlint-rpmlint-1.10.orig/BinariesCheck.py
+++ rpmlint-rpmlint-1.10/BinariesCheck.py
@@ -71,6 +71,7 @@ class BinaryInfo(object):
 
     chdir_call_regex = create_regexp_call('chdir')
     mktemp_call_regex = create_regexp_call('mktemp')
+    lto_section_name_prefix = '.gnu.lto_.'
 
     def __init__(self, pkg, path, file, is_ar, is_shlib):
         self.readelf_error = False
@@ -90,6 +91,7 @@ class BinaryInfo(object):
         self.debuginfo = False
         self.symtab = False
         self.tail = ''
+        self.lto_sections = False
 
         self.setgid = False
         self.setuid = False
@@ -116,6 +118,9 @@ class BinaryInfo(object):
         if not res[0]:
             lines = res[1].splitlines()
             for l in lines:
+                if BinaryInfo.lto_section_name_prefix in l:
+                    self.lto_sections = True
+
                 r = BinaryInfo.needed_regex.search(l)
                 if r:
                     self.needed.append(r.group(1))
@@ -513,6 +518,9 @@ class BinariesCheck(AbstractCheck.Abstra
                 for ec in bin_info.exit_calls:
                     printWarning(pkg, 'shared-lib-calls-exit', fname, ec)
 
+            if bin_info.lto_sections:
+                printError(pkg, 'lto-bytecode', fname)
+
             for ec in bin_info.forbidden_calls:
                 printWarning(pkg, ec, fname,
                              BinaryInfo.forbidden_functions[ec]['f_name'])
@@ -835,7 +843,11 @@ upstream to have this issue fixed.''',
 '''This executable should be stripped from debugging symbols, in order to take
 less space and be loaded faster. This is usually done automatically at
 buildtime by rpm. Check the build logs and the permission on the file (some
-implementations only strip if the permission is 0755).'''
+implementations only strip if the permission is 0755).''',
+
+'lto-bytecode',
+'''This executable contains a LTO section.  LTO bytecode is not portable
+and should not be distributed in static libraries or e.g. Python modules.''',
 )
 
 # BinariesCheck.py ends here
openSUSE Build Service is sponsored by