Skip to content

Commit 2f7ab12

Browse files
committed
Kbuild: add Rust support
Having most of the new files in place, we now enable Rust support in the build system, including `Kconfig` entries related to Rust, the Rust configuration printer and a few other bits. Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Tested-by: Nick Desaulniers <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Co-developed-by: Alex Gaynor <[email protected]> Signed-off-by: Alex Gaynor <[email protected]> Co-developed-by: Finn Behrens <[email protected]> Signed-off-by: Finn Behrens <[email protected]> Co-developed-by: Adam Bratschi-Kaye <[email protected]> Signed-off-by: Adam Bratschi-Kaye <[email protected]> Co-developed-by: Wedson Almeida Filho <[email protected]> Signed-off-by: Wedson Almeida Filho <[email protected]> Co-developed-by: Michael Ellerman <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Co-developed-by: Sven Van Asbroeck <[email protected]> Signed-off-by: Sven Van Asbroeck <[email protected]> Co-developed-by: Gary Guo <[email protected]> Signed-off-by: Gary Guo <[email protected]> Co-developed-by: Boris-Chengbiao Zhou <[email protected]> Signed-off-by: Boris-Chengbiao Zhou <[email protected]> Co-developed-by: Boqun Feng <[email protected]> Signed-off-by: Boqun Feng <[email protected]> Co-developed-by: Douglas Su <[email protected]> Signed-off-by: Douglas Su <[email protected]> Co-developed-by: Dariusz Sosnowski <[email protected]> Signed-off-by: Dariusz Sosnowski <[email protected]> Co-developed-by: Antonio Terceiro <[email protected]> Signed-off-by: Antonio Terceiro <[email protected]> Co-developed-by: Daniel Xu <[email protected]> Signed-off-by: Daniel Xu <[email protected]> Co-developed-by: Björn Roy Baron <[email protected]> Signed-off-by: Björn Roy Baron <[email protected]> Co-developed-by: Martin Rodriguez Reboredo <[email protected]> Signed-off-by: Martin Rodriguez Reboredo <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 80db40b commit 2f7ab12

19 files changed

+869
-26
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
*.o
3838
*.o.*
3939
*.patch
40+
*.rmeta
41+
*.rsi
4042
*.s
4143
*.so
4244
*.so.dbg

Makefile

+163-9
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ endif
120120

121121
export KBUILD_CHECKSRC
122122

123+
# Enable "clippy" (a linter) as part of the Rust compilation.
124+
#
125+
# Use 'make CLIPPY=1' to enable it.
126+
ifeq ("$(origin CLIPPY)", "command line")
127+
KBUILD_CLIPPY := $(CLIPPY)
128+
endif
129+
130+
export KBUILD_CLIPPY
131+
123132
# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the
124133
# directory of external module to build. Setting M= takes precedence.
125134
ifeq ("$(origin M)", "command line")
@@ -270,14 +279,14 @@ no-dot-config-targets := $(clean-targets) \
270279
cscope gtags TAGS tags help% %docs check% coccicheck \
271280
$(version_h) headers headers_% archheaders archscripts \
272281
%asm-generic kernelversion %src-pkg dt_binding_check \
273-
outputmakefile
282+
outputmakefile rustavailable rustfmt rustfmtcheck
274283
# Installation targets should not require compiler. Unfortunately, vdso_install
275284
# is an exception where build artifacts may be updated. This must be fixed.
276285
no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
277286
headers_install modules_install kernelrelease image_name
278287
no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
279288
image_name
280-
single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
289+
single-targets := %.a %.i %.rsi %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
281290

282291
config-build :=
283292
mixed-build :=
@@ -439,6 +448,7 @@ else
439448
HOSTCC = gcc
440449
HOSTCXX = g++
441450
endif
451+
HOSTRUSTC = rustc
442452
HOSTPKG_CONFIG = pkg-config
443453

444454
KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
@@ -447,8 +457,26 @@ KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
447457
KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
448458
KBUILD_USERLDFLAGS := $(USERLDFLAGS)
449459

