Skip to content

Commit 80a04d3

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes: docbook: make cleandocs kbuild: fix spurious initramfs rebuild Documentation: explain the difference between __bitwise and __bitwise__ kbuild: make it possible for the linker to discard local symbols from vmlinux kbuild: remove pointless strdup() on arguments passed to new_module() in modpost kbuild: fix a few typos in top-level Makefile kbuild: introduce destination-y for exported headers kbuild: use git svn instead of git-svn in setlocalversion kconfig: fix update-po-config to accect backslash in input kbuild: fix option processing for -I in headerdep
2 parents eebb2af + 2810ae8 commit 80a04d3

11 files changed

Lines changed: 116 additions & 18 deletions

File tree

‎Documentation/DocBook/Makefile‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PS_METHOD = $(prefer-db2x)
3131

3232
###
3333
# The targets that may be used.
34-
PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs
34+
PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs
3535

3636
BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
3737
xmldocs: $(BOOKS)
@@ -213,11 +213,12 @@ silent_gen_xml = :
213213
dochelp:
214214
@echo ' Linux kernel internal documentation in different formats:'
215215
@echo ' htmldocs - HTML'
216-
@echo ' installmandocs - install man pages generated by mandocs'
217-
@echo ' mandocs - man pages'
218216
@echo ' pdfdocs - PDF'
219217
@echo ' psdocs - Postscript'
220218
@echo ' xmldocs - XML DocBook'
219+
@echo ' mandocs - man pages'
220+
@echo ' installmandocs - install man pages generated by mandocs'
221+
@echo ' cleandocs - clean all generated DocBook files'
221222

222223
###
223224
# Temporary files left by various tools
@@ -235,6 +236,10 @@ clean-files := $(DOCBOOKS) \
235236

236237
clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man
237238

239+
cleandocs:
240+
$(Q)rm -f $(call objectify, $(clean-files))
241+
$(Q)rm -rf $(call objectify, $(clean-dirs))
242+
238243
# Declare the contents of the .PHONY variable as phony. We keep that
239244
# information in a variable se we can use it in if_changed and friends.
240245

‎Documentation/kbuild/makefiles.txt‎

Lines changed: 75 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ This document describes the Linux kernel Makefiles.
4040
--- 6.7 Custom kbuild commands
4141
--- 6.8 Preprocessing linker scripts
4242

43-
=== 7 Kbuild Variables
44-
=== 8 Makefile language
45-
=== 9 Credits
46-
=== 10 TODO
43+
=== 7 Kbuild syntax for exported headers
44+
--- 7.1 header-y
45+
--- 7.2 objhdr-y
46+
--- 7.3 destination-y
47+
--- 7.4 unifdef-y (deprecated)
48+
49+
=== 8 Kbuild Variables
50+
=== 9 Makefile language
51+
=== 10 Credits
52+
=== 11 TODO
4753

4854
=== 1 Overview
4955

@@ -1143,8 +1149,69 @@ When kbuild executes, the following steps are followed (roughly):
11431149
The kbuild infrastructure for *lds file are used in several
11441150
architecture-specific files.
11451151

1152+
=== 7 Kbuild syntax for exported headers
1153+
1154+
The kernel include a set of headers that is exported to userspace.
1155+
Many headers can be exported as-is but other headers requires a
1156+
minimal pre-processing before they are ready for user-space.
1157+
The pre-processing does:
1158+
- drop kernel specific annotations
1159+
- drop include of compiler.h
1160+
- drop all sections that is kernel internat (guarded by ifdef __KERNEL__)
1161+
1162+
Each relevant directory contain a file name "Kbuild" which specify the
1163+
headers to be exported.
1164+
See subsequent chapter for the syntax of the Kbuild file.
1165+
1166+
--- 7.1 header-y
1167+
1168+
header-y specify header files to be exported.
1169+
1170+
Example:
1171+
#include/linux/Kbuild
1172+
header-y += usb/
1173+
header-y += aio_abi.h
1174+
1175+
The convention is to list one file per line and
1176+
preferably in alphabetic order.
1177+
1178+
header-y also specify which subdirectories to visit.
1179+
A subdirectory is identified by a trailing '/' which
1180+
can be seen in the example above for the usb subdirectory.
1181+
1182+
Subdirectories are visited before their parent directories.
1183+
1184+
--- 7.2 objhdr-y
1185+
1186+
objhdr-y specifies generated files to be exported.
1187+
Generated files are special as they need to be looked
1188+
up in another directory when doing 'make O=...' builds.
1189+
1190+
Example:
1191+
#include/linux/Kbuild
1192+
objhdr-y += version.h
1193+
1194+
--- 7.3 destination-y
1195+
1196+
When an architecture have a set of exported headers that needs to be
1197+
exported to a different directory destination-y is used.
1198+
destination-y specify the destination directory for all exported
1199+
headers in the file where it is present.
1200+
1201+
Example:
1202+
#arch/xtensa/platforms/s6105/include/platform/Kbuild
1203+
destination-y := include/linux
1204+
1205+
In the example above all exported headers in the Kbuild file
1206+
will be located in the directory "include/linux" when exported.
1207+
1208+
1209+
--- 7.4 unifdef-y (deprecated)
1210+
1211+
unifdef-y is deprecated. A direct replacement is header-y.
1212+
11461213

1147-
=== 7 Kbuild Variables
1214+
=== 8 Kbuild Variables
11481215

11491216
The top Makefile exports the following variables:
11501217

