Pull Kbuild fixes from Nathan Chancellor: - Fix UAPI types check in headers_check.pl - Only enable -Werror for hostprogs with CONFIG_WERROR / W=e - Ignore fsync() error when output of gen_init_cpio is a pipe - Several little build fixes for recent modules.builtin.modinfo series * tag 'kbuild-fixes-6.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: kbuild: Use '--strip-unneeded-symbol' for removing module device table symbols s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections kbuild: Add '.rel.*' strip pattern for vmlinux kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux gen_init_cpio: Ignore fsync() returning EINVAL on pipes scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogs kbuild: uapi: Strip comments before size type check
Unified · Split
| @@ -214,6 +214,28 @@ SECTIONS · 213 unmodified lines | ||
| 214 | 214 | DWARF_DEBUG |
| 215 | 215 | ELF_DETAILS |
| 216 | 216 | |
| 217 | + /* | |
| 218 | + * Make sure that the .got.plt is either completely empty or it | |
| 219 | + * contains only the three reserved double words. | |
| 220 | + */ | |
| 221 | + .got.plt : { | |
| 222 | + *(.got.plt) | |
| 223 | + } | |
| 224 | + ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!") | |
| 225 | + | |
| 226 | + /* | |
| 227 | + * Sections that should stay zero sized, which is safer to | |
| 228 | + * explicitly check instead of blindly discarding. | |
| 229 | + */ | |
| 230 | + .plt : { | |
| 231 | + *(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt) | |
| 232 | + } | |
| 233 | + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") | |
| 234 | + .rela.dyn : { | |
| 235 | + *(.rela.*) *(.rela_*) | |
| 236 | + } | |
| 237 | + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") | |
| 238 | + | |
| 217 | 239 | /* |
| 218 | 240 | * uncompressed image info used by the decompressor |
| 219 | 241 | * it should match struct vmlinux_info |
| @@ -244,28 +266,6 @@ SECTIONS · 24 unmodified lines | ||
| 244 | 266 | #endif |
| 245 | 267 | } :NONE |
| 246 | 268 | |
| 247 | − /* | |
| 248 | − * Make sure that the .got.plt is either completely empty or it | |
| 249 | − * contains only the three reserved double words. | |
| 250 | − */ | |
| 251 | − .got.plt : { | |
| 252 | − *(.got.plt) | |
| 253 | − } | |
| 254 | − ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!") | |
| 255 | − | |
| 256 | − /* | |
| 257 | − * Sections that should stay zero sized, which is safer to | |
| 258 | − * explicitly check instead of blindly discarding. | |
| 259 | − */ | |
| 260 | − .plt : { | |
| 261 | − *(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt) | |
| 262 | − } | |
| 263 | − ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") | |
| 264 | − .rela.dyn : { | |
| 265 | − *(.rela.*) *(.rela_*) | |
| 266 | − } | |
| 267 | − ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") | |
| 268 | − | |
| 269 | 269 | /* Sections to be discarded */ |
| 270 | 270 | DISCARDS |
| 271 | 271 | /DISCARD/ : { |
| @@ -223,9 +223,11 @@ KBUILD_USERCFLAGS += -Werror · 222 unmodified lines | ||
| 223 | 223 | KBUILD_USERLDFLAGS += -Wl,--fatal-warnings |
| 224 | 224 | KBUILD_RUSTFLAGS += -Dwarnings |
| 225 | 225 | |
| 226 | −endif | |
| 227 | − | |
| 228 | −# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols. | |
| 226 | +# While hostprog flags are used during build bootstrapping (thus should not | |
| 227 | +# depend on CONFIG_ symbols), -Werror is disruptive and should be opted into. | |
| 228 | +# Only apply -Werror to hostprogs built after the initial Kconfig stage. | |
| 229 | 229 | KBUILD_HOSTCFLAGS += -Werror |
| 230 | 230 | KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings |
| 231 | 231 | KBUILD_HOSTRUSTFLAGS += -Dwarnings |
| 232 | + | |
| 233 | +endif | |
| @@ -82,9 +82,12 @@ endif · 81 unmodified lines | ||
| 82 | 82 | # --------------------------------------------------------------------------- |
| 83 | 83 | |
| 84 | 84 | remove-section-y := .modinfo |
| 85 | −remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*' | |
| 85 | +remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*' '!.rel*.dyn' | |
| 86 | +# for compatibility with binutils < 2.32 | |
| 87 | +# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c12d9fa2afe7abcbe407a00e15719e1a1350c2a7 | |
| 88 | +remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel.*' | |
| 86 | 89 | |
| 87 | −remove-symbols := -w --strip-symbol='__mod_device_table__*' | |
| 90 | +remove-symbols := -w --strip-unneeded-symbol='__mod_device_table__*' | |
| 88 | 91 | |
| 89 | 92 | # To avoid warnings: "empty loadable segment detected at ..." from GNU objcopy, |
| 90 | 93 | # it is necessary to remove the PT_LOAD flag from the segment. |
| @@ -112,7 +112,10 @@ static int cpio_trailer(void) · 111 unmodified lines | ||
| 112 | 112 | push_pad(padlen(offset, 512)) < 0) |
| 113 | 113 | return -1; |
| 114 | 114 | |
| 115 | − return fsync(outfd); | |
| 115 | + if (fsync(outfd) < 0 && errno != EINVAL) | |
| 116 | + return -1; | |
| 117 | + | |
| 118 | + return 0; | |
| 116 | 119 | } |
| 117 | 120 | |
| 118 | 121 | static int cpio_mkslink(const char *name, const char *target, |
| @@ -155,6 +155,8 @@ sub check_sizetypes · 154 unmodified lines | ||
| 155 | 155 | if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { |
| 156 | 156 | check_include_typesh($included); |
| 157 | 157 | } |
| 158 | + # strip single-line comments, as types may be referenced within them | |
| 159 | + $line =~ s@/\*.*?\*/@@; | |
| 158 | 160 | if ($line =~ m/__[us](8|16|32|64)\b/) { |
| 159 | 161 | printf STDERR "$filename:$lineno: " . |
| 160 | 162 | "found __[us]{8,16,32,64} type " . |