History

Merge tag 'kbuild-fixes-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada: - remove unneeded ar-option and KBUILD_ARFLAGS - remove long-deprecated SUBDIRS - fix modpost to suppress false-positive warnings for UML builds - fix namespace.pl to handle relative paths to ${objtree}, ${srctree} - make setlocalversion work for /bin/sh - make header archive reproducible - fix some Makefiles and documents * tag 'kbuild-fixes-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kheaders: make headers archive reproducible kbuild: update compile-test header list for v5.4-rc2 kbuild: two minor updates for Documentation/kbuild/modules.rst scripts/setlocalversion: clear local variable to make it work for sh namespace: fix namespace.pl script to support relative paths video/logo: do not generate unneeded logo C files video/logo: remove unneeded *.o pattern from clean-files integrity: remove pointless subdir-$(CONFIG_...) integrity: remove unneeded, broken attempt to add -fshort-wchar modpost: fix static EXPORT_SYMBOL warnings for UML build kbuild: correct formatting of header in kbuild module docs kbuild: remove SUBDIRS support kbuild: remove ar-option and KBUILD_ARFLAGS

Linus Torvalds committed 7 years ago

Commit 2d00aee2 parents 126195c 86cdd2f15 files · +41 −86Browse files

Unified · Split

15 files
  1. Documentation/kbuild/makefiles.rst +0 −5
  2. Documentation/kbuild/modules.rst +4 −3
  3. Documentation/kbuild/reproducible-builds.rst +9 −4
  4. Makefile +2 −22
  5. arch/powerpc/boot/Makefile +1 −1
  6. drivers/video/logo/Makefile +2 −19
  7. kernel/gen_kheaders.sh +4 −1
  8. scripts/Kbuild.include +0 −5
  9. scripts/Makefile.build +1 −1
  10. scripts/Makefile.lib +1 −1
  11. scripts/mod/modpost.c +9 −4
  12. scripts/namespace.pl +7 −6
  13. scripts/setlocalversion +1 −1
  14. security/integrity/Makefile +0 −3
  15. usr/include/Makefile +0 −10