@@ -1206,7 +1273,7 @@ The top Makefile exports the following variables:
12061273
INSTALL_MOD_STRIP will used as the option(s) to the strip command.
12071274

12081275

1209-
=== 8 Makefile language
1276+
=== 9 Makefile language
12101277

12111278
The kernel Makefiles are designed to be run with GNU Make. The Makefiles
12121279
use only the documented features of GNU Make, but they do use many
@@ -1225,14 +1292,14 @@ time the left-hand side is used.
12251292
There are some cases where "=" is appropriate. Usually, though, ":="
12261293
is the right choice.
12271294

1228-
=== 9 Credits
1295+
=== 10 Credits
12291296

12301297
Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net>
12311298
Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
12321299
Updates by Sam Ravnborg <sam@ravnborg.org>
12331300
Language QA by Jan Engelhardt <jengelh@gmx.de>
12341301

1235-
=== 10 TODO
1302+
=== 11 TODO
12361303

12371304
- Describe how kbuild supports shipped files with _shipped.
12381305
- Generating offset header files.

‎Documentation/sparse.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ sure that bitwise types don't get mixed up (little-endian vs big-endian
4242
vs cpu-endian vs whatever), and there the constant "0" really _is_
4343
special.
4444

45+
__bitwise__ - to be used for relatively compact stuff (gfp_t, etc.) that
46+
is mostly warning-free and is supposed to stay that way. Warnings will
47+
be generated without __CHECK_ENDIAN__.
48+
49+
__bitwise - noisy stuff; in particular, __le*/__be* are that. We really
50+
don't want to drown in noise unless we'd explicitly asked for it.
51+
52+
4553
Getting sparse
4654
~~~~~~~~~~~~~~
4755

‎Makefile‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
567567
# disable pointer signed / unsigned warnings in gcc 4.0
568568
KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
569569

570-
# disable invalid "can't wrap" optimzations for signed / pointers
570+
# disable invalid "can't wrap" optimizations for signed / pointers
571571
KBUILD_CFLAGS += $(call cc-option,-fwrapv)
572572

573573
# revert to pre-gcc-4.4 behaviour of .eh_frame
@@ -597,6 +597,10 @@ LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
597597
LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
598598
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
599599

600+
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
601+
LDFLAGS_vmlinux += -X
602+
endif
603+
600604
# Default kernel image to build when no specific target is given.
601605
# KBUILD_IMAGE may be overruled on the command line or
602606
# set in the environment
@@ -1587,5 +1591,5 @@ PHONY += FORCE
15871591
FORCE:
15881592

15891593
# Declare the contents of the .PHONY variable as phony. We keep that
1590-
# information in a variable se we can use it in if_changed and friends.
1594+
# information in a variable so we can use it in if_changed and friends.
15911595
.PHONY: $(PHONY)

‎init/Kconfig‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,14 @@ config KALLSYMS_EXTRA_PASS
808808
you wait for kallsyms to be fixed.
809809

810810

811+
config STRIP_ASM_SYMS
812+
bool "Strip assembler-generated symbols during link"
813+
default n
814+
help
815+
Strip internal assembler-generated symbols during a link (symbols
816+
that look like '.Lxxx') so they don't pollute the output of
817+
get_wchan() and suchlike.
818+
811819
config HOTPLUG
812820
bool "Support for hot-pluggable devices" if EMBEDDED
813821
default y

‎scripts/Makefile.headersinst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ _dst := $(if $(dst),$(dst),$(obj))
1414
kbuild-file := $(srctree)/$(obj)/Kbuild
1515
include $(kbuild-file)
1616

17+
_dst := $(if $(destination-y),$(destination-y),$(_dst))
18+
1719
include scripts/Kbuild.include
1820

1921
install := $(INSTALL_HDR_PATH)/$(_dst)

‎scripts/gen_initramfs_list.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ print_mtime() {
9797
}
9898

9999
list_parse() {
100-
echo "$1 \\"
100+
[ ! -L "$1" ] && echo "$1 \\" || :
101101
}
102102

103103
# for each file print a line in following format

‎scripts/headerdep.pl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
version => \&version,
2020

2121
all => \$opt_all,
22-
I => \@opt_include,
22+
"I=s" => \@opt_include,
2323
graph => \$opt_graph,
2424
);
2525

‎scripts/kconfig/kxgettext.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ static char *escape(const char* text, char *bf, int len)
4343
++text;
4444
goto next;
4545
}
46+
else if (*text == '\\') {
47+
*bfp++ = '\\';
48+
len--;
49+
}
4650
*bfp++ = *text++;
4751
next:
4852
--len;

‎scripts/mod/modpost.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,7 @@ static void read_dump(const char *fname, unsigned int kernel)
19131913
if (!mod) {
19141914
if (is_vmlinux(modname))
19151915
have_vmlinux = 1;
1916-
mod = new_module(NOFAIL(strdup(modname)));
1916+
mod = new_module(modname);
19171917
mod->skip = 1;
19181918
}
19191919
s = sym_add_exported(symname, mod, export_no(export));
@@ -1997,7 +1997,7 @@ static void read_markers(const char *fname)
19971997

19981998
mod = find_module(modname);
19991999
if (!mod) {
2000-
mod = new_module(NOFAIL(strdup(modname)));
2000+
mod = new_module(modname);
20012001
mod->skip = 1;
20022002
}
20032003
if (is_vmlinux(modname)) {

0 commit comments

Comments
 (0)