460+
# These flags apply to all Rust code in the tree, including the kernel and
461+
# host programs.
462+
export rust_common_flags := --edition=2021 \
463+
-Zbinary_dep_depinfo=y \
464+
-Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \
465+
-Dunreachable_pub -Dnon_ascii_idents \
466+
-Wmissing_docs \
467+
-Drustdoc::missing_crate_level_docs \
468+
-Dclippy::correctness -Dclippy::style \
469+
-Dclippy::suspicious -Dclippy::complexity \
470+
-Dclippy::perf \
471+
-Dclippy::let_unit_value -Dclippy::mut_mut \
472+
-Dclippy::needless_bitwise_bool \
473+
-Dclippy::needless_continue \
474+
-Wclippy::dbg_macro
475+
450476
KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
451477
KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
478+
KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \
479+
-Zallow-features= $(HOSTRUSTFLAGS)
452480
KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
453481
KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
454482

@@ -473,6 +501,12 @@ OBJDUMP = $(CROSS_COMPILE)objdump
473501
READELF = $(CROSS_COMPILE)readelf
474502
STRIP = $(CROSS_COMPILE)strip
475503
endif
504+
RUSTC = rustc
505+
RUSTDOC = rustdoc
506+
RUSTFMT = rustfmt
507+
CLIPPY_DRIVER = clippy-driver
508+
BINDGEN = bindgen
509+
CARGO = cargo
476510
PAHOLE = pahole
477511
RESOLVE_BTFIDS = $(objtree)/tools/bpf/resolve_btfids/resolve_btfids
478512
LEX = flex
@@ -498,9 +532,11 @@ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
498532
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
499533
NOSTDINC_FLAGS :=
500534
CFLAGS_MODULE =
535+
RUSTFLAGS_MODULE =
501536
AFLAGS_MODULE =
502537
LDFLAGS_MODULE =
503538
CFLAGS_KERNEL =
539+
RUSTFLAGS_KERNEL =
504540
AFLAGS_KERNEL =
505541
LDFLAGS_vmlinux =
506542

@@ -529,15 +565,43 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
529565
-Werror=return-type -Wno-format-security \
530566
-std=gnu11
531567
KBUILD_CPPFLAGS := -D__KERNEL__
568+
KBUILD_RUSTFLAGS := $(rust_common_flags) \
569+
--target=$(objtree)/rust/target.json \
570+
-Cpanic=abort -Cembed-bitcode=n -Clto=n \
571+
-Cforce-unwind-tables=n -Ccodegen-units=1 \
572+
-Csymbol-mangling-version=v0 \
573+
-Crelocation-model=static \
574+
-Zfunction-sections=n \
575+
-Dclippy::float_arithmetic
576+
532577
KBUILD_AFLAGS_KERNEL :=
533578
KBUILD_CFLAGS_KERNEL :=
579+
KBUILD_RUSTFLAGS_KERNEL :=
534580
KBUILD_AFLAGS_MODULE := -DMODULE
535581
KBUILD_CFLAGS_MODULE := -DMODULE
582+
KBUILD_RUSTFLAGS_MODULE := --cfg MODULE
536583
KBUILD_LDFLAGS_MODULE :=
537584
KBUILD_LDFLAGS :=
538585
CLANG_FLAGS :=
539586

587+
ifeq ($(KBUILD_CLIPPY),1)
588+
RUSTC_OR_CLIPPY_QUIET := CLIPPY
589+
RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER)
590+
else
591+
RUSTC_OR_CLIPPY_QUIET := RUSTC
592+
RUSTC_OR_CLIPPY = $(RUSTC)
593+
endif
594+
595+
ifdef RUST_LIB_SRC
596+
export RUST_LIB_SRC
597+
endif
598+
599+
# Allows the usage of unstable features in stable compilers.
600+
export RUSTC_BOOTSTRAP := 1
601+
540602
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG
603+
export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY BINDGEN CARGO
604+
export HOSTRUSTC KBUILD_HOSTRUSTFLAGS
541605
export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
542606
export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
543607
export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
@@ -546,9 +610,10 @@ export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS
546610

