linux/scripts/gendwarfksyms/examples/kabi_ex.c
Sami Tolvanen c9083467f7 gendwarfksyms: Add a kABI rule to override type strings
In rare situations where distributions must make significant
changes to otherwise opaque data structures that have
inadvertently been included in the published ABI, keeping
symbol versions stable using the existing kABI macros can
become tedious.

For example, Android decided to switch to a newer io_uring
implementation in the 5.10 GKI kernel "to resolve a huge number
of potential, and known, problems with the codebase," requiring
"horrible hacks" with genksyms:

  "A number of the io_uring structures get used in other core
  kernel structures, only as "opaque" pointers, so there is
  not any real ABI breakage.  But, due to the visibility of
  the structures going away, the CRC values of many scheduler
  variables and functions were changed."
    -- https://r.android.com/2425293

While these specific changes probably could have been hidden
from gendwarfksyms using the existing kABI macros, this may not
always be the case.

Add a last resort kABI rule that allows distribution
maintainers to fully override a type string for a symbol or a
type. Also add a more informative error message in case we find
a non-existent type references when calculating versions.

Suggested-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-05-25 18:12:23 +09:00

38 lines
514 B
C

// SPDX-License-Identifier: GPL-2.0
/*
* kabi_ex.c
*
* Copyright (C) 2024 Google LLC
*
* Examples for kABI stability features with --stable. See kabi_ex.h
* for details.
*/
#include "kabi_ex.h"
struct s e0;
enum e e1;
struct ex0a ex0a;
struct ex0b ex0b;
struct ex0c ex0c;
struct ex1a ex1a;
struct ex1b ex1b;
struct ex1c ex1c;
struct ex2a ex2a;
struct ex2b ex2b;
struct ex2c ex2c;
struct ex3a ex3a;
struct ex3b ex3b;
struct ex3c ex3c;
struct ex4a ex4a;
struct ex5a ex5a;
struct ex5b ex5b;
int ex6a;