From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Yonghong Song <yhs@fb.com>, Mykola Lysenko <mykolal@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Sasha Levin <sashal@kernel.org>,
shuah@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
nathan@kernel.org, ndesaulniers@google.com, sunyucong@gmail.com,
linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH AUTOSEL 5.15 108/109] selftests/bpf: fix btf_dump/btf_dump due to recent clang change
Date: Mon, 30 May 2022 09:38:24 -0400 [thread overview]
Message-ID: <20220530133825.1933431-108-sashal@kernel.org> (raw)
In-Reply-To: <20220530133825.1933431-1-sashal@kernel.org>
From: Yonghong Song <yhs@fb.com>
[ Upstream commit 4050764cbaa25760aab40857f723393c07898474 ]
Latest llvm-project upstream had a change of behavior
related to qualifiers on function return type ([1]).
This caused selftests btf_dump/btf_dump failure.
The following example shows what changed.
$ cat t.c
typedef const char * const (* const (* const fn_ptr_arr2_t[5])())(char * (*)(int));
struct t {
int a;
fn_ptr_arr2_t l;
};
int foo(struct t *arg) {
return arg->a;
}
Compiled with latest upstream llvm15,
$ clang -O2 -g -target bpf -S -emit-llvm t.c
The related generated debuginfo IR looks like:
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: !1, line: 1, baseType: !17)
!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320, elements: !32)
!18 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !19)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DISubroutineType(types: !21)
!21 = !{!22, null}
!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23, size: 64)
!23 = !DISubroutineType(types: !24)
!24 = !{!25, !28}
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !26, size: 64)
!26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !27)
!27 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
You can see two intermediate const qualifier to pointer are dropped in debuginfo IR.
With llvm14, we have following debuginfo IR:
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: !1, line: 1, baseType: !17)
!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320, elements: !34)
!18 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !19)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DISubroutineType(types: !21)
!21 = !{!22, null}
!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23)
!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !24, size: 64)
!24 = !DISubroutineType(types: !25)
!25 = !{!26, !30}
!26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !27)
!27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !28, size: 64)
!28 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !29)
!29 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
All const qualifiers are preserved.
To adapt the selftest to both old and new llvm, this patch removed
the intermediate const qualifier in const-to-ptr types, to make the
test succeed again.
[1] https://reviews.llvm.org/D125919
Reported-by: Mykola Lysenko <mykolal@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20220523152044.3905809-1-yhs@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c b/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c
index 8aaa24a00322..970598dda732 100644
--- a/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c
+++ b/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c
@@ -94,7 +94,7 @@ typedef void (* (*signal_t)(int, void (*)(int)))(int);
typedef char * (*fn_ptr_arr1_t[10])(int **);
-typedef char * (* const (* const fn_ptr_arr2_t[5])())(char * (*)(int));
+typedef char * (* (* const fn_ptr_arr2_t[5])())(char * (*)(int));
struct struct_w_typedefs {
int_t a;
--
2.35.1
prev parent reply other threads:[~2022-05-30 14:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220530133825.1933431-1-sashal@kernel.org>
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 004/109] selftests/bpf: Fix vfs_link kprobe definition Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 005/109] selftests/bpf: Fix parsing of prog types in UAPI hdr for bpftool sync Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 006/109] mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 007/109] b43legacy: Fix assigning negative value to unsigned variable Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 008/109] b43: " Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 009/109] ipw2x00: Fix potential NULL dereference in libipw_xmit() Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 010/109] ipv6: fix locking issues with loops over idev->addr_list Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 014/109] mac80211: minstrel_ht: fix where rate stats are stored (fixes debugfs output) Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 019/109] sfc: ef10: Fix assigning negative value to unsigned variable Sasha Levin
2022-05-30 13:36 ` [PATCH AUTOSEL 5.15 021/109] rtw88: 8821c: fix debugfs rssi value Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 031/109] ath9k: fix QCA9561 PA bias level Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 043/109] ath11k: disable spectral scan during spectral deinit Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 048/109] ath10k: skip ath10k_halt during suspend for driver state RESTARTING Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 052/109] ipv6: Don't send rs packets to the interface of ARPHRD_TUNNEL Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 053/109] net/mlx5: fs, delete the FTE when there are no rules attached to it Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 055/109] mlxsw: spectrum_dcb: Do not warn about priority changes Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 056/109] mlxsw: Treat LLDP packets as control Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 064/109] net: remove two BUG() from skb_checksum_help() Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 073/109] rtlwifi: Use pr_warn instead of WARN_ONCE Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 074/109] mt76: mt7921: accept rx frames with non-standard VHT MCS10-11 Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 075/109] mt76: fix encap offload ethernet type check Sasha Levin
2022-05-30 13:37 ` [PATCH AUTOSEL 5.15 082/109] usbnet: Run unregister_netdev() before unbind() again Sasha Levin
2022-05-30 13:38 ` [PATCH AUTOSEL 5.15 090/109] net: phy: micrel: Allow probing without .driver_data Sasha Levin
2022-05-30 13:38 ` [PATCH AUTOSEL 5.15 097/109] can: mcp251xfd: silence clang's -Wunaligned-access warning Sasha Levin
2022-05-30 13:38 ` [PATCH AUTOSEL 5.15 099/109] net: ipa: ignore endianness if there is no header Sasha Levin
2022-05-30 13:38 ` [PATCH AUTOSEL 5.15 103/109] rxrpc: Return an error to sendmsg if call failed Sasha Levin
2022-05-30 13:38 ` [PATCH AUTOSEL 5.15 104/109] rxrpc, afs: Fix selection of abort codes Sasha Levin
2022-05-30 13:38 ` [PATCH AUTOSEL 5.15 105/109] afs: Adjust ACK interpretation to try and cope with NAT Sasha Levin
2022-05-30 13:38 ` [PATCH AUTOSEL 5.15 106/109] eth: tg3: silence the GCC 12 array-bounds warning Sasha Levin
2022-05-30 13:38 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220530133825.1933431-108-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mykolal@fb.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=sunyucong@gmail.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).