547611
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
548612
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
613+
export KBUILD_RUSTFLAGS RUSTFLAGS_KERNEL RUSTFLAGS_MODULE
549614
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
550-
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
551-
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
615+
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_RUSTFLAGS_MODULE KBUILD_LDFLAGS_MODULE
616+
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL KBUILD_RUSTFLAGS_KERNEL
552617
export PAHOLE_FLAGS
553618

554619
# Files to ignore in find ... statements
@@ -729,7 +794,7 @@ $(KCONFIG_CONFIG):
729794
#
730795
# Do not use $(call cmd,...) here. That would suppress prompts from syncconfig,
731796
# so you cannot notice that Kconfig is waiting for the user input.
732-
%/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h: $(KCONFIG_CONFIG)
797+
%/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h %/generated/rustc_cfg: $(KCONFIG_CONFIG)
733798
$(Q)$(kecho) " SYNC $@"
734799
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
735800
else # !may-sync-config
@@ -758,10 +823,17 @@ KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
758823

759824
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
760825
KBUILD_CFLAGS += -O2
826+
KBUILD_RUSTFLAGS += -Copt-level=2
761827
else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
762828
KBUILD_CFLAGS += -Os
829+
KBUILD_RUSTFLAGS += -Copt-level=s
763830
endif
764831

832+
# Always set `debug-assertions` and `overflow-checks` because their default
833+
# depends on `opt-level` and `debug-assertions`, respectively.
834+
KBUILD_RUSTFLAGS += -Cdebug-assertions=$(if $(CONFIG_RUST_DEBUG_ASSERTIONS),y,n)
835+
KBUILD_RUSTFLAGS += -Coverflow-checks=$(if $(CONFIG_RUST_OVERFLOW_CHECKS),y,n)
836+
765837
# Tell gcc to never replace conditional load with a non-conditional one
766838
ifdef CONFIG_CC_IS_GCC
767839
# gcc-10 renamed --param=allow-store-data-races=0 to
@@ -792,6 +864,9 @@ KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
792864
KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
793865
KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
794866

867+
KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
868+
KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
869+
795870
ifdef CONFIG_CC_IS_CLANG
796871
KBUILD_CPPFLAGS += -Qunused-arguments
797872
# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
@@ -812,12 +887,15 @@ KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
812887

813888
ifdef CONFIG_FRAME_POINTER
814889
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
890+
KBUILD_RUSTFLAGS += -Cforce-frame-pointers=y
815891
else
816892
# Some targets (ARM with Thumb2, for example), can't be built with frame
817893
# pointers. For those, we don't have FUNCTION_TRACER automatically
818894
# select FRAME_POINTER. However, FUNCTION_TRACER adds -pg, and this is
819895
# incompatible with -fomit-frame-pointer with current GCC, so we don't use
820896
# -fomit-frame-pointer with FUNCTION_TRACER.
897+
# In the Rust target specification, "frame-pointer" is set explicitly
898+
# to "may-omit".
821899
ifndef CONFIG_FUNCTION_TRACER
822900
KBUILD_CFLAGS += -fomit-frame-pointer
823901
endif
@@ -882,8 +960,10 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
882960
KBUILD_CFLAGS += -fno-inline-functions-called-once
883961
endif
884962

963+
# `rustc`'s `-Zfunction-sections` applies to data too (as of 1.59.0).
885964
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
886965
KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
966+
KBUILD_RUSTFLAGS_KERNEL += -Zfunction-sections=y
887967
LDFLAGS_vmlinux += --gc-sections
888968
endif
889969

@@ -1026,10 +1106,11 @@ include $(addprefix $(srctree)/, $(include-y))
10261106
# Do not add $(call cc-option,...) below this line. When you build the kernel
10271107
# from the clean source tree, the GCC plugins do not exist at this point.
10281108

