]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
Merge branch 'selftests-bpf-impose-global-ordering-for-test-decl_tags'
authorAlexei Starovoitov <ast@kernel.org>
Sat, 11 Apr 2026 14:17:06 +0000 (07:17 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 11 Apr 2026 14:17:13 +0000 (07:17 -0700)
commit4b64e5244183c0dcffc077b840689e4c6c1f7b1f
tree46672190c5efa101acd9ccaedcd0ea02ac19a41a
parentd6bae125f21f74201a3eab0996b2f27be3abc4bf
parent335a6ca04158505b94afb7271488f5052c46f5e5
Merge branch 'selftests-bpf-impose-global-ordering-for-test-decl_tags'

Eduard Zingerman says:

====================
selftests/bpf: impose global ordering for test decl_tags

Impose global ordering for all decl tags used by test_loader.c based
tests: __success, __failure, __msg, etc. The tags are now sorted by
testing framework to be processed in the same order they appear in the
C source code of the test.

The ordering is necessary for gcc-bpf. Neither GCC nor the C standard
defines the order in which function attributes are consumed.
While Clang tends to preserve tags definition order in the output BTF,
GCC does not. This inconsistency causes BPF tests with multiple __msg
entries to fail when compiled with GCC.

This is based on a patch [1] from Cupertino Miranda (see patch #3) and
includes some additional cleanups for test_loader.c decl tags
declaration and processing (see patches #1, #2, #4).

[1] https://lore.kernel.org/bpf/20260305130035.192080-1-cupertino.miranda@oracle.com/

Changelog:
v2: https://lore.kernel.org/bpf/20260330-selftests-global-tags-ordering-v2-0-c0ac61e81098@gmail.com/
v2 -> v3:
- fixed free(tmp) call in collect_decl_tags() (Puranjay, bot)
- naming nit in compile_regex() (Mykyta)

v1 -> v2:
- refactoring str_has_pfx() usages missing from v1 (Puranjay)
- removed realloc_or_free() (Andrii)
- fixed qsort(NULL, ...) usage (Puranjay)
- skip_decl_tag_pfx() returns NULL if tag does not start from
  "comment:" (Puranjay)

v1: https://lore.kernel.org/bpf/20260326-selftests-global-tags-ordering-v1-0-5dd2ced5d9ad@gmail.com/
====================

Link: https://patch.msgid.link/20260410-selftests-global-tags-ordering-v2-0-c566ec9781bf@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>