From 5ece87a250880b08ccecfc5b34986347d8cca843 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Thu, 8 Feb 2024 09:44:51 +0200
Subject: [PATCH] Let eBPF ELF files be packaged in noarch packages
 
 eBPF ELF represents a virtual machine where our file colors make no
 sense at all. Filter out the color from these files to avoid a
 "Arch dependent binaries in noarch package" error from them in noarch
 packages.
 
 We don't want to pull in clang to the check images just because of
 this, so add a pre-built binary for the check and a simple way to
 reproduce from the test-spec.
 
 Fixes: #2875

Reference:https://github.com/rpm-software-management/rpm/commit/5ece87a250880b08ccecfc5b34986347d8cca843
Conflict:Deleted binary files and test code because it would add clang
Requires.
---
 build/rpmfc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/build/rpmfc.c b/build/rpmfc.c
index 07171fa..6d40a19 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -1151,6 +1151,13 @@ static uint32_t getElfColor(const char *fn)
 		color = RPMFC_ELF32;
 		break;
 	    }
+
+	    /* Exceptions to coloring */
+	    switch (ehdr.e_machine) {
+	    case EM_BPF:
+		color = 0;
+		break;
+	    }
 	}
 	if (elf)
 	    elf_end(elf);
-- 
2.33.0