1029-
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
1109+
# Add user supplied CPPFLAGS, AFLAGS, CFLAGS and RUSTFLAGS as the last assignments
10301110
KBUILD_CPPFLAGS += $(KCPPFLAGS)
10311111
KBUILD_AFLAGS += $(KAFLAGS)
10321112
KBUILD_CFLAGS += $(KCFLAGS)
1113+
KBUILD_RUSTFLAGS += $(KRUSTFLAGS)
10331114

10341115
KBUILD_LDFLAGS_MODULE += --build-id=sha1
10351116
LDFLAGS_vmlinux += --build-id=sha1
@@ -1104,6 +1185,7 @@ ifeq ($(KBUILD_EXTMOD),)
11041185
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
11051186
core-$(CONFIG_BLOCK) += block/
11061187
core-$(CONFIG_IO_URING) += io_uring/
1188+
core-$(CONFIG_RUST) += rust/
11071189

11081190
vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
11091191
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
@@ -1206,6 +1288,10 @@ prepare0: archprepare
12061288

12071289
# All the preparing..
12081290
prepare: prepare0
1291+
ifdef CONFIG_RUST
1292+
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh -v
1293+
$(Q)$(MAKE) $(build)=rust
1294+
endif
12091295

12101296
PHONY += remove-stale-files
12111297
remove-stale-files:
@@ -1499,7 +1585,7 @@ endif # CONFIG_MODULES
14991585
# Directories & files removed with 'make clean'
15001586
CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
15011587
modules.builtin modules.builtin.modinfo modules.nsdeps \
1502-
compile_commands.json .thinlto-cache
1588+
compile_commands.json .thinlto-cache rust/test rust/doc
15031589

15041590
# Directories & files removed with 'make mrproper'
15051591
MRPROPER_FILES += include/config include/generated \
@@ -1510,7 +1596,8 @@ MRPROPER_FILES += include/config include/generated \
15101596
certs/signing_key.pem \
15111597
certs/x509.genkey \
15121598
vmlinux-gdb.py \
1513-
*.spec
1599+
*.spec \
1600+
rust/target.json rust/libmacros.so
15141601

15151602
# clean - Delete most, but leave enough to build external modules
15161603
#
@@ -1535,6 +1622,9 @@ $(mrproper-dirs):
15351622

15361623
mrproper: clean $(mrproper-dirs)
15371624
$(call cmd,rmfiles)
1625+
@find . $(RCS_FIND_IGNORE) \
1626+
\( -name '*.rmeta' \) \
1627+
-type f -print | xargs rm -f
15381628

