Skip to content

Commit 088d132

Browse files
committed
Merge tag 'kbuild-fixes-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - Add proper pahole version dependency to CONFIG_GENDWARFKSYMS to avoid module loading errors - Fix UAPI header tests for the OpenRISC architecture - Add dependency on the libdw package in Debian and RPM packages - Disable -Wdefault-const-init-unsafe warnings on Clang - Make "make clean ARCH=um" also clean the arch/x86/ directory - Revert the use of -fmacro-prefix-map=, which causes issues with debugger usability * tag 'kbuild-fixes-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: fix typos "module.builtin" to "modules.builtin" Revert "kbuild, rust: use -fremap-path-prefix to make paths relative" Revert "kbuild: make all file references relative to source root" kbuild: fix dependency on sorttable init: remove unused CONFIG_CC_CAN_LINK_STATIC um: let 'make clean' properly clean underlying SUBARCH as well kbuild: Disable -Wdefault-const-init-unsafe kbuild: rpm-pkg: Add (elfutils-devel or libdw-devel) to BuildRequires kbuild: deb-pkg: Add libdw-dev:native to Build-Depends-Arch usr/include: openrisc: don't HDRTEST bpf_perf_event.h kbuild: Require pahole <v1.28 or >v1.29 with GENDWARFKSYMS on X86
2 parents 546bce5 + e0cd396 commit 088d132

File tree

11 files changed

+46
-12
lines changed

11 files changed

+46
-12
lines changed

Documentation/kbuild/reproducible-builds.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ The kernel embeds the building user and host names in
4646
`KBUILD_BUILD_USER and KBUILD_BUILD_HOST`_ variables. If you are
4747
building from a git commit, you could use its committer address.
4848

49+
Absolute filenames
50+
------------------
51+
52+
When the kernel is built out-of-tree, debug information may include
53+
absolute filenames for the source files. This must be overridden by
54+
including the ``-fdebug-prefix-map`` option in the `KCFLAGS`_ variable.
55+
56+
Depending on the compiler used, the ``__FILE__`` macro may also expand
57+
to an absolute filename in an out-of-tree build. Kbuild automatically
58+
uses the ``-fmacro-prefix-map`` option to prevent this, if it is
59+
supported.
60+
61+
The Reproducible Builds web site has more information about these
62+
`prefix-map options`_.
63+
4964
Generated files in source packages
5065
----------------------------------
5166

@@ -116,5 +131,7 @@ See ``scripts/setlocalversion`` for details.
116131

117132
.. _KBUILD_BUILD_TIMESTAMP: kbuild.html#kbuild-build-timestamp
118133
.. _KBUILD_BUILD_USER and KBUILD_BUILD_HOST: kbuild.html#kbuild-build-user-kbuild-build-host
134+
.. _KCFLAGS: kbuild.html#kcflags
135+
.. _prefix-map options: https://reproducible-builds.org/docs/build-path/
119136
.. _Reproducible Builds project: https://reproducible-builds.org/
120137
.. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,7 @@ KBUILD_CFLAGS += -fno-builtin-wcslen
10681068

10691069
# change __FILE__ to the relative path to the source directory
10701070
ifdef building_out_of_srctree
1071-
KBUILD_CPPFLAGS += $(call cc-option,-ffile-prefix-map=$(srcroot)/=)
1072-
KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/=
1071+
KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srcroot)/=)
10731072
endif
10741073

10751074
# include additional Makefiles when needed

arch/um/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,6 @@ MRPROPER_FILES += $(HOST_DIR)/include/generated
154154
archclean:
155155
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
156156
-o -name '*.gcov' \) -type f -print | xargs rm -f
157+
$(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) clean
157158

158159
export HEADER_ARCH SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING DEV_NULL_PATH

init/Kconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ config CC_CAN_LINK
8787
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag)) if 64BIT
8888
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag))
8989

90-
config CC_CAN_LINK_STATIC
91-
bool
92-
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag) -static) if 64BIT
93-
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag) -static)
94-
9590
# Fixed in GCC 14, 13.3, 12.4 and 11.5
9691
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921
9792
config GCC_ASM_GOTO_OUTPUT_BROKEN

