File tree Expand file tree Collapse file tree 11 files changed +46
-12
lines changed Expand file tree Collapse file tree 11 files changed +46
-12
lines changed Original file line number Diff line number Diff 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
4747building 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+
4964Generated 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/
Original file line number Diff line number Diff line change @@ -1068,8 +1068,7 @@ KBUILD_CFLAGS += -fno-builtin-wcslen
10681068
10691069# change __FILE__ to the relative path to the source directory
10701070ifdef 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 ) /=)
10731072endif
10741073
10751074# include additional Makefiles when needed
Original file line number Diff line number Diff line change @@ -154,5 +154,6 @@ MRPROPER_FILES += $(HOST_DIR)/include/generated
154154archclean :
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
158159export HEADER_ARCH SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING DEV_NULL_PATH
Original file line number Diff line number Diff 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
9792config GCC_ASM_GOTO_OUTPUT_BROKEN
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff line change @@ -37,6 +37,18 @@ KBUILD_CFLAGS += -Wno-gnu
3737# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
3838KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow-non-kprintf)
3939KBUILD_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)
4052else
4153
4254# gcc inanely warns about local variables called 'main'
Original file line number Diff line number Diff line change @@ -94,10 +94,10 @@ $(vmlinux-final): $(RESOLVE_BTFIDS)
9494endif
9595
9696ifdef CONFIG_BUILDTIME_TABLE_SORT
97- vmlinux: scripts/sorttable
97+ $( vmlinux-final) : scripts/sorttable
9898endif
9999
100- # module .builtin.ranges
100+ # modules .builtin.ranges
101101# ---------------------------------------------------------------------------
102102ifdef CONFIG_BUILTIN_MODULE_RANGES
103103__default: modules.builtin.ranges
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE
7373
7474targets += vmlinux.o
7575
76- # module .builtin.modinfo
76+ # modules .builtin.modinfo
7777# ---------------------------------------------------------------------------
7878
7979OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
@@ -82,7 +82,7 @@ targets += modules.builtin.modinfo
8282modules.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.
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Source1: config
1616Source2: diff.patch
1717Provides: kernel-%{KERNELRELEASE }
1818BuildRequires: bc binutils bison dwarves
19+ BuildRequires: (elfutils-devel or libdw-devel)
1920BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
2021BuildRequires: gcc make openssl openssl-devel perl python3 rsync
2122
Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ Rules-Requires-Root: no
210210Build-Depends: debhelper-compat (= 12)
211211Build-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
216216Homepage: https://www.kernel.org/
You can’t perform that action at this time.
0 commit comments