[oe-commits] [openembedded-core] 04/09: insane: Recognise BPF as a valid EM_MACHINE type

git at git.openembedded.org git at git.openembedded.org
Thu Sep 13 16:38:37 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 3667a8ec016bae3f8026ef7b4c895546804f6368
Author: Khem Raj <raj.khem at gmail.com>
AuthorDate: Wed Sep 12 21:12:09 2018 -0700

    insane: Recognise BPF as a valid EM_MACHINE type
    
    BPF Linux ELF objects are generated with kernel-selftests with
    >= 4.18 kernel and when clang is enabled which packages BPF objects
    into packages, therefore recongnise this as a valid ELF target
    
    Add a selftest for BPF
    
    Do not flag BPF objects in target, since they pretty much will be ok for
    most of kernels architectures we care do support BPF
    
    Signed-off-by: Khem Raj <raj.khem at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/insane.bbclass               | 6 ++++--
 meta/lib/oe/qa.py                         | 3 ++-
 meta/lib/oeqa/selftest/cases/oelib/elf.py | 1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 8c360c8..4644221 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -301,8 +301,10 @@ def package_qa_check_arch(path,name,d, elf, messages):
 
     # Check the architecture and endiannes of the binary
     is_32 = (("virtual/kernel" in provides) or bb.data.inherits_class("module", d)) and \
-            (target_os == "linux-gnux32" or target_os == "linux-muslx32" or target_os == "linux-gnu_ilp32" or re.match('mips64.*32', d.getVar('DEFAULTTUNE')))
-    if not ((machine == elf.machine()) or is_32):
+            (target_os == "linux-gnux32" or target_os == "linux-muslx32" or \
+            target_os == "linux-gnu_ilp32" or re.match('mips64.*32', d.getVar('DEFAULTTUNE')))
+    is_bpf = (oe.qa.elf_machine_to_string(elf.machine()) == "BPF")
+    if not ((machine == elf.machine()) or is_32 or is_bpf):
         package_qa_add_message(messages, "arch", "Architecture did not match (%s, expected %s) on %s" % \
                  (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine), package_qa_clean_path(path,d)))
     elif not ((bits == elf.abiSize()) or is_32):
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 3231e60..59c72ce 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -158,7 +158,8 @@ def elf_machine_to_string(machine):
             0x2A: "SuperH",
             0x32: "IA-64",
             0x3E: "x86-64",
-            0xB7: "AArch64"
+            0xB7: "AArch64",
+            0xF7: "BPF"
         }[machine]
     except:
         return "Unknown (%s)" % repr(machine)
diff --git a/meta/lib/oeqa/selftest/cases/oelib/elf.py b/meta/lib/oeqa/selftest/cases/oelib/elf.py
index 74ee6a1..15c03f4 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/elf.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/elf.py
@@ -15,6 +15,7 @@ class TestElf(TestCase):
         self.assertEqual(oe.qa.elf_machine_to_string(0x32), "IA-64")
         self.assertEqual(oe.qa.elf_machine_to_string(0x3E), "x86-64")
         self.assertEqual(oe.qa.elf_machine_to_string(0xB7), "AArch64")
+        self.assertEqual(oe.qa.elf_machine_to_string(0xF7), "BPF")
 
         self.assertEqual(oe.qa.elf_machine_to_string(0x00), "Unknown (0)")
         self.assertEqual(oe.qa.elf_machine_to_string(0xDEADBEEF), "Unknown (3735928559)")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list