15391629
# distclean
15401630
#
@@ -1622,6 +1712,24 @@ help:
16221712
@echo ' kselftest-merge - Merge all the config dependencies of'
16231713
@echo ' kselftest to existing .config.'
16241714
@echo ''
1715+
@echo 'Rust targets:'
1716+
@echo ' rustavailable - Checks whether the Rust toolchain is'
1717+
@echo ' available and, if not, explains why.'
1718+
@echo ' rustfmt - Reformat all the Rust code in the kernel'
1719+
@echo ' rustfmtcheck - Checks if all the Rust code in the kernel'
1720+
@echo ' is formatted, printing a diff otherwise.'
1721+
@echo ' rustdoc - Generate Rust documentation'
1722+
@echo ' (requires kernel .config)'
1723+
@echo ' rusttest - Runs the Rust tests'
1724+
@echo ' (requires kernel .config; downloads external repos)'
1725+
@echo ' rust-analyzer - Generate rust-project.json rust-analyzer support file'
1726+
@echo ' (requires kernel .config)'
1727+
@echo ' dir/file.[os] - Build specified target only'
1728+
@echo ' dir/file.rsi - Build macro expanded source, similar to C preprocessing.'
1729+
@echo ' Run with RUSTFMT=n to skip reformatting if needed.'
1730+
@echo ' The output is not intended to be compilable.'
1731+
@echo ' dir/file.ll - Build the LLVM assembly file'
1732+
@echo ''
16251733
@$(if $(dtstree), \
16261734
echo 'Devicetree:'; \
16271735
echo '* dtbs - Build device tree blobs for enabled boards'; \
@@ -1694,6 +1802,52 @@ PHONY += $(DOC_TARGETS)
16941802
$(DOC_TARGETS):
16951803
$(Q)$(MAKE) $(build)=Documentation $@
16961804

1805+
1806+
# Rust targets
1807+
# ---------------------------------------------------------------------------
1808+
1809+
# "Is Rust available?" target
1810+
PHONY += rustavailable
1811+
rustavailable:
1812+
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh -v && echo "Rust is available!"
1813+
1814+
# Documentation target
1815+
#
1816+
# Using the singular to avoid running afoul of `no-dot-config-targets`.
1817+
PHONY += rustdoc
1818+
rustdoc: prepare
1819+
$(Q)$(MAKE) $(build)=rust $@
1820+
1821+
# Testing target
1822+
PHONY += rusttest
1823+
rusttest: prepare
1824+
$(Q)$(MAKE) $(build)=rust $@
1825+
1826+
# Formatting targets
1827+
PHONY += rustfmt rustfmtcheck
1828+
1829+
# We skip `rust/alloc` since we want to minimize the diff w.r.t. upstream.
1830+
#
1831+
# We match using absolute paths since `find` does not resolve them
1832+
# when matching, which is a problem when e.g. `srctree` is `..`.
1833+
# We `grep` afterwards in order to remove the directory entry itself.
1834+
rustfmt:
1835+
$(Q)find $(abs_srctree) -type f -name '*.rs' \
1836+
-o -path $(abs_srctree)/rust/alloc -prune \
1837+
-o -path $(abs_objtree)/rust/test -prune \
1838+
| grep -Fv $(abs_srctree)/rust/alloc \
1839+
| grep -Fv $(abs_objtree)/rust/test \
1840+
| grep -Fv generated \
1841+
| xargs $(RUSTFMT) $(rustfmt_flags)
1842+
1843+
rustfmtcheck: rustfmt_flags = --check
1844+
rustfmtcheck: rustfmt
1845+
1846+
# IDE support targets
1847+
PHONY += rust-analyzer
1848+
rust-analyzer:
1849+
$(Q)$(MAKE) $(build)=rust $@
1850+
16971851
# Misc
16981852
# ---------------------------------------------------------------------------
16991853

@@ -1861,7 +2015,7 @@ $(clean-dirs):
18612015
clean: $(clean-dirs)
18622016
$(call cmd,rmfiles)
18632017
@find $(or $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
1864-
\( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
2018+
\( -name '*.[aios]' -o -name '*.rsi' -o -name '*.ko' -o -name '.*.cmd' \
18652019
-o -name '*.ko.*' \
18662020
-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
18672021
-o -name '*.dwo' -o -name '*.lst' \

arch/Kconfig

+6
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ config HAVE_RSEQ
355355
This symbol should be selected by an architecture if it
356356
supports an implementation of restartable sequences.
357357

358+
config HAVE_RUST
359+
bool
360+
help
361+
This symbol should be selected by an architecture if it
362+
supports Rust.
363+
358364
config HAVE_FUNCTION_ARG_ACCESS_API
359365
bool
360366
help

include/linux/compiler_types.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
#ifndef __ASSEMBLY__
66

7+
/*
8+
* Skipped when running bindgen due to a libclang issue;
9+
* see https://github.com/rust-lang/rust-bindgen/issues/2244.
10+
*/
711
#if defined(CONFIG_DEBUG_INFO_BTF) && defined(CONFIG_PAHOLE_HAS_BTF_TAG) && \
8-
__has_attribute(btf_type_tag)
12+
__has_attribute(btf_type_tag) && !defined(__BINDGEN__)
913
# define BTF_TYPE_TAG(value) __attribute__((btf_type_tag(#value)))
1014
#else
1115
# define BTF_TYPE_TAG(value) /* nothing */

0 commit comments

Comments
 (0)