summarylogtreecommitdiffstats
path: root/0001-cf-Ensure-BTF-info-is-created-in-tests-for-Linux.patch
blob: c45da8b353e19206a68d97ea81f8ed782cd2ee59 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 565cca710f7d88e6d56776dddc8adda5c99026f9 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 15 May 2026 09:01:07 -0600
Subject: [PATCH 1/2] cf: Ensure BTF info is created in tests for Linux

The OpenAFS configure build step fails on an ArchLinux system with a
7.0.5-arch1-1 Linux kernel.

The configure test to determine how CFLAGS are passed to the Linux build
process is failing in a post-compile step:
    build/tools/bpf/resolve_btfids/resolve_btfids
with the following messages:
    Cannot find .BTF_ids or symbols sections, skip symbols resolution
    FAILED: btf permute: Invalid argument
    FAILED to sort BTF: Invalid argument

The failure is during a step that is translating the dwarf debugging
information into BTF.  BTF is the BPF Type Format that holds metadata
used by the eBPF facility.

Investigating the cause shows that the gcc compiler (16.1.1) with the
default ArchLinux kernel build -O2 option results in optimizing out the
debugging information related to the formal parameter
(DW_TAG_formal_parameter) for the conftest function.

The failure within resolve_btfids can be resolved by simply adding a
function that references its parameter in a fashion that the compiler
doesn't strip out the debugging information.  It's sufficient to simply
have any DW_TAG_formal_parameter present in the compiler output.

Add a dummy function, conftest_dummy() to the template that is used to
create the C code used by configure when testing for Linux kernel
features.  Adding the separate function to the template avoids altering
the function body used by the existing Linux kernel feature checks.

The build failure was reported to the OpenAFS-devel mailing list by
Michael Dressel <michael.dressel@desy.de> with the following information

  dkms install --no-depmod openafs/1.8.16pre1 -k 7.0.5-arch1-1

  Error! Bad return status for module build on kernel: 7.0.5-arch1-1 (x86_64)
  Consult /var/lib/dkms/openafs/1.8.16pre1/build/make.log for more information.

Change-Id: Ib03a673f6572c5c564274129987a1170b155e618
Reviewed-on: https://gerrit.openafs.org/16792
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
(cherry picked from commit 499baf4fd7e6e780190f77a56ccd07d5257a7719)
---
 src/cf/linux-test1.m4 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4
index fbe3c1aa8..23221ae44 100644
--- a/src/cf/linux-test1.m4
+++ b/src/cf/linux-test1.m4
@@ -22,6 +22,10 @@ void conftest(void)
 $2
 } 
 
+/* Make sure we have function where debugging info is not optimized out so resolve_btfids doesn't complain */
+void conftest_dummy(int *x);
+void conftest_dummy(int *x) {*x = 1;}
+
 MODULE_LICENSE("http://www.openafs.org/dl/license10.html");
 MODULE_DESCRIPTION("openafs conftest");
 _ACEOF
-- 
2.55.0