summaryrefslogtreecommitdiff
path: root/backport-Let-eBPF-ELF-files-be-packaged-in-noarch-packages.patch
blob: b05cf1968eed492871d079d92f8c555b02deedde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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