GKI (arm64) relevant 43 out of 213 changes, affecting 47 files +324/-1168a997e1ab5mailbox: Not protect module_put with spin_lock_irqsave [1 file, +1/-1]dcd5b32139leds: multicolor: Fix intensity setting while SW blinking [1 file, +2/-1]3a0f33c420fuse: fix race between concurrent setattrs from multiple nodes [1 file, +11/-0]9f0fa01811PCI: dwc: Make link training more robust by setting PORT_LOGIC_LINK_WIDTH to one lane [1 file, +1/-4]53809d38ecusb: Add checks for snprintf() calls in usb_alloc_dev() [1 file, +10/-4]cf69fedbb1usb: gadget: f_hid: wake up readers on disable/unbind [1 file, +17/-2]10cc2cfd3eusb: typec: displayport: Receive DP Status Update NAK request exit dp altmode [1 file, +4/-0]1ef2737432usb: typec: mux: do not return on EOPNOTSUPP in {mux, switch}_set [1 file, +2/-2]1818fc3602ALSA: usb-audio: Add a quirk for Lenovo Thinkpad Thunderbolt 3 dock [1 file, +2/-0]ae2353d862scsi: ufs: core: Don't perform UFS clkscaling during host async scan [1 file, +3/-0]0437390086ovl: Check for NULL d_inode() in ovl_dentry_upper() [1 file, +3/-1]4149f0ee5ef2fs: don't over-report free space or inodes in statvfs [1 file, +18/-12]61a9ad7b69af_unix: Don't leave consecutive consumed OOB skbs. [1 file, +11/-2]93abf5e0d5fs/proc/task_mmu: fix PAGE_IS_PFNZERO detection for the huge zero folio [1 file, +1/-1]29d39e0d5flib/group_cpus: fix NULL pointer dereference from group_cpus_evenly() [1 file, +8/-1]a4f182ffa3HID: wacom: fix crash in wacom_aes_battery_handler() [1 file, +1/-0]ce23b73f0fBluetooth: hci_core: Fix use-after-free in vhci_flush() [2 files, +32/-4]0ee87c2814ALSA: usb-audio: Fix out-of-bounds read in snd_usb_get_audioformat_uac3() [1 file, +2/-0]b10a795364attach_recursive_mnt(): do not lock the covering tree when sliding something under it [1 file, +4/-4]949060a623af_unix: Don't set -ECONNRESET for consumed OOB skb. [1 file, +12/-6]dbcd546400vsock/uapi: fix linux/vm_sockets.h userspace compilation errors [1 file, +4/-0]104048a4a4net: selftests: fix TCP packet checksum [1 file, +3/-2]2b8788496fserial: core: restore of_node information in sysfs [1 file, +1/-0]5a8400ebc2Bluetooth: L2CAP: Fix L2CAP MTU negotiation [1 file, +8/-1]cf95f8426fmaple_tree: fix MA_STATE_PREALLOC flag in mas_preallocate() [1 file, +3/-1]7b4ac8433cmm/gup: revert "mm: gup: fix infinite loop within __get_longterm_locked" [1 file, +10/-4]c465f52333f2fs: fix to zero post-eof page [1 file, +38/-0]a85999b987HID: wacom: fix memory leak on kobject creation failure [1 file, +3/-1]2746d02066HID: wacom: fix memory leak on sysfs attribute creation failure [1 file, +1/-0]70017f56b1HID: wacom: fix kobject reference count leak [1 file, +1/-0]6a87e79404scsi: ufs: core: Fix clk scaling to be conditional in reset and restore [1 file, +2/-1]0519b61075media: uvcvideo: Rollback non processed entities on error [1 file, +23/-11]8b8a366e8cio_uring: fix potential page leak in io_sqe_buffer_register() [1 file, +5/-4]53fd75f25bio_uring/rsrc: fix folio unpinning [1 file, +9/-4]50998b0ae7io_uring/rsrc: don't rely on user vaddr alignment [2 files, +5/-1]399214d703io_uring/net: improve recv bundles [1 file, +18/-0]0c07f2bf49io_uring/net: only retry recv bundle for a full transfer [1 file, +10/-4]725fcba8bdio_uring/net: only consider msg_inq if larger than 1 [1 file, +2/-2]b8be3ae062io_uring/net: always use current transfer count for buffer put [1 file, +1/-1]c8d152b8c1io_uring/net: mark iov as dynamically allocated even for single segments [1 file, +6/-5]560c3b51c7io_uring/kbuf: flag partial buffer mappings [3 files, +17/-8]1f4b030e08mm/vma: reset VMA iterator on commit_merge() OOM failure [1 file, +8/-19]287b9cec2eusb: typec: tcpm: PSSourceOffTimer timeout in PR_Swap enters ERROR_RECOVERY [1 file, +1/-2] Changes in 6.12.36 cifs: Correctly set SMB1 SessionKey field in Session Setup Request cifs: Fix cifs_query_path_info() for Windows NT servers cifs: Fix encoding of SMB1 Session Setup NTLMSSP Request in non-UNICODE mode NFSv4: Always set NLINK even if the server doesn't support it NFSv4.2: fix listxattr to return selinux security label NFSv4.2: fix setattr caching of TIME_[MODIFY|ACCESS]_SET when timestamps are delegated mailbox: Not protect module_put with spin_lock_irqsave mfd: max14577: Fix wakeup source leaks on device unbind sunrpc: don't immediately retransmit on seqno miss dm vdo indexer: don't read request structure after enqueuing leds: multicolor: Fix intensity setting while SW blinking fuse: fix race between concurrent setattrs from multiple nodes cxl/region: Add a dev_err() on missing target list entries NFSv4: xattr handlers should check for absent nfs filehandles hwmon: (pmbus/max34440) Fix support for max34451 ksmbd: allow a filename to contain special characters on SMB3.1.1 posix extension ksmbd: provide zero as a unique ID to the Mac client rust: module: place cleanup_module() in .exit.text section rust: arm: fix unknown (to Clang) argument '-mno-fdpic' dmaengine: idxd: Check availability of workqueue allocated by idxd wq driver before using dmaengine: xilinx_dma: Set dma_device directions PCI: dwc: Make link training more robust by setting PORT_LOGIC_LINK_WIDTH to one lane PCI: apple: Fix missing OF node reference in apple_pcie_setup_port PCI: imx6: Add workaround for errata ERR051624 nvme-tcp: fix I/O stalls on congested sockets nvme-tcp: sanitize request list handling md/md-bitmap: fix dm-raid max_write_behind setting amd/amdkfd: fix a kfd_process ref leak bcache: fix NULL pointer in cache_set_flush() drm/amdgpu: seq64 memory unmap uses uninterruptible lock drm/scheduler: signal scheduled fence when kill job iio: pressure: zpa2326: Use aligned_s64 for the timestamp um: Add cmpxchg8b_emu and checksum functions to asm-prototypes.h um: use proper care when taking mmap lock during segfault 8250: microchip: pci1xxxx: Add PCIe Hot reset disable support for Rev C0 and later devices coresight: Only check bottom two claim bits usb: dwc2: also exit clock_gating when stopping udc while suspended iio: adc: ad_sigma_delta: Fix use of uninitialized status_pos misc: tps6594-pfsm: Add NULL pointer check in tps6594_pfsm_probe() usb: potential integer overflow in usbg_make_tpg() tty: serial: uartlite: register uart driver in init usb: common: usb-conn-gpio: use a unique name for usb connector device usb: Add checks for snprintf() calls in usb_alloc_dev() usb: cdc-wdm: avoid setting WDM_READ for ZLP-s usb: gadget: f_hid: wake up readers on disable/unbind usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode usb: typec: mux: do not return on EOPNOTSUPP in {mux, switch}_set riscv: add a data fence for CMODX in the kernel mode ALSA: hda: Ignore unsol events for cards being shut down ALSA: hda: Add new pci id for AMD GPU display HD audio controller ALSA: usb-audio: Add a quirk for Lenovo Thinkpad Thunderbolt 3 dock ASoC: rt1320: fix speaker noise when volume bar is 100% ceph: fix possible integer overflow in ceph_zero_objects() scsi: ufs: core: Don't perform UFS clkscaling during host async scan ovl: Check for NULL d_inode() in ovl_dentry_upper() btrfs: handle csum tree error with rescue=ibadroots correctly drm/i915/gem: Allow EXEC_CAPTURE on recoverable contexts on DG1 Revert "drm/i915/gem: Allow EXEC_CAPTURE on recoverable contexts on DG1" btrfs: factor out nocow ordered extent and extent map generation into a helper btrfs: use unsigned types for constants defined as bit shifts btrfs: fix qgroup reservation leak on failure to allocate ordered extent fs/jfs: consolidate sanity checking in dbMount jfs: validate AG parameters in dbMount() to prevent crashes ASoC: codec: wcd9335: Convert to GPIO descriptors ASoC: codecs: wcd9335: Fix missing free of regulator supplies f2fs: don't over-report free space or inodes in statvfs PCI: apple: Use helper function for_each_child_of_node_scoped() PCI: apple: Set only available ports up accel/ivpu: Do not fail on cmdq if failed to allocate preemption buffers accel/ivpu: Remove copy engine support accel/ivpu: Make command queue ID allocated on XArray accel/ivpu: Separate DB ID and CMDQ ID allocations from CMDQ allocation accel/ivpu: Add debugfs interface for setting HWS priority bands accel/ivpu: Trigger device recovery on engine reset/resume failure af_unix: Don't leave consecutive consumed OOB skbs. i2c: tiny-usb: disable zero-length read messages i2c: robotfuzz-osif: disable zero-length read messages ata: ahci: Use correct DMI identifier for ASUSPRO-D840SA LPM quirk smb: client: remove \t from TP_printk statements mm/damon/sysfs-schemes: free old damon_sysfs_scheme_filter->memcg_path on write ASoC: amd: yc: Add DMI quirk for Lenovo IdeaPad Slim 5 15 s390/pkey: Prevent overflow in size calculation for memdup_user() fs/proc/task_mmu: fix PAGE_IS_PFNZERO detection for the huge zero folio lib/group_cpus: fix NULL pointer dereference from group_cpus_evenly() Revert "riscv: Define TASK_SIZE_MAX for __access_ok()" Revert "riscv: misaligned: fix sleeping function called during misaligned access handling" drm/xe/display: Add check for alloc_ordered_workqueue() HID: wacom: fix crash in wacom_aes_battery_handler() atm: clip: prevent NULL deref in clip_push() Bluetooth: hci_core: Fix use-after-free in vhci_flush() ALSA: usb-audio: Fix out-of-bounds read in snd_usb_get_audioformat_uac3() attach_recursive_mnt(): do not lock the covering tree when sliding something under it libbpf: Fix null pointer dereference in btf_dump__free on allocation failure ethernet: ionic: Fix DMA mapping tests wifi: mac80211: fix beacon interval calculation overflow af_unix: Don't set -ECONNRESET for consumed OOB skb. wifi: mac80211: Add link iteration macro for link data wifi: mac80211: Create separate links for VLAN interfaces wifi: mac80211: finish link init before RCU publish vsock/uapi: fix linux/vm_sockets.h userspace compilation errors bnxt: properly flush XDP redirect lists um: ubd: Add missing error check in start_io_thread() libbpf: Fix possible use-after-free for externs net: enetc: Correct endianness handling in _enetc_rd_reg64 netlink: specs: tc: replace underscores with dashes in names atm: Release atm_dev_mutex after removing procfs in atm_dev_deregister(). ALSA: hda/realtek: Fix built-in mic on ASUS VivoBook X507UAR net: selftests: fix TCP packet checksum drm/amdgpu/discovery: optionally use fw based ip discovery drm/amd: Adjust output for discovery error handling drm/i915: fix build error some more drm/bridge: ti-sn65dsi86: make use of debugfs_init callback drm/bridge: ti-sn65dsi86: Add HPD for DisplayPort connector type drm/xe: Process deferred GGTT node removals on device unwind smb: client: fix potential deadlock when reconnecting channels smb: smbdirect: add smbdirect_pdu.h with protocol definitions smb: client: make use of common smbdirect_pdu.h smb: smbdirect: add smbdirect.h with public structures smb: smbdirect: add smbdirect_socket.h smb: client: make use of common smbdirect_socket smb: smbdirect: introduce smbdirect_socket_parameters smb: client: make use of common smbdirect_socket_parameters cifs: Fix the smbd_response slab to allow usercopy cifs: Fix reading into an ITER_FOLIOQ from the smbdirect code EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs x86/traps: Initialize DR6 by writing its architectural reset value staging: rtl8723bs: Avoid memset() in aes_cipher() and aes_decipher() dt-bindings: serial: 8250: Make clocks and clock-frequency exclusive serial: core: restore of_node information in sysfs serial: imx: Restore original RXTL for console to fix data loss Bluetooth: L2CAP: Fix L2CAP MTU negotiation dm-raid: fix variable in journal device check btrfs: fix a race between renames and directory logging btrfs: update superblock's device bytes_used when dropping chunk spi: spi-cadence-quadspi: Fix pm runtime unbalance net: libwx: fix the creation of page_pool maple_tree: fix MA_STATE_PREALLOC flag in mas_preallocate() mm/gup: revert "mm: gup: fix infinite loop within __get_longterm_locked" f2fs: fix to zero post-eof page HID: lenovo: Restrict F7/9/11 mode to compact keyboards only HID: wacom: fix memory leak on kobject creation failure HID: wacom: fix memory leak on sysfs attribute creation failure HID: wacom: fix kobject reference count leak scsi: megaraid_sas: Fix invalid node index scsi: ufs: core: Fix clk scaling to be conditional in reset and restore drm/ast: Fix comment on modeset lock drm/cirrus-qemu: Fix pitch programming drm/etnaviv: Protect the scheduler's pending list with its lock drm/tegra: Assign plane type before registration drm/tegra: Fix a possible null pointer dereference drm/udl: Unregister device before cleaning up on disconnect drm/msm/gpu: Fix crash when throttling GPU immediately during boot drm/amdkfd: Fix race in GWS queue scheduling drm/bridge: cdns-dsi: Fix the clock variable for mode_valid() drm/bridge: cdns-dsi: Fix phy de-init and flag it so drm/bridge: cdns-dsi: Fix connecting to next bridge drm/bridge: cdns-dsi: Check return value when getting default PHY config drm/bridge: cdns-dsi: Wait for Clk and Data Lanes to be ready drm/amd/display: Add null pointer check for get_first_active_display() drm/amdgpu: amdgpu_vram_mgr_new(): Clamp lpfn to total vram drm/amd/display: Correct non-OLED pre_T11_delay. drm/xe/vm: move rebind_work init earlier drm/xe/sched: stop re-submitting signalled jobs drm/xe/guc_submit: add back fix drm/amd/display: Fix RMCM programming seq errors drm/amdgpu: Add kicker device detection drm/amd/display: Check dce_hwseq before dereferencing it drm/xe: Fix memset on iomem drm/xe: Fix taking invalid lock on wedge drm/xe: Fix early wedge on GuC load failure drm/i915/dsi: Fix off by one in BXT_MIPI_TRANS_VTOTAL drm/amdgpu: Fix SDMA UTC_L1 handling during start/stop sequences drm/amdgpu: switch job hw_fence to amdgpu_fence drm/amd/display: Fix mpv playback corruption on weston media: uvcvideo: Rollback non processed entities on error x86/fpu: Refactor xfeature bitmask update code for sigframe XSAVE x86/pkeys: Simplify PKRU update in signal frame net: libwx: fix Tx L4 checksum io_uring: fix potential page leak in io_sqe_buffer_register() io_uring/rsrc: fix folio unpinning io_uring/rsrc: don't rely on user vaddr alignment io_uring/net: improve recv bundles io_uring/net: only retry recv bundle for a full transfer io_uring/net: only consider msg_inq if larger than 1 io_uring/net: always use current transfer count for buffer put io_uring/net: mark iov as dynamically allocated even for single segments io_uring/kbuf: flag partial buffer mappings mm/vma: reset VMA iterator on commit_merge() OOM failure r8169: add support for RTL8125D net: phy: realtek: merge the drivers for internal NBase-T PHY's net: phy: realtek: add RTL8125D-internal PHY btrfs: do proper folio cleanup when cow_file_range() failed iio: dac: ad3552r: changes to use FIELD_PREP iio: dac: ad3552r: extract common code (no changes in behavior intended) iio: dac: ad3552r-common: fix ad3541/2r ranges drm/xe: Carve out wopcm portion from the stolen memory usb: typec: tcpm: PSSourceOffTimer timeout in PR_Swap enters ERROR_RECOVERY drm/msm/dp: account for widebus and yuv420 during mode validation drm/fbdev-dma: Add shadow buffering for deferred I/O btrfs: skip inodes without loaded extent maps when shrinking extent maps btrfs: make the extent map shrinker run asynchronously as a work queue job btrfs: do regular iput instead of delayed iput during extent map shrinking riscv/atomic: Do proper sign extension also for unsigned in arch_cmpxchg arm64: dts: rockchip: Add avdd HDMI supplies to RockPro64 board dtsi ALSA: hda/realtek: Bass speaker fixup for ASUS UM5606KA drm/amdkfd: remove gfx 12 trap handler page size cap drm/amdkfd: Fix instruction hazard in gfx12 trap handler net: stmmac: Fix accessing freed irq affinity_hint spi: fsl-qspi: use devm function instead of driver remove btrfs: zoned: fix extent range end unlock in cow_file_range() btrfs: fix use-after-free on inode when scanning root during em shrinking spi: fsl-qspi: Fix double cleanup in probe error path Linux 6.12.36 Change-Id: Ie7748fa6d766a9cf7800e67297e404cb90bd359c Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
490 lines
21 KiB
Makefile
490 lines
21 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# Where to place rustdoc generated documentation
|
|
rustdoc_output := $(objtree)/Documentation/output/rust/rustdoc
|
|
|
|
obj-$(CONFIG_RUST) += core.o compiler_builtins.o ffi.o
|
|
always-$(CONFIG_RUST) += exports_core_generated.h
|
|
|
|
# Missing prototypes are expected in the helpers since these are exported
|
|
# for Rust only, thus there is no header nor prototypes.
|
|
obj-$(CONFIG_RUST) += helpers/helpers.o
|
|
CFLAGS_REMOVE_helpers/helpers.o = -Wmissing-prototypes -Wmissing-declarations
|
|
|
|
always-$(CONFIG_RUST) += libmacros.so
|
|
no-clean-files += libmacros.so
|
|
|
|
always-$(CONFIG_RUST) += bindings/bindings_generated.rs bindings/bindings_helpers_generated.rs
|
|
obj-$(CONFIG_RUST) += bindings.o kernel.o
|
|
always-$(CONFIG_RUST) += exports_helpers_generated.h \
|
|
exports_bindings_generated.h exports_kernel_generated.h
|
|
|
|
always-$(CONFIG_RUST) += uapi/uapi_generated.rs
|
|
obj-$(CONFIG_RUST) += uapi.o
|
|
|
|
ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW
|
|
obj-$(CONFIG_RUST) += build_error.o
|
|
else
|
|
always-$(CONFIG_RUST) += build_error.o
|
|
endif
|
|
|
|
obj-$(CONFIG_RUST) += exports.o
|
|
|
|
always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.rs
|
|
always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.c
|
|
|
|
obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.o
|
|
obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.o
|
|
|
|
always-$(subst y,$(CONFIG_RUST),$(CONFIG_JUMP_LABEL)) += kernel/generated_arch_static_branch_asm.rs
|
|
|
|
# Avoids running `$(RUSTC)` for the sysroot when it may not be available.
|
|
ifdef CONFIG_RUST
|
|
|
|
# `$(rust_flags)` is passed in case the user added `--sysroot`.
|
|
rustc_sysroot := $(shell MAKEFLAGS= $(RUSTC) $(rust_flags) --print sysroot)
|
|
rustc_host_target := $(shell $(RUSTC) --version --verbose | grep -F 'host: ' | cut -d' ' -f2)
|
|
RUST_LIB_SRC ?= $(rustc_sysroot)/lib/rustlib/src/rust/library
|
|
|
|
ifneq ($(quiet),)
|
|
rust_test_quiet=-q
|
|
rustdoc_test_quiet=--test-args -q
|
|
rustdoc_test_kernel_quiet=>/dev/null
|
|
endif
|
|
|
|
core-cfgs = \
|
|
--cfg no_fp_fmt_parse
|
|
|
|
core-edition := $(if $(call rustc-min-version,108700),2024,2021)
|
|
|
|
quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
|
|
cmd_rustdoc = \
|
|
OBJTREE=$(abspath $(objtree)) \
|
|
$(RUSTDOC) $(filter-out $(skip_flags),$(if $(rustdoc_host),$(rust_common_flags),$(rust_flags))) \
|
|
$(rustc_target_flags) -L$(objtree)/$(obj) \
|
|
-Zunstable-options --generate-link-to-definition \
|
|
--output $(rustdoc_output) \
|
|
--crate-name $(subst rustdoc-,,$@) \
|
|
$(if $(rustdoc_host),,--sysroot=/dev/null) \
|
|
@$(objtree)/include/generated/rustc_cfg $<
|
|
|
|
# The `html_logo_url` and `html_favicon_url` forms of the `doc` attribute
|
|
# can be used to specify a custom logo. However:
|
|
# - The given value is used as-is, thus it cannot be relative or a local file
|
|
# (unlike the non-custom case) since the generated docs have subfolders.
|
|
# - It requires adding it to every crate.
|
|
# - It requires changing `core` which comes from the sysroot.
|
|
#
|
|
# Using `-Zcrate-attr` would solve the last two points, but not the first.
|
|
# The https://github.com/rust-lang/rfcs/pull/3226 RFC suggests two new
|
|
# command-like flags to solve the issue. Meanwhile, we use the non-custom case
|
|
# and then retouch the generated files.
|
|
rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
|
|
rustdoc-kernel
|
|
$(Q)cp $(srctree)/Documentation/images/logo.svg $(rustdoc_output)/static.files/
|
|
$(Q)cp $(srctree)/Documentation/images/COPYING-logo $(rustdoc_output)/static.files/
|
|
$(Q)find $(rustdoc_output) -name '*.html' -type f -print0 | xargs -0 sed -Ei \
|
|
-e 's:rust-logo-[0-9a-f]+\.svg:logo.svg:g' \
|
|
-e 's:favicon-[0-9a-f]+\.svg:logo.svg:g' \
|
|
-e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g' \
|
|
-e 's:<a href="srctree/([^"]+)">:<a href="$(realpath $(srctree))/\1">:g'
|
|
$(Q)for f in $(rustdoc_output)/static.files/rustdoc-*.css; do \
|
|
echo ".logo-container > img { object-fit: contain; }" >> $$f; done
|
|
|
|
rustdoc-macros: private rustdoc_host = yes
|
|
rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \
|
|
--extern proc_macro
|
|
rustdoc-macros: $(src)/macros/lib.rs FORCE
|
|
+$(call if_changed,rustdoc)
|
|
|
|
# Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should
|
|
# not be needed -- see https://github.com/rust-lang/rust/pull/128307.
|
|
rustdoc-core: private skip_flags = --edition=2021 -Wrustdoc::unescaped_backticks
|
|
rustdoc-core: private rustc_target_flags = --edition=$(core-edition) $(core-cfgs)
|
|
rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
|
|
+$(call if_changed,rustdoc)
|
|
|
|
rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE
|
|
+$(call if_changed,rustdoc)
|
|
|
|
rustdoc-ffi: $(src)/ffi.rs rustdoc-core FORCE
|
|
+$(call if_changed,rustdoc)
|
|
|
|
rustdoc-kernel: private rustc_target_flags = --extern ffi \
|
|
--extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \
|
|
--extern bindings --extern uapi
|
|
rustdoc-kernel: $(src)/kernel/lib.rs rustdoc-core rustdoc-ffi rustdoc-macros \
|
|
rustdoc-compiler_builtins $(obj)/libmacros.so \
|
|
$(obj)/bindings.o FORCE
|
|
+$(call if_changed,rustdoc)
|
|
|
|
quiet_cmd_rustc_test_library = RUSTC TL $<
|
|
cmd_rustc_test_library = \
|
|
OBJTREE=$(abspath $(objtree)) \
|
|
$(RUSTC) $(rust_common_flags) \
|
|
@$(objtree)/include/generated/rustc_cfg $(rustc_target_flags) \
|
|
--crate-type $(if $(rustc_test_library_proc),proc-macro,rlib) \
|
|
--out-dir $(objtree)/$(obj)/test --cfg testlib \
|
|
-L$(objtree)/$(obj)/test \
|
|
--crate-name $(subst rusttest-,,$(subst rusttestlib-,,$@)) $<
|
|
|
|
rusttestlib-build_error: $(src)/build_error.rs FORCE
|
|
+$(call if_changed,rustc_test_library)
|
|
|
|
rusttestlib-ffi: $(src)/ffi.rs FORCE
|
|
+$(call if_changed,rustc_test_library)
|
|
|
|
rusttestlib-macros: private rustc_target_flags = --extern proc_macro
|
|
rusttestlib-macros: private rustc_test_library_proc = yes
|
|
rusttestlib-macros: $(src)/macros/lib.rs FORCE
|
|
+$(call if_changed,rustc_test_library)
|
|
|
|
rusttestlib-kernel: private rustc_target_flags = --extern ffi \
|
|
--extern build_error --extern macros \
|
|
--extern bindings --extern uapi
|
|
rusttestlib-kernel: $(src)/kernel/lib.rs \
|
|
rusttestlib-bindings rusttestlib-uapi rusttestlib-build_error \
|
|
$(obj)/libmacros.so $(obj)/bindings.o FORCE
|
|
+$(call if_changed,rustc_test_library)
|
|
|
|
rusttestlib-bindings: private rustc_target_flags = --extern ffi
|
|
rusttestlib-bindings: $(src)/bindings/lib.rs rusttestlib-ffi FORCE
|
|
+$(call if_changed,rustc_test_library)
|
|
|
|
rusttestlib-uapi: private rustc_target_flags = --extern ffi
|
|
rusttestlib-uapi: $(src)/uapi/lib.rs rusttestlib-ffi FORCE
|
|
+$(call if_changed,rustc_test_library)
|
|
|
|
quiet_cmd_rustdoc_test = RUSTDOC T $<
|
|
cmd_rustdoc_test = \
|
|
OBJTREE=$(abspath $(objtree)) \
|
|
$(RUSTDOC) --test $(rust_common_flags) \
|
|
@$(objtree)/include/generated/rustc_cfg \
|
|
$(rustc_target_flags) $(rustdoc_test_target_flags) \
|
|
$(rustdoc_test_quiet) \
|
|
-L$(objtree)/$(obj)/test --output $(rustdoc_output) \
|
|
--crate-name $(subst rusttest-,,$@) $<
|
|
|
|
quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
|
|
cmd_rustdoc_test_kernel = \
|
|
rm -rf $(objtree)/$(obj)/test/doctests/kernel; \
|
|
mkdir -p $(objtree)/$(obj)/test/doctests/kernel; \
|
|
OBJTREE=$(abspath $(objtree)) \
|
|
$(RUSTDOC) --test $(rust_flags) \
|
|
-L$(objtree)/$(obj) --extern ffi --extern kernel \
|
|
--extern build_error --extern macros \
|
|
--extern bindings --extern uapi \
|
|
--no-run --crate-name kernel -Zunstable-options \
|
|
--sysroot=/dev/null \
|
|
--test-builder $(objtree)/scripts/rustdoc_test_builder \
|
|
$< $(rustdoc_test_kernel_quiet); \
|
|
$(objtree)/scripts/rustdoc_test_gen
|
|
|
|
%/doctests_kernel_generated.rs %/doctests_kernel_generated_kunit.c: \
|
|
$(src)/kernel/lib.rs $(obj)/kernel.o \
|
|
$(objtree)/scripts/rustdoc_test_builder \
|
|
$(objtree)/scripts/rustdoc_test_gen FORCE
|
|
+$(call if_changed,rustdoc_test_kernel)
|
|
|
|
# We cannot use `-Zpanic-abort-tests` because some tests are dynamic,
|
|
# so for the moment we skip `-Cpanic=abort`.
|
|
quiet_cmd_rustc_test = RUSTC T $<
|
|
cmd_rustc_test = \
|
|
OBJTREE=$(abspath $(objtree)) \
|
|
$(RUSTC) --test $(rust_common_flags) \
|
|
@$(objtree)/include/generated/rustc_cfg \
|
|
$(rustc_target_flags) --out-dir $(objtree)/$(obj)/test \
|
|
-L$(objtree)/$(obj)/test \
|
|
--crate-name $(subst rusttest-,,$@) $<; \
|
|
$(objtree)/$(obj)/test/$(subst rusttest-,,$@) $(rust_test_quiet) \
|
|
$(rustc_test_run_flags)
|
|
|
|
rusttest: rusttest-macros rusttest-kernel
|
|
|
|
rusttest-macros: private rustc_target_flags = --extern proc_macro \
|
|
--extern macros --extern kernel
|
|
rusttest-macros: private rustdoc_test_target_flags = --crate-type proc-macro
|
|
rusttest-macros: $(src)/macros/lib.rs \
|
|
rusttestlib-macros rusttestlib-kernel FORCE
|
|
+$(call if_changed,rustc_test)
|
|
+$(call if_changed,rustdoc_test)
|
|
|
|
rusttest-kernel: private rustc_target_flags = --extern ffi \
|
|
--extern build_error --extern macros --extern bindings --extern uapi
|
|
rusttest-kernel: $(src)/kernel/lib.rs rusttestlib-ffi rusttestlib-kernel \
|
|
rusttestlib-build_error rusttestlib-macros rusttestlib-bindings \
|
|
rusttestlib-uapi FORCE
|
|
+$(call if_changed,rustc_test)
|
|
|
|
ifdef CONFIG_CC_IS_CLANG
|
|
bindgen_c_flags = $(c_flags)
|
|
else
|
|
# bindgen relies on libclang to parse C. Ideally, bindgen would support a GCC
|
|
# plugin backend and/or the Clang driver would be perfectly compatible with GCC.
|
|
#
|
|
# For the moment, here we are tweaking the flags on the fly. This is a hack,
|
|
# and some kernel configurations may not work (e.g. `GCC_PLUGIN_RANDSTRUCT`
|
|
# if we end up using one of those structs).
|
|
bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
|
|
-mskip-rax-setup -mgeneral-regs-only -msign-return-address=% \
|
|
-mindirect-branch=thunk-extern -mindirect-branch-register \
|
|
-mfunction-return=thunk-extern -mrecord-mcount -mabi=lp64 \
|
|
-mindirect-branch-cs-prefix -mstack-protector-guard% -mtraceback=no \
|
|
-mno-pointers-to-nested-functions -mno-string \
|
|
-mno-strict-align -mstrict-align -mdirect-extern-access \
|
|
-mexplicit-relocs -mno-check-zero-division \
|
|
-fconserve-stack -falign-jumps=% -falign-loops=% \
|
|
-femit-struct-debug-baseonly -fno-ipa-cp-clone -fno-ipa-sra \
|
|
-fno-partial-inlining -fplugin-arg-arm_ssp_per_task_plugin-% \
|
|
-fno-reorder-blocks -fno-allow-store-data-races -fasan-shadow-offset=% \
|
|
-fzero-call-used-regs=% -fno-stack-clash-protection \
|
|
-fno-inline-functions-called-once -fsanitize=bounds-strict \
|
|
-fstrict-flex-arrays=% -fmin-function-alignment=% \
|
|
-fzero-init-padding-bits=% -mno-fdpic \
|
|
--param=% --param asan-%
|
|
|
|
# Derived from `scripts/Makefile.clang`.
|
|
BINDGEN_TARGET_x86 := x86_64-linux-gnu
|
|
BINDGEN_TARGET_arm64 := aarch64-linux-gnu
|
|
BINDGEN_TARGET_loongarch := loongarch64-linux-gnusf
|
|
BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
|
|
|
|
# All warnings are inhibited since GCC builds are very experimental,
|
|
# many GCC warnings are not supported by Clang, they may only appear in
|
|
# some configurations, with new GCC versions, etc.
|
|
bindgen_extra_c_flags = -w --target=$(BINDGEN_TARGET)
|
|
|
|
# Auto variable zero-initialization requires an additional special option with
|
|
# clang that is going to be removed sometime in the future (likely in
|
|
# clang-18), so make sure to pass this option only if clang supports it
|
|
# (libclang major version < 16).
|
|
#
|
|
# https://github.com/llvm/llvm-project/issues/44842
|
|
# https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0-rc2/clang/docs/ReleaseNotes.rst#deprecated-compiler-flags
|
|
ifdef CONFIG_INIT_STACK_ALL_ZERO
|
|
libclang_maj_ver=$(shell $(BINDGEN) $(srctree)/scripts/rust_is_available_bindgen_libclang.h 2>&1 | sed -ne 's/.*clang version \([0-9]*\).*/\1/p')
|
|
ifeq ($(shell expr $(libclang_maj_ver) \< 16), 1)
|
|
bindgen_extra_c_flags += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
|
endif
|
|
endif
|
|
|
|
bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags), $(c_flags)) \
|
|
$(bindgen_extra_c_flags)
|
|
endif
|
|
|
|
ifdef CONFIG_LTO
|
|
bindgen_c_flags_lto = $(filter-out $(CC_FLAGS_LTO), $(bindgen_c_flags))
|
|
else
|
|
bindgen_c_flags_lto = $(bindgen_c_flags)
|
|
endif
|
|
|
|
# `-fno-builtin` is passed to avoid `bindgen` from using `clang` builtin
|
|
# prototypes for functions like `memcpy` -- if this flag is not passed,
|
|
# `bindgen`-generated prototypes use `c_ulong` or `c_uint` depending on
|
|
# architecture instead of generating `usize`.
|
|
bindgen_c_flags_final = $(bindgen_c_flags_lto) -fno-builtin -D__BINDGEN__
|
|
|
|
# Each `bindgen` release may upgrade the list of Rust target versions. By
|
|
# default, the highest stable release in their list is used. Thus we need to set
|
|
# a `--rust-target` to avoid future `bindgen` releases emitting code that
|
|
# `rustc` may not understand. On top of that, `bindgen` does not support passing
|
|
# an unknown Rust target version.
|
|
#
|
|
# Therefore, the Rust target for `bindgen` can be only as high as the minimum
|
|
# Rust version the kernel supports and only as high as the greatest stable Rust
|
|
# target supported by the minimum `bindgen` version the kernel supports (that
|
|
# is, if we do not test the actual `rustc`/`bindgen` versions running).
|
|
#
|
|
# Starting with `bindgen` 0.71.0, we will be able to set any future Rust version
|
|
# instead, i.e. we will be able to set here our minimum supported Rust version.
|
|
quiet_cmd_bindgen = BINDGEN $@
|
|
cmd_bindgen = \
|
|
$(BINDGEN) $< $(bindgen_target_flags) --rust-target 1.68 \
|
|
--use-core --with-derive-default --ctypes-prefix ffi --no-layout-tests \
|
|
--no-debug '.*' --enable-function-attribute-detection \
|
|
-o $@ -- $(bindgen_c_flags_final) -DMODULE \
|
|
$(bindgen_target_cflags) $(bindgen_target_extra)
|
|
|
|
$(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \
|
|
$(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
|
|
$(obj)/bindings/bindings_generated.rs: private bindgen_target_extra = ; \
|
|
sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const \1/g' $@
|
|
$(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
|
|
$(src)/bindgen_parameters FORCE
|
|
$(call if_changed_dep,bindgen)
|
|
|
|
$(obj)/uapi/uapi_generated.rs: private bindgen_target_flags = \
|
|
$(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
|
|
$(obj)/uapi/uapi_generated.rs: $(src)/uapi/uapi_helper.h \
|
|
$(src)/bindgen_parameters FORCE
|
|
$(call if_changed_dep,bindgen)
|
|
|
|
# See `CFLAGS_REMOVE_helpers.o` above. In addition, Clang on C does not warn
|
|
# with `-Wmissing-declarations` (unlike GCC), so it is not strictly needed here
|
|
# given it is `libclang`; but for consistency, future Clang changes and/or
|
|
# a potential future GCC backend for `bindgen`, we disable it too.
|
|
$(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_flags = \
|
|
--blocklist-type '.*' --allowlist-var '' \
|
|
--allowlist-function 'rust_helper_.*'
|
|
$(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_cflags = \
|
|
-I$(objtree)/$(obj) -Wno-missing-prototypes -Wno-missing-declarations
|
|
$(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; \
|
|
sed -Ei 's/pub fn rust_helper_([a-zA-Z0-9_]*)/#[link_name="rust_helper_\1"]\n pub fn \1/g' $@
|
|
$(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE
|
|
$(call if_changed_dep,bindgen)
|
|
|
|
rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ && $$3!~/__odr_asan/ { printf $(2),$$3 }'
|
|
|
|
quiet_cmd_exports = EXPORTS $@
|
|
cmd_exports = \
|
|
$(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n") > $@
|
|
|
|
$(obj)/exports_core_generated.h: $(obj)/core.o FORCE
|
|
$(call if_changed,exports)
|
|
|
|
# Even though Rust kernel modules should never use the bindings directly,
|
|
# symbols from the `bindings` crate and the C helpers need to be exported
|
|
# because Rust generics and inlined functions may not get their code generated
|
|
# in the crate where they are defined. Other helpers, called from non-inline
|
|
# functions, may not be exported, in principle. However, in general, the Rust
|
|
# compiler does not guarantee codegen will be performed for a non-inline
|
|
# function either. Therefore, we export all symbols from helpers and bindings.
|
|
# In the future, this may be revisited to reduce the number of exports after
|
|
# the compiler is informed about the places codegen is required.
|
|
$(obj)/exports_helpers_generated.h: $(obj)/helpers/helpers.o FORCE
|
|
$(call if_changed,exports)
|
|
|
|
$(obj)/exports_bindings_generated.h: $(obj)/bindings.o FORCE
|
|
$(call if_changed,exports)
|
|
|
|
$(obj)/exports_kernel_generated.h: $(obj)/kernel.o FORCE
|
|
$(call if_changed,exports)
|
|
|
|
quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
|
|
cmd_rustc_procmacro = \
|
|
$(RUSTC_OR_CLIPPY) $(rust_common_flags) \
|
|
-Clinker-flavor=gcc -Clinker=$(HOSTCC) \
|
|
-Clink-args='$(call escsq,$(KBUILD_PROCMACROLDFLAGS))' \
|
|
--emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \
|
|
--crate-type proc-macro \
|
|
--crate-name $(patsubst lib%.so,%,$(notdir $@)) $<
|
|
|
|
# Procedural macros can only be used with the `rustc` that compiled it.
|
|
$(obj)/libmacros.so: $(src)/macros/lib.rs FORCE
|
|
+$(call if_changed_dep,rustc_procmacro)
|
|
|
|
quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L $@
|
|
cmd_rustc_library = \
|
|
OBJTREE=$(abspath $(objtree)) \
|
|
$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
|
|
$(filter-out $(skip_flags),$(rust_flags)) $(rustc_target_flags) \
|
|
--emit=dep-info=$(depfile) --emit=obj=$@ \
|
|
--emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
|
|
--crate-type rlib -L$(objtree)/$(obj) \
|
|
--crate-name $(patsubst %.o,%,$(notdir $@)) $< \
|
|
--sysroot=/dev/null \
|
|
$(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@) \
|
|
$(cmd_objtool)
|
|
|
|
rust-analyzer:
|
|
$(Q)$(srctree)/scripts/generate_rust_analyzer.py \
|
|
--cfgs='core=$(core-cfgs)' $(core-edition) \
|
|
$(realpath $(srctree)) $(realpath $(objtree)) \
|
|
$(rustc_sysroot) $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \
|
|
$(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json
|
|
|
|
redirect-intrinsics = \
|
|
__addsf3 __eqsf2 __extendsfdf2 __gesf2 __lesf2 __ltsf2 __mulsf3 __nesf2 __truncdfsf2 __unordsf2 \
|
|
__adddf3 __eqdf2 __ledf2 __ltdf2 __muldf3 __unorddf2 \
|
|
__muloti4 __multi3 \
|
|
__udivmodti4 __udivti3 __umodti3
|
|
|
|
ifneq ($(or $(CONFIG_ARM64),$(and $(CONFIG_RISCV),$(CONFIG_64BIT))),)
|
|
# These intrinsics are defined for ARM64 and RISCV64
|
|
redirect-intrinsics += \
|
|
__ashrti3 \
|
|
__ashlti3 __lshrti3
|
|
endif
|
|
|
|
ifdef CONFIG_MODVERSIONS
|
|
cmd_gendwarfksyms = $(if $(skip_gendwarfksyms),, \
|
|
$(call rust_exports,$@,"%s\n") | \
|
|
scripts/gendwarfksyms/gendwarfksyms \
|
|
$(if $(KBUILD_GENDWARFKSYMS_STABLE), --stable) \
|
|
$(if $(KBUILD_SYMTYPES), --symtypes $(@:.o=.symtypes),) \
|
|
$@ >> $(dot-target).cmd)
|
|
endif
|
|
|
|
define rule_rustc_library
|
|
$(call cmd_and_fixdep,rustc_library)
|
|
$(call cmd,gen_objtooldep)
|
|
$(call cmd,gendwarfksyms)
|
|
endef
|
|
|
|
define rule_rust_cc_library
|
|
$(call if_changed_rule,cc_o_c)
|
|
$(call cmd,force_checksrc)
|
|
$(call cmd,gendwarfksyms)
|
|
endef
|
|
|
|
# helpers.o uses the same export mechanism as Rust libraries, so ensure symbol
|
|
# versions are calculated for the helpers too.
|
|
$(obj)/helpers/helpers.o: $(src)/helpers/helpers.c $(recordmcount_source) FORCE
|
|
+$(call if_changed_rule,rust_cc_library)
|
|
|
|
# Disable symbol versioning for exports.o to avoid conflicts with the actual
|
|
# symbol versions generated from Rust objects.
|
|
$(obj)/exports.o: private skip_gendwarfksyms = 1
|
|
|
|
$(obj)/core.o: private skip_clippy = 1
|
|
$(obj)/core.o: private skip_flags = --edition=2021 -Wunreachable_pub
|
|
$(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym))
|
|
$(obj)/core.o: private rustc_target_flags = --edition=$(core-edition) $(core-cfgs)
|
|
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs \
|
|
$(wildcard $(objtree)/include/config/RUSTC_VERSION_TEXT) FORCE
|
|
+$(call if_changed_rule,rustc_library)
|
|
ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
|
|
$(obj)/core.o: scripts/target.json
|
|
endif
|
|
KCOV_INSTRUMENT_core.o := n
|
|
|
|
$(obj)/compiler_builtins.o: private skip_gendwarfksyms = 1
|
|
$(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
|
|
$(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE
|
|
+$(call if_changed_rule,rustc_library)
|
|
|
|
|
|
$(obj)/build_error.o: private skip_gendwarfksyms = 1
|
|
$(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE
|
|
+$(call if_changed_rule,rustc_library)
|
|
|
|
$(obj)/ffi.o: private skip_gendwarfksyms = 1
|
|
$(obj)/ffi.o: $(src)/ffi.rs $(obj)/compiler_builtins.o FORCE
|
|
+$(call if_changed_rule,rustc_library)
|
|
|
|
$(obj)/bindings.o: private rustc_target_flags = --extern ffi
|
|
$(obj)/bindings.o: $(src)/bindings/lib.rs \
|
|
$(obj)/ffi.o \
|
|
$(obj)/bindings/bindings_generated.rs \
|
|
$(obj)/bindings/bindings_helpers_generated.rs FORCE
|
|
+$(call if_changed_rule,rustc_library)
|
|
|
|
$(obj)/uapi.o: private rustc_target_flags = --extern ffi
|
|
$(obj)/uapi.o: private skip_gendwarfksyms = 1
|
|
$(obj)/uapi.o: $(src)/uapi/lib.rs \
|
|
$(obj)/ffi.o \
|
|
$(obj)/uapi/uapi_generated.rs FORCE
|
|
+$(call if_changed_rule,rustc_library)
|
|
|
|
$(obj)/kernel.o: private rustc_target_flags = --extern ffi \
|
|
--extern build_error --extern macros --extern bindings --extern uapi
|
|
$(obj)/kernel.o: $(src)/kernel/lib.rs $(obj)/build_error.o \
|
|
$(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o FORCE
|
|
+$(call if_changed_rule,rustc_library)
|
|
|
|
ifdef CONFIG_JUMP_LABEL
|
|
$(obj)/kernel.o: $(obj)/kernel/generated_arch_static_branch_asm.rs
|
|
endif
|
|
|
|
endif # CONFIG_RUST
|