kernel/module/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ config GENDWARFKSYMS
192192
depends on !DEBUG_INFO_REDUCED && !DEBUG_INFO_SPLIT
193193
# Requires ELF object files.
194194
depends on !LTO
195+
# To avoid conflicts with the discarded __gendwarfksyms_ptr symbols on
196+
# X86, requires pahole before commit 47dcb534e253 ("btf_encoder: Stop
197+
# indexing symbols for VARs") or after commit 9810758003ce ("btf_encoder:
198+
# Verify 0 address DWARF variables are in ELF section").
199+
depends on !X86 || !DEBUG_INFO_BTF || PAHOLE_VERSION < 128 || PAHOLE_VERSION > 129
195200
help
196201
Calculate symbol versions from DWARF debugging information using
197202
gendwarfksyms. Requires DEBUG_INFO to be enabled.

scripts/Makefile.extrawarn

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ KBUILD_CFLAGS += -Wno-gnu
3737
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
3838
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow-non-kprintf)
3939
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf)
40+
41+
# Clang may emit a warning when a const variable, such as the dummy variables
42+
# in typecheck(), or const member of an aggregate type are not initialized,
43+
# which can result in unexpected behavior. However, in many audited cases of
44+
# the "field" variant of the warning, this is intentional because the field is
45+
# never used within a particular call path, the field is within a union with
46+
# other non-const members, or the containing object is not const so the field
47+
# can be modified via memcpy() / memset(). While the variable warning also gets
48+
# disabled with this same switch, there should not be too much coverage lost
49+
# because -Wuninitialized will still flag when an uninitialized const variable
50+
# is used.
51+
KBUILD_CFLAGS += $(call cc-disable-warning, default-const-init-unsafe)
4052
else
4153

4254
# gcc inanely warns about local variables called 'main'

scripts/Makefile.vmlinux

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ $(vmlinux-final): $(RESOLVE_BTFIDS)
9494
endif
9595

9696
ifdef CONFIG_BUILDTIME_TABLE_SORT
97-
vmlinux: scripts/sorttable
97+
$(vmlinux-final): scripts/sorttable
9898
endif
9999

100-
# module.builtin.ranges
100+
# modules.builtin.ranges
101101
# ---------------------------------------------------------------------------
102102
ifdef CONFIG_BUILTIN_MODULE_RANGES
103103
__default: modules.builtin.ranges

scripts/Makefile.vmlinux_o

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE
7373

7474
targets += vmlinux.o
7575

76-
# module.builtin.modinfo
76+
# modules.builtin.modinfo
7777
# ---------------------------------------------------------------------------
7878

7979
OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
@@ -82,7 +82,7 @@ targets += modules.builtin.modinfo
8282
modules.builtin.modinfo: vmlinux.o FORCE
8383
$(call if_changed,objcopy)
8484

85-
# module.builtin
85+
# modules.builtin
8686
# ---------------------------------------------------------------------------
8787

8888
# The second line aids cases where multiple modules share the same object.

scripts/package/kernel.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Source1: config
1616
Source2: diff.patch
1717
Provides: kernel-%{KERNELRELEASE}
1818
BuildRequires: bc binutils bison dwarves
19+
BuildRequires: (elfutils-devel or libdw-devel)
1920
BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
2021
BuildRequires: gcc make openssl openssl-devel perl python3 rsync
2122

scripts/package/mkdebian

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Rules-Requires-Root: no
210210
Build-Depends: debhelper-compat (= 12)
211211
Build-Depends-Arch: bc, bison, flex,
212212
gcc-${host_gnu} <!pkg.${sourcename}.nokernelheaders>,
213-
kmod, libelf-dev:native,
213+
kmod, libdw-dev:native, libelf-dev:native,
214214
libssl-dev:native, libssl-dev <!pkg.${sourcename}.nokernelheaders>,
215215
python3:native, rsync
216216
Homepage: https://www.kernel.org/

usr/include/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ ifeq ($(SRCARCH),arc)
5959
no-header-test += linux/bpf_perf_event.h
6060
endif
6161

62+
ifeq ($(SRCARCH),openrisc)
63+
no-header-test += linux/bpf_perf_event.h
64+
endif
65+
6266
ifeq ($(SRCARCH),powerpc)
6367
no-header-test += linux/bpf_perf_event.h
6468
endif

0 commit comments

Comments
 (0)