Documentation/kbuild/makefiles.rst+0−5
@@ -954,11 +954,6 @@ When kbuild executes, the following steps are followed (roughly): · 953 unmodified lines
954 954
955 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).955 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
956 956
957 KBUILD_ARFLAGS Options for $(AR) when creating archives
958
959 $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
960 mode) if this option is supported by $(AR).
961
962 KBUILD_LDS957 KBUILD_LDS
963 958
964 The linker script with full path. Assigned by the top-level Makefile.959 The linker script with full path. Assigned by the top-level Makefile.
Documentation/kbuild/modules.rst+4−3
@@ -498,10 +498,11 @@ build. · 497 unmodified lines
498 will be written containing all exported symbols that were not498 will be written containing all exported symbols that were not
499 defined in the kernel.499 defined in the kernel.
500 500
501--- 6.3 Symbols From Another External Module5016.3 Symbols From Another External Module
502----------------------------------------
502 503
503 Sometimes, an external module uses exported symbols from504 Sometimes, an external module uses exported symbols from
504 another external module. kbuild needs to have full knowledge of505 another external module. Kbuild needs to have full knowledge of
505 all symbols to avoid spitting out warnings about undefined506 all symbols to avoid spitting out warnings about undefined
506 symbols. Three solutions exist for this situation.507 symbols. Three solutions exist for this situation.
507 508
@@ -521,7 +522,7 @@ build. · 13 unmodified lines
521 The top-level kbuild file would then look like::522 The top-level kbuild file would then look like::
522 523
523 #./Kbuild (or ./Makefile):524 #./Kbuild (or ./Makefile):
524 obj-y := foo/ bar/525 obj-m := foo/ bar/
525 526
526 And executing::527 And executing::
527 528
Documentation/kbuild/reproducible-builds.rst+9−4
@@ -16,16 +16,21 @@ the kernel may be unreproducible, and how to avoid them. · 15 unmodified lines
16Timestamps16Timestamps
17----------17----------
18 18
19The kernel embeds a timestamp in two places:19The kernel embeds timestamps in three places:
20 20
21* The version string exposed by ``uname()`` and included in21* The version string exposed by ``uname()`` and included in
22 ``/proc/version``22 ``/proc/version``
23 23
24* File timestamps in the embedded initramfs24* File timestamps in the embedded initramfs
25 25
26By default the timestamp is the current time. This must be overridden26* If enabled via ``CONFIG_IKHEADERS``, file timestamps of kernel
27using the `KBUILD_BUILD_TIMESTAMP`_ variable. If you are building27 headers embedded in the kernel or respective module,
28from a git commit, you could use its commit date.28 exposed via ``/sys/kernel/kheaders.tar.xz``
29
30By default the timestamp is the current time and in the case of
31``kheaders`` the various files' modification times. This must
32be overridden using the `KBUILD_BUILD_TIMESTAMP`_ variable.
33If you are building from a git commit, you could use its commit date.
29 34
30The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros,35The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros,
31and enables warnings if they are used. If you incorporate external36and enables warnings if they are used. If you incorporate external
Makefile+2−22
@@ -206,24 +206,8 @@ ifndef KBUILD_CHECKSRC · 205 unmodified lines
206 KBUILD_CHECKSRC = 0206 KBUILD_CHECKSRC = 0
207endif207endif
208 208
209# Use make M=dir to specify directory of external module to build209# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the
210# Old syntax make ... SUBDIRS=$PWD is still supported210# directory of external module to build. Setting M= takes precedence.
211# Setting the environment variable KBUILD_EXTMOD take precedence
212ifdef SUBDIRS
213 $(warning ================= WARNING ================)
214 $(warning 'SUBDIRS' will be removed after Linux 5.3)
215 $(warning )
216 $(warning If you are building an individual subdirectory)
217 $(warning in the kernel tree, you can do like this:)
218 $(warning $$ make path/to/dir/you/want/to/build/)
219 $(warning (Do not forget the trailing slash))
220 $(warning )
221 $(warning If you are building an external module,)
222 $(warning Please use 'M=' or 'KBUILD_EXTMOD' instead)
223 $(warning ==========================================)
224 KBUILD_EXTMOD ?= $(SUBDIRS)
225endif
226
227ifeq ("$(origin M)", "command line")211ifeq ("$(origin M)", "command line")
228 KBUILD_EXTMOD := $(M)212 KBUILD_EXTMOD := $(M)
229endif213endif
@@ -498,7 +482,6 @@ export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN · 268 unmodified lines
498export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE482export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
499export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE483export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
500export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL484export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
501export KBUILD_ARFLAGS
502 485
503# Files to ignore in find ... statements486# Files to ignore in find ... statements
504 487
@@ -914,9 +897,6 @@ ifdef CONFIG_RETPOLINE · 409 unmodified lines
914KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)897KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
915endif898endif
916 899
917# use the deterministic mode of AR if available
918KBUILD_ARFLAGS := $(call ar-option,D)
919
920include scripts/Makefile.kasan900include scripts/Makefile.kasan
921include scripts/Makefile.extrawarn901include scripts/Makefile.extrawarn
922include scripts/Makefile.ubsan902include scripts/Makefile.ubsan
arch/powerpc/boot/Makefile+1−1
@@ -50,7 +50,7 @@ endif · 49 unmodified lines
50 50
51BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc51BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
52 52
53BOOTARFLAGS := -cr$(KBUILD_ARFLAGS)53BOOTARFLAGS := -crD
54 54
55ifdef CONFIG_CC_IS_CLANG55ifdef CONFIG_CC_IS_CLANG
56BOOTCFLAGS += $(CLANG_FLAGS)56BOOTCFLAGS += $(CLANG_FLAGS)
drivers/video/logo/Makefile+2−19
@@ -18,23 +18,6 @@ obj-$(CONFIG_SPU_BASE) += logo_spe_clut224.o · 17 unmodified lines
18 18
19# How to generate logo's19# How to generate logo's
20 20
21# Use logo-cfiles to retrieve list of .c files to be built
22logo-cfiles = $(notdir $(patsubst %.$(2), %.c, \
23 $(wildcard $(srctree)/$(src)/*$(1).$(2))))
24
25
26# Mono logos
27extra-y += $(call logo-cfiles,_mono,pbm)
28
29# VGA16 logos
30extra-y += $(call logo-cfiles,_vga16,ppm)
31
32# 224 Logos
33extra-y += $(call logo-cfiles,_clut224,ppm)
34
35# Gray 256
36extra-y += $(call logo-cfiles,_gray256,pgm)
37
38pnmtologo := scripts/pnmtologo21pnmtologo := scripts/pnmtologo
39 22
40# Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."23# Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
@@ -55,5 +38,5 @@ $(obj)/%_clut224.c: $(src)/%_clut224.ppm $(pnmtologo) FORCE · 14 unmodified lines
55$(obj)/%_gray256.c: $(src)/%_gray256.pgm $(pnmtologo) FORCE38$(obj)/%_gray256.c: $(src)/%_gray256.pgm $(pnmtologo) FORCE
56 $(call if_changed,logo)39 $(call if_changed,logo)
57 40
58# Files generated that shall be removed upon make clean41# generated C files
59clean-files := *.o *_mono.c *_vga16.c *_clut224.c *_gray256.c42targets += *_mono.c *_vga16.c *_clut224.c *_gray256.c
kernel/gen_kheaders.sh+4−1
@@ -71,7 +71,10 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 · 70 unmodified lines
71find $cpio_dir -type f -print0 |71find $cpio_dir -type f -print0 |
72 xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;'72 xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;'
73 73
74tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null74# Create archive and try to normalize metadata for reproducibility
75tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
76 --owner=0 --group=0 --sort=name --numeric-owner \
77 -Jcf $tarfile -C $cpio_dir/ . > /dev/null
75 78
76echo "$src_files_md5" > kernel/kheaders.md579echo "$src_files_md5" > kernel/kheaders.md5
77echo "$obj_files_md5" >> kernel/kheaders.md580echo "$obj_files_md5" >> kernel/kheaders.md5
scripts/Kbuild.include+0−5
@@ -143,11 +143,6 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e · 142 unmodified lines
143# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)143# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
144ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))144ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
145 145
146# ar-option
147# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
148# Important: no spaces around options
149ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
150
151# ld-version146# ld-version
152# Note this is mainly for HJ Lu's 3 number binutil versions147# Note this is mainly for HJ Lu's 3 number binutil versions
153ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)148ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
scripts/Makefile.build+1−1
@@ -389,7 +389,7 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; · 388 unmodified lines
389ifdef builtin-target389ifdef builtin-target
390 390
391quiet_cmd_ar_builtin = AR $@391quiet_cmd_ar_builtin = AR $@
392 cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)392 cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs)
393 393
394$(builtin-target): $(real-obj-y) FORCE394$(builtin-target): $(real-obj-y) FORCE
395 $(call if_changed,ar_builtin)395 $(call if_changed,ar_builtin)
scripts/Makefile.lib+1−1
@@ -232,7 +232,7 @@ quiet_cmd_ld = LD $@ · 231 unmodified lines
232# ---------------------------------------------------------------------------232# ---------------------------------------------------------------------------
233 233
234quiet_cmd_ar = AR $@234quiet_cmd_ar = AR $@
235 cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)235 cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs)
236 236
237# Objcopy237# Objcopy
238# ---------------------------------------------------------------------------238# ---------------------------------------------------------------------------
scripts/mod/modpost.c+9−4
@@ -2652,15 +2652,20 @@ int main(int argc, char **argv) · 2651 unmodified lines
2652 fatal("modpost: Section mismatches detected.\n"2652 fatal("modpost: Section mismatches detected.\n"
2653 "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");2653 "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
2654 for (n = 0; n < SYMBOL_HASH_SIZE; n++) {2654 for (n = 0; n < SYMBOL_HASH_SIZE; n++) {
2655 struct symbol *s = symbolhash[n];2655 struct symbol *s;
2656
2657 for (s = symbolhash[n]; s; s = s->next) {
2658 /*
2659 * Do not check "vmlinux". This avoids the same warnings
2660 * shown twice, and false-positives for ARCH=um.
2661 */
2662 if (is_vmlinux(s->module->name) && !s->module->is_dot_o)
2663 continue;
2656 2664
2657 while (s) {
2658 if (s->is_static)2665 if (s->is_static)
2659 warn("\"%s\" [%s] is a static %s\n",2666 warn("\"%s\" [%s] is a static %s\n",
2660 s->name, s->module->name,2667 s->name, s->module->name,
2661 export_str(s->export));2668 export_str(s->export));
2662
2663 s = s->next;
2664 }2669 }
2665 }2670 }
2666 2671
scripts/namespace.pl+7−6
@@ -65,13 +65,14 @@ · 64 unmodified lines
65use warnings;65use warnings;
66use strict;66use strict;
67use File::Find;67use File::Find;
68use File::Spec;
68 69
69my $nm = ($ENV{'NM'} || "nm") . " -p";70my $nm = ($ENV{'NM'} || "nm") . " -p";
70my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment";71my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment";
71my $srctree = "";72my $srctree = File::Spec->curdir();
72my $objtree = "";73my $objtree = File::Spec->curdir();
73$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'}));74$srctree = File::Spec->rel2abs($ENV{'srctree'}) if (exists($ENV{'srctree'}));
74$objtree = "$ENV{'objtree'}/" if (exists($ENV{'objtree'}));75$objtree = File::Spec->rel2abs($ENV{'objtree'}) if (exists($ENV{'objtree'}));
75 76
76if ($#ARGV != -1) {77if ($#ARGV != -1) {
77 print STDERR "usage: $0 takes no parameters\n";78 print STDERR "usage: $0 takes no parameters\n";
@@ -231,9 +232,9 @@ sub do_nm · 153 unmodified lines
231 }232 }
232 ($source = $basename) =~ s/\.o$//;233 ($source = $basename) =~ s/\.o$//;
233 if (-e "$source.c" || -e "$source.S") {234 if (-e "$source.c" || -e "$source.S") {
234 $source = "$objtree$File::Find::dir/$source";235 $source = File::Spec->catfile($objtree, $File::Find::dir, $source)
235 } else {236 } else {
236 $source = "$srctree$File::Find::dir/$source";237 $source = File::Spec->catfile($srctree, $File::Find::dir, $source)
237 }238 }
238 if (! -e "$source.c" && ! -e "$source.S") {239 if (! -e "$source.c" && ! -e "$source.S") {
239 # No obvious source, exclude the object if it is conglomerate240 # No obvious source, exclude the object if it is conglomerate
scripts/setlocalversion+1−1
@@ -126,7 +126,7 @@ scm_version() · 125 unmodified lines
126 126
127collect_files()127collect_files()
128{128{
129 local file res129 local file res=
130 130
131 for file; do131 for file; do
132 case "$file" in132 case "$file" in
security/integrity/Makefile+0−3
@@ -13,9 +13,6 @@ integrity-$(CONFIG_INTEGRITY_PLATFORM_KEYRING) += platform_certs/platform_keyrin · 12 unmodified lines
13integrity-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \13integrity-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \
14 platform_certs/load_uefi.o14 platform_certs/load_uefi.o
15integrity-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o15integrity-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o
16$(obj)/load_uefi.o: KBUILD_CFLAGS += -fshort-wchar
17 16
18subdir-$(CONFIG_IMA) += ima
19obj-$(CONFIG_IMA) += ima/17obj-$(CONFIG_IMA) += ima/
20subdir-$(CONFIG_EVM) += evm
21obj-$(CONFIG_EVM) += evm/18obj-$(CONFIG_EVM) += evm/
usr/include/Makefile+0−10
@@ -29,13 +29,11 @@ header-test- += linux/android/binderfs.h · 28 unmodified lines
29header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h29header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h
30header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h30header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h
31header-test- += linux/coda.h31header-test- += linux/coda.h
32header-test- += linux/coda_psdev.h
33header-test- += linux/elfcore.h32header-test- += linux/elfcore.h
34header-test- += linux/errqueue.h33header-test- += linux/errqueue.h
35header-test- += linux/fsmap.h34header-test- += linux/fsmap.h
36header-test- += linux/hdlc/ioctl.h35header-test- += linux/hdlc/ioctl.h
37header-test- += linux/ivtv.h36header-test- += linux/ivtv.h
38header-test- += linux/jffs2.h
39header-test- += linux/kexec.h37header-test- += linux/kexec.h
40header-test- += linux/matroxfb.h38header-test- += linux/matroxfb.h
41header-test- += linux/netfilter_ipv4/ipt_LOG.h39header-test- += linux/netfilter_ipv4/ipt_LOG.h
@@ -55,20 +53,12 @@ header-test- += linux/v4l2-mediabus.h · 13 unmodified lines
55header-test- += linux/v4l2-subdev.h53header-test- += linux/v4l2-subdev.h
56header-test- += linux/videodev2.h54header-test- += linux/videodev2.h
57header-test- += linux/vm_sockets.h55header-test- += linux/vm_sockets.h
58header-test- += scsi/scsi_bsg_fc.h
59header-test- += scsi/scsi_netlink.h
60header-test- += scsi/scsi_netlink_fc.h
61header-test- += sound/asequencer.h56header-test- += sound/asequencer.h
62header-test- += sound/asoc.h57header-test- += sound/asoc.h
63header-test- += sound/asound.h58header-test- += sound/asound.h
64header-test- += sound/compress_offload.h59header-test- += sound/compress_offload.h
65header-test- += sound/emu10k1.h60header-test- += sound/emu10k1.h
66header-test- += sound/sfnt_info.h61header-test- += sound/sfnt_info.h
67header-test- += sound/sof/eq.h
68header-test- += sound/sof/fw.h
69header-test- += sound/sof/header.h
70header-test- += sound/sof/manifest.h
71header-test- += sound/sof/trace.h
72header-test- += xen/evtchn.h62header-test- += xen/evtchn.h
73header-test- += xen/gntdev.h63header-test- += xen/gntdev.h
74header-test- += xen/privcmd.h64header-test- += xen/privcmd.h

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t