aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-29 06:46:14 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-29 06:46:14 -0500
commit5ea293a9048d3a58cb0c840fa719d85ad14cba47 (patch)
tree88d1dd1eece2cfcbd858ff2c00fb0240dcfab3c7
parent03bc26cfefd6db756e6bc7fcda11dc17ada7be16 (diff)
parentd3883ecebbf9e095b9e379dabbbe8b2c1ee7a41c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (79 commits) Remove references to "make dep" kconfig: document use of HAVE_* Introduce new section reference annotations tags: __ref, __refdata, __refconst kbuild: warn about ld added unique sections kbuild: add verbose option to Section mismatch reporting in modpost kconfig: tristate choices with mixed tristate and boolean values asm-generic/vmlix.lds.h: simplify __mem{init,exit}* dependencies remove __attribute_used__ kbuild: support ARCH=x86 in buildtar kconfig: remove "enable" kbuild: simplified warning report in modpost kbuild: introduce a few helpers in modpost kbuild: use simpler section mismatch warnings in modpost kbuild: link vmlinux.o before kallsyms passes kbuild: introduce new option to enhance section mismatch analysis Use separate sections for __dev/__cpu/__mem code/data compiler.h: introduce __section() all archs: consolidate init and exit sections in vmlinux.lds.h kbuild: check section names consistently in modpost kbuild: introduce blacklisting in modpost ...
-rw-r--r--.gitignore1
-rw-r--r--Documentation/kbuild/kconfig-language.txt111
-rw-r--r--Makefile28
-rw-r--r--arch/alpha/kernel/vmlinux.lds.S8
-rw-r--r--arch/alpha/lib/dec_and_lock.c3
-rw-r--r--arch/arm/kernel/vmlinux.lds.S10
-rw-r--r--arch/arm/mach-imx/Makefile3
-rw-r--r--arch/arm/mach-netx/Makefile3
-rw-r--r--arch/avr32/kernel/vmlinux.lds.S8
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S8
-rw-r--r--arch/cris/arch-v10/vmlinux.lds.S8
-rw-r--r--arch/cris/arch-v32/boot/compressed/Makefile2
-rw-r--r--arch/cris/arch-v32/vmlinux.lds.S8
-rw-r--r--arch/frv/boot/Makefile8
-rw-r--r--arch/frv/kernel/gdb-stub.c2
-rw-r--r--arch/frv/kernel/vmlinux.lds.S14
-rw-r--r--arch/h8300/kernel/vmlinux.lds.S8
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S8
-rw-r--r--arch/m32r/kernel/vmlinux.lds.S12
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds8
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds8
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S8
-rw-r--r--arch/mips/kernel/vmlinux.lds.S8
-rw-r--r--arch/mips/tx4927/common/Makefile4
-rw-r--r--arch/mips/tx4938/common/Makefile4
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/Makefile4
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S8
-rw-r--r--arch/powerpc/boot/Makefile2
-rw-r--r--arch/powerpc/kernel/sysfs.c2
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S10
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c6
-rw-r--r--arch/ppc/kernel/vmlinux.lds.S8
-rw-r--r--arch/s390/kernel/vmlinux.lds.S8
-rw-r--r--arch/sh/kernel/vmlinux_32.lds.S8
-rw-r--r--arch/sh/kernel/vmlinux_64.lds.S8
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S8
-rw-r--r--arch/sparc64/kernel/unaligned.c2
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S8
-rw-r--r--arch/um/include/init.h26
-rw-r--r--arch/um/kernel/dyn.lds.S4
-rw-r--r--arch/um/kernel/uml.lds.S4
-rw-r--r--arch/v850/kernel/vmlinux.lds.S10
-rw-r--r--arch/x86/kernel/vmlinux_32.lds.S14
-rw-r--r--arch/x86/kernel/vmlinux_64.lds.S19
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S9
-rw-r--r--arch/xtensa/mm/Makefile4
-rw-r--r--arch/xtensa/platform-iss/Makefile5
-rw-r--r--drivers/base/power/Makefile8
-rw-r--r--drivers/infiniband/hw/cxgb3/Makefile3
-rw-r--r--drivers/rapidio/rio.h4
-rw-r--r--fs/compat_ioctl.c2
-rw-r--r--fs/smbfs/Makefile20
-rw-r--r--include/asm-avr32/setup.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h89
-rw-r--r--include/asm-ia64/gcc_intrin.h2
-rw-r--r--include/asm-sh/machvec.h2
-rw-r--r--include/asm-sh/thread_info.h2
-rw-r--r--include/asm-x86/thread_info_32.h2
-rw-r--r--include/linux/Kbuild8
-rw-r--r--include/linux/compiler-gcc3.h2
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler.h9
-rw-r--r--include/linux/elfnote.h2
-rw-r--r--include/linux/init.h130
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/moduleparam.h4
-rw-r--r--include/linux/pci.h2
-rw-r--r--init/Kconfig8
-rw-r--r--lib/Kconfig.debug32
-rw-r--r--scripts/Makefile.build26
-rw-r--r--scripts/Makefile.lib6
-rw-r--r--scripts/Makefile.modinst2
-rw-r--r--scripts/Makefile.modpost1
-rw-r--r--scripts/basic/docproc.c44
-rw-r--r--scripts/decodecode17
-rw-r--r--scripts/gcc-version.sh5
-rw-r--r--scripts/genksyms/genksyms.c10
-rw-r--r--scripts/kconfig/Makefile39
-rw-r--r--scripts/kconfig/POTFILES.in7
-rw-r--r--scripts/kconfig/conf.c69
-rw-r--r--scripts/kconfig/confdata.c24
-rw-r--r--scripts/kconfig/expr.c32
-rw-r--r--scripts/kconfig/expr.h16
-rw-r--r--scripts/kconfig/gconf.c16
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped5
-rw-r--r--scripts/kconfig/lkc.h5
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh16
-rw-r--r--scripts/kconfig/lxdialog/checklist.c4
-rw-r--r--scripts/kconfig/lxdialog/dialog.h11
-rw-r--r--scripts/kconfig/lxdialog/inputbox.c4
-rw-r--r--scripts/kconfig/lxdialog/menubox.c6
-rw-r--r--scripts/kconfig/lxdialog/textbox.c2
-rw-r--r--scripts/kconfig/lxdialog/util.c32
-rw-r--r--scripts/kconfig/lxdialog/yesno.c4
-rw-r--r--scripts/kconfig/mconf.c112
-rw-r--r--scripts/kconfig/menu.c49
-rw-r--r--scripts/kconfig/qconf.cc109
-rw-r--r--scripts/kconfig/symbol.c79
-rw-r--r--scripts/kconfig/util.c23
-rw-r--r--scripts/kconfig/zconf.gperf2
-rw-r--r--scripts/kconfig/zconf.hash.c_shipped19
-rw-r--r--scripts/kconfig/zconf.l5
-rwxr-xr-xscripts/kernel-doc85
-rw-r--r--scripts/mkmakefile10
-rw-r--r--scripts/mod/modpost.c1210
-rw-r--r--scripts/mod/modpost.h2
-rw-r--r--scripts/package/Makefile5
-rw-r--r--scripts/package/buildtar4
-rwxr-xr-xscripts/patch-kernel22
-rw-r--r--scripts/setlocalversion29
110 files changed, 1833 insertions, 1143 deletions
diff --git a/.gitignore b/.gitignore
index 8d14531846b9..8363e48cdcdc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@
17*.i 17*.i
18*.lst 18*.lst
19*.symtypes 19*.symtypes
20*.order
20 21
21# 22#
22# Top-level generic files 23# Top-level generic files
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index 616043a6da99..649cb8799890 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -24,7 +24,7 @@ visible if its parent entry is also visible.
24Menu entries 24Menu entries
25------------ 25------------
26 26
27Most entries define a config option, all other entries help to organize 27Most entries define a config option; all other entries help to organize
28them. A single configuration option is defined like this: 28them. A single configuration option is defined like this:
29 29
30config MODVERSIONS 30config MODVERSIONS
@@ -50,7 +50,7 @@ applicable everywhere (see syntax).
50 50
51- type definition: "bool"/"tristate"/"string"/"hex"/"int" 51- type definition: "bool"/"tristate"/"string"/"hex"/"int"
52 Every config option must have a type. There are only two basic types: 52 Every config option must have a type. There are only two basic types:
53 tristate and string, the other types are based on these two. The type 53 tristate and string; the other types are based on these two. The type
54 definition optionally accepts an input prompt, so these two examples 54 definition optionally accepts an input prompt, so these two examples
55 are equivalent: 55 are equivalent:
56 56
@@ -108,7 +108,7 @@ applicable everywhere (see syntax).
108 equal to 'y' without visiting the dependencies. So abusing 108 equal to 'y' without visiting the dependencies. So abusing
109 select you are able to select a symbol FOO even if FOO depends 109 select you are able to select a symbol FOO even if FOO depends
110 on BAR that is not set. In general use select only for 110 on BAR that is not set. In general use select only for
111 non-visible symbols (no promts anywhere) and for symbols with 111 non-visible symbols (no prompts anywhere) and for symbols with
112 no dependencies. That will limit the usefulness but on the 112 no dependencies. That will limit the usefulness but on the
113 other hand avoid the illegal configurations all over. kconfig 113 other hand avoid the illegal configurations all over. kconfig
114 should one day warn about such things. 114 should one day warn about such things.
@@ -127,6 +127,27 @@ applicable everywhere (see syntax).
127 used to help visually separate configuration logic from help within 127 used to help visually separate configuration logic from help within
128 the file as an aid to developers. 128 the file as an aid to developers.
129 129
130- misc options: "option" <symbol>[=<value>]
131 Various less common options can be defined via this option syntax,
132 which can modify the behaviour of the menu entry and its config
133 symbol. These options are currently possible:
134
135 - "defconfig_list"
136 This declares a list of default entries which can be used when
137 looking for the default configuration (which is used when the main
138 .config doesn't exists yet.)
139
140 - "modules"
141 This declares the symbol to be used as the MODULES symbol, which
142 enables the third modular state for all config symbols.
143
144 - "env"=<value>
145 This imports the environment variable into Kconfig. It behaves like
146 a default, except that the value comes from the environment, this
147 also means that the behaviour when mixing it with normal defaults is
148 undefined at this point. The symbol is currently not exported back
149 to the build environment (if this is desired, it can be done via
150 another symbol).
130 151
131Menu dependencies 152Menu dependencies
132----------------- 153-----------------
@@ -162,9 +183,9 @@ An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
162respectively for calculations). A menu entry becomes visible when it's 183respectively for calculations). A menu entry becomes visible when it's
163expression evaluates to 'm' or 'y'. 184expression evaluates to 'm' or 'y'.
164 185
165There are two types of symbols: constant and nonconstant symbols. 186There are two types of symbols: constant and non-constant symbols.
166Nonconstant symbols are the most common ones and are defined with the 187Non-constant symbols are the most common ones and are defined with the
167'config' statement. Nonconstant symbols consist entirely of alphanumeric 188'config' statement. Non-constant symbols consist entirely of alphanumeric
168characters or underscores. 189characters or underscores.
169Constant symbols are only part of expressions. Constant symbols are 190Constant symbols are only part of expressions. Constant symbols are
170always surrounded by single or double quotes. Within the quote, any 191always surrounded by single or double quotes. Within the quote, any
@@ -301,3 +322,81 @@ mainmenu:
301 322
302This sets the config program's title bar if the config program chooses 323This sets the config program's title bar if the config program chooses
303to use it. 324to use it.
325
326
327Kconfig hints
328-------------
329This is a collection of Kconfig tips, most of which aren't obvious at
330first glance and most of which have become idioms in several Kconfig
331files.
332
333Adding common features and make the usage configurable
334~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335It is a common idiom to implement a feature/functionality that are
336relevant for some architectures but not all.
337The recommended way to do so is to use a config variable named HAVE_*
338that is defined in a common Kconfig file and selected by the relevant
339architectures.
340An example is the generic IOMAP functionality.
341
342We would in lib/Kconfig see:
343
344# Generic IOMAP is used to ...
345config HAVE_GENERIC_IOMAP
346
347config GENERIC_IOMAP
348 depends on HAVE_GENERIC_IOMAP && FOO
349
350And in lib/Makefile we would see:
351obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
352
353For each architecture using the generic IOMAP functionality we would see:
354
355config X86
356 select ...
357 select HAVE_GENERIC_IOMAP
358 select ...
359
360Note: we use the existing config option and avoid creating a new
361config variable to select HAVE_GENERIC_IOMAP.
362
363Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
364introduced to overcome the limitation of select which will force a
365config option to 'y' no matter the dependencies.
366The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
367situation where select forces a symbol equals to 'y'.
368
369Build as module only
370~~~~~~~~~~~~~~~~~~~~
371To restrict a component build to module-only, qualify its config symbol
372with "depends on m". E.g.:
373
374config FOO
375 depends on BAR && m
376
377limits FOO to module (=m) or disabled (=n).
378
379
380Build limited by a third config symbol which may be =y or =m
381~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
382A common idiom that we see (and sometimes have problems with) is this:
383
384When option C in B (module or subsystem) uses interfaces from A (module
385or subsystem), and both A and B are tristate (could be =y or =m if they
386were independent of each other, but they aren't), then we need to limit
387C such that it cannot be built statically if A is built as a loadable
388module. (C already depends on B, so there is no dependency issue to
389take care of here.)
390
391If A is linked statically into the kernel image, C can be built
392statically or as loadable module(s). However, if A is built as loadable
393module(s), then C must be restricted to loadable module(s) also. This
394can be expressed in kconfig language as:
395
396config C
397 depends on A = y || A = B
398
399or for real examples, use this command in a kernel tree:
400
401$ find . -name Kconfig\* | xargs grep -ns "depends on.*=.*||.*=" | grep -v orig
402
diff --git a/Makefile b/Makefile
index 6d419f67939c..0f84c742ed0e 100644
--- a/Makefile
+++ b/Makefile
@@ -520,6 +520,11 @@ KBUILD_CFLAGS += -g
520KBUILD_AFLAGS += -gdwarf-2 520KBUILD_AFLAGS += -gdwarf-2
521endif 521endif
522 522
523# We trigger additional mismatches with less inlining
524ifdef CONFIG_DEBUG_SECTION_MISMATCH
525KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
526endif
527
523# Force gcc to behave correct even for buggy distributions 528# Force gcc to behave correct even for buggy distributions
524KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) 529KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
525 530
@@ -793,7 +798,7 @@ define rule_vmlinux-modpost
793endef 798endef
794 799
795# vmlinux image - including updated kernel symbols 800# vmlinux image - including updated kernel symbols
796vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE 801vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
797ifdef CONFIG_HEADERS_CHECK 802ifdef CONFIG_HEADERS_CHECK
798 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check 803 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
799endif 804endif
@@ -804,7 +809,9 @@ endif
804 $(call if_changed_rule,vmlinux__) 809 $(call if_changed_rule,vmlinux__)
805 $(Q)rm -f .old_version 810 $(Q)rm -f .old_version
806 811
807vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE 812# build vmlinux.o first to catch section mismatch errors early
813$(kallsyms.o): vmlinux.o
814vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE
808 $(call if_changed_rule,vmlinux-modpost) 815 $(call if_changed_rule,vmlinux-modpost)
809 816
810# The actual objects are generated when descending, 817# The actual objects are generated when descending,
@@ -1021,9 +1028,14 @@ ifdef CONFIG_MODULES
1021all: modules 1028all: modules
1022 1029
1023# Build modules 1030# Build modules
1031#
1032# A module can be listed more than once in obj-m resulting in
1033# duplicate lines in modules.order files. Those are removed
1034# using awk while concatenating to the final file.
1024 1035
1025PHONY += modules 1036PHONY += modules
1026modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) 1037modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
1038 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
1027 @echo ' Building modules, stage 2.'; 1039 @echo ' Building modules, stage 2.';
1028 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1040 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1029 1041
@@ -1051,6 +1063,7 @@ _modinst_:
1051 rm -f $(MODLIB)/build ; \ 1063 rm -f $(MODLIB)/build ; \
1052 ln -s $(objtree) $(MODLIB)/build ; \ 1064 ln -s $(objtree) $(MODLIB)/build ; \
1053 fi 1065 fi
1066 @cp -f $(objtree)/modules.order $(MODLIB)/
1054 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 1067 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1055 1068
1056# This depmod is only for convenience to give the initial 1069# This depmod is only for convenience to give the initial
@@ -1110,7 +1123,7 @@ clean: archclean $(clean-dirs)
1110 @find . $(RCS_FIND_IGNORE) \ 1123 @find . $(RCS_FIND_IGNORE) \
1111 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1124 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1112 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ 1125 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1113 -o -name '*.symtypes' \) \ 1126 -o -name '*.symtypes' -o -name 'modules.order' \) \
1114 -type f -print | xargs rm -f 1127 -type f -print | xargs rm -f
1115 1128
1116# mrproper - Delete all generated files, including .config 1129# mrproper - Delete all generated files, including .config
@@ -1175,7 +1188,7 @@ help:
1175 @echo ' dir/ - Build all files in dir and below' 1188 @echo ' dir/ - Build all files in dir and below'
1176 @echo ' dir/file.[ois] - Build specified target only' 1189 @echo ' dir/file.[ois] - Build specified target only'
1177 @echo ' dir/file.ko - Build module including final link' 1190 @echo ' dir/file.ko - Build module including final link'
1178 @echo ' rpm - Build a kernel as an RPM package' 1191 @echo ' prepare - Set up for building external modules'
1179 @echo ' tags/TAGS - Generate tags file for editors' 1192 @echo ' tags/TAGS - Generate tags file for editors'
1180 @echo ' cscope - Generate cscope index' 1193 @echo ' cscope - Generate cscope index'
1181 @echo ' kernelrelease - Output the release version string' 1194 @echo ' kernelrelease - Output the release version string'
@@ -1188,6 +1201,8 @@ help:
1188 @echo 'Static analysers' 1201 @echo 'Static analysers'
1189 @echo ' checkstack - Generate a list of stack hogs' 1202 @echo ' checkstack - Generate a list of stack hogs'
1190 @echo ' namespacecheck - Name space analysis on compiled kernel' 1203 @echo ' namespacecheck - Name space analysis on compiled kernel'
1204 @echo ' versioncheck - Sanity check on version.h usage'
1205 @echo ' includecheck - Check for duplicate included header files'
1191 @echo ' export_report - List the usages of all exported symbols' 1206 @echo ' export_report - List the usages of all exported symbols'
1192 @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ 1207 @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
1193 echo ' headers_check - Sanity check on exported headers'; \ 1208 echo ' headers_check - Sanity check on exported headers'; \
@@ -1371,6 +1386,7 @@ define xtags
1371 if $1 --version 2>&1 | grep -iq exuberant; then \ 1386 if $1 --version 2>&1 | grep -iq exuberant; then \
1372 $(all-sources) | xargs $1 -a \ 1387 $(all-sources) | xargs $1 -a \
1373 -I __initdata,__exitdata,__acquires,__releases \ 1388 -I __initdata,__exitdata,__acquires,__releases \
1389 -I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \
1374 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ 1390 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
1375 --extra=+f --c-kinds=+px \ 1391 --extra=+f --c-kinds=+px \
1376 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \ 1392 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \
@@ -1428,12 +1444,12 @@ tags: FORCE
1428includecheck: 1444includecheck:
1429 find * $(RCS_FIND_IGNORE) \ 1445 find * $(RCS_FIND_IGNORE) \
1430 -name '*.[hcS]' -type f -print | sort \ 1446 -name '*.[hcS]' -type f -print | sort \
1431 | xargs $(PERL) -w scripts/checkincludes.pl 1447 | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
1432 1448
1433versioncheck: 1449versioncheck:
1434 find * $(RCS_FIND_IGNORE) \ 1450 find * $(RCS_FIND_IGNORE) \
1435 -name '*.[hcS]' -type f -print | sort \ 1451 -name '*.[hcS]' -type f -print | sort \
1436 | xargs $(PERL) -w scripts/checkversion.pl 1452 | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
1437 1453
1438namespacecheck: 1454namespacecheck:
1439 $(PERL) $(srctree)/scripts/namespace.pl 1455 $(PERL) $(srctree)/scripts/namespace.pl
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index 55c05b511f4c..f13249be17c5 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -46,11 +46,11 @@ SECTIONS
46 __init_begin = .; 46 __init_begin = .;
47 .init.text : { 47 .init.text : {
48 _sinittext = .; 48 _sinittext = .;
49 *(.init.text) 49 INIT_TEXT
50 _einittext = .; 50 _einittext = .;
51 } 51 }
52 .init.data : { 52 .init.data : {
53 *(.init.data) 53 INIT_DATA
54 } 54 }
55 55
56 . = ALIGN(16); 56 . = ALIGN(16);
@@ -136,8 +136,8 @@ SECTIONS
136 136
137 /* Sections to be discarded */ 137 /* Sections to be discarded */
138 /DISCARD/ : { 138 /DISCARD/ : {
139 *(.exit.text) 139 EXIT_TEXT
140 *(.exit.data) 140 EXIT_DATA
141 *(.exitcall.exit) 141 *(.exitcall.exit)
142 } 142 }
143 143
diff --git a/arch/alpha/lib/dec_and_lock.c b/arch/alpha/lib/dec_and_lock.c
index 6ae2500a9d9e..0f5520d2f45f 100644
--- a/arch/alpha/lib/dec_and_lock.c
+++ b/arch/alpha/lib/dec_and_lock.c
@@ -30,8 +30,7 @@ _atomic_dec_and_lock: \n\
30 .previous \n\ 30 .previous \n\
31 .end _atomic_dec_and_lock"); 31 .end _atomic_dec_and_lock");
32 32
33static int __attribute_used__ 33static int __used atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
34atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
35{ 34{
36 /* Slow path */ 35 /* Slow path */
37 spin_lock(lock); 36 spin_lock(lock);
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 30f732c7fdb5..4898bdcfe7dd 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -30,7 +30,7 @@ SECTIONS
30 } 30 }
31 31
32 .init : { /* Init code and data */ 32 .init : { /* Init code and data */
33 *(.init.text) 33 INIT_TEXT
34 _einittext = .; 34 _einittext = .;
35 __proc_info_begin = .; 35 __proc_info_begin = .;
36 *(.proc.info.init) 36 *(.proc.info.init)
@@ -70,15 +70,15 @@ SECTIONS
70 __per_cpu_end = .; 70 __per_cpu_end = .;
71#ifndef CONFIG_XIP_KERNEL 71#ifndef CONFIG_XIP_KERNEL
72 __init_begin = _stext; 72 __init_begin = _stext;
73 *(.init.data) 73 INIT_DATA
74 . = ALIGN(4096); 74 . = ALIGN(4096);
75 __init_end = .; 75 __init_end = .;
76#endif 76#endif
77 } 77 }
78 78
79 /DISCARD/ : { /* Exit code and data */ 79 /DISCARD/ : { /* Exit code and data */
80 *(.exit.text) 80 EXIT_TEXT
81 *(.exit.data) 81 EXIT_DATA
82 *(.exitcall.exit) 82 *(.exitcall.exit)
83#ifndef CONFIG_MMU 83#ifndef CONFIG_MMU
84 *(.fixup) 84 *(.fixup)
@@ -130,7 +130,7 @@ SECTIONS
130#ifdef CONFIG_XIP_KERNEL 130#ifdef CONFIG_XIP_KERNEL
131 . = ALIGN(4096); 131 . = ALIGN(4096);
132 __init_begin = .; 132 __init_begin = .;
133 *(.init.data) 133 INIT_DATA
134 . = ALIGN(4096); 134 . = ALIGN(4096);
135 __init_end = .; 135 __init_end = .;
136#endif 136#endif
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 02272aa36e90..88d5e61a2e13 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -1,9 +1,6 @@
1# 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7 4
8# Object file lists. 5# Object file lists.
9 6
diff --git a/arch/arm/mach-netx/Makefile b/arch/arm/mach-netx/Makefile
index 18785ff37657..7ce4ba9eb242 100644
--- a/arch/arm/mach-netx/Makefile
+++ b/arch/arm/mach-netx/Makefile
@@ -1,9 +1,6 @@
1# 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7 4
8# Object file lists. 5# Object file lists.
9 6
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 11f08e35a2eb..481cfd40c053 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -27,19 +27,19 @@ SECTIONS
27 __init_begin = .; 27 __init_begin = .;
28 _sinittext = .; 28 _sinittext = .;
29 *(.text.reset) 29 *(.text.reset)
30 *(.init.text) 30 INIT_TEXT
31 /* 31 /*
32 * .exit.text is discarded at runtime, not 32 * .exit.text is discarded at runtime, not
33 * link time, to deal with references from 33 * link time, to deal with references from
34 * __bug_table 34 * __bug_table
35 */ 35 */
36 *(.exit.text) 36 EXIT_TEXT
37 _einittext = .; 37 _einittext = .;
38 . = ALIGN(4); 38 . = ALIGN(4);
39 __tagtable_begin = .; 39 __tagtable_begin = .;
40 *(.taglist.init) 40 *(.taglist.init)
41 __tagtable_end = .; 41 __tagtable_end = .;
42 *(.init.data) 42 INIT_DATA
43 . = ALIGN(16); 43 . = ALIGN(16);
44 __setup_start = .; 44 __setup_start = .;
45 *(.init.setup) 45 *(.init.setup)
@@ -135,7 +135,7 @@ SECTIONS
135 * thrown away, as cleanup code is never called unless it's a module. 135 * thrown away, as cleanup code is never called unless it's a module.
136 */ 136 */
137 /DISCARD/ : { 137 /DISCARD/ : {
138 *(.exit.data) 138 EXIT_DATA
139 *(.exitcall.exit) 139 *(.exitcall.exit)
140 } 140 }
141 141
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 9b75bc83c71f..858722421b40 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -91,13 +91,13 @@ SECTIONS
91 { 91 {
92 . = ALIGN(PAGE_SIZE); 92 . = ALIGN(PAGE_SIZE);
93 __sinittext = .; 93 __sinittext = .;
94 *(.init.text) 94 INIT_TEXT
95 __einittext = .; 95 __einittext = .;
96 } 96 }
97 .init.data : 97 .init.data :
98 { 98 {
99 . = ALIGN(16); 99 . = ALIGN(16);
100 *(.init.data) 100 INIT_DATA
101 } 101 }
102 .init.setup : 102 .init.setup :
103 { 103 {
@@ -198,8 +198,8 @@ SECTIONS
198 198
199 /DISCARD/ : 199 /DISCARD/ :
200 { 200 {
201 *(.exit.text) 201 EXIT_TEXT
202 *(.exit.data) 202 EXIT_DATA
203 *(.exitcall.exit) 203 *(.exitcall.exit)
204 } 204 }
205} 205}
diff --git a/arch/cris/arch-v10/vmlinux.lds.S b/arch/cris/arch-v10/vmlinux.lds.S
index 97a7876ed681..93c9f0ea286b 100644
--- a/arch/cris/arch-v10/vmlinux.lds.S
+++ b/arch/cris/arch-v10/vmlinux.lds.S
@@ -57,10 +57,10 @@ SECTIONS
57 __init_begin = .; 57 __init_begin = .;
58 .init.text : { 58 .init.text : {
59 _sinittext = .; 59 _sinittext = .;
60 *(.init.text) 60 INIT_TEXT
61 _einittext = .; 61 _einittext = .;
62 } 62 }
63 .init.data : { *(.init.data) } 63 .init.data : { INIT_DATA }
64 . = ALIGN(16); 64 . = ALIGN(16);
65 __setup_start = .; 65 __setup_start = .;
66 .init.setup : { *(.init.setup) } 66 .init.setup : { *(.init.setup) }
@@ -109,8 +109,8 @@ SECTIONS
109 109
110 /* Sections to be discarded */ 110 /* Sections to be discarded */
111 /DISCARD/ : { 111 /DISCARD/ : {
112 *(.text.exit) 112 EXIT_TEXT
113 *(.data.exit) 113 EXIT_DATA
114 *(.exitcall.exit) 114 *(.exitcall.exit)
115 } 115 }
116 116
diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
index 9f77eda914ba..609692f9d5eb 100644
--- a/arch/cris/arch-v32/boot/compressed/Makefile
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -7,7 +7,7 @@
7target = $(target_compressed_dir) 7target = $(target_compressed_dir)
8src = $(src_compressed_dir) 8src = $(src_compressed_dir)
9 9
10CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include 10CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
11CFLAGS = -O2 11CFLAGS = -O2
12LD = gcc-cris -mlinux -march=v32 -nostdlib 12LD = gcc-cris -mlinux -march=v32 -nostdlib
13OBJCOPY = objcopy-cris 13OBJCOPY = objcopy-cris
diff --git a/arch/cris/arch-v32/vmlinux.lds.S b/arch/cris/arch-v32/vmlinux.lds.S
index b076c134c0bb..fead8c59ea63 100644
--- a/arch/cris/arch-v32/vmlinux.lds.S
+++ b/arch/cris/arch-v32/vmlinux.lds.S
@@ -61,10 +61,10 @@ SECTIONS
61 __init_begin = .; 61 __init_begin = .;
62 .init.text : { 62 .init.text : {
63 _sinittext = .; 63 _sinittext = .;
64 *(.init.text) 64 INIT_TEXT
65 _einittext = .; 65 _einittext = .;
66 } 66 }
67 .init.data : { *(.init.data) } 67 .init.data : { INIT_DATA }
68 . = ALIGN(16); 68 . = ALIGN(16);
69 __setup_start = .; 69 __setup_start = .;
70 .init.setup : { *(.init.setup) } 70 .init.setup : { *(.init.setup) }
@@ -124,8 +124,8 @@ SECTIONS
124 124
125 /* Sections to be discarded */ 125 /* Sections to be discarded */
126 /DISCARD/ : { 126 /DISCARD/ : {
127 *(.text.exit) 127 EXIT_TEXT
128 *(.data.exit) 128 EXIT_DATA
129 *(.exitcall.exit) 129 *(.exitcall.exit)
130 } 130 }
131 131
diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile
index dc6f03824423..6ae3254da019 100644
--- a/arch/frv/boot/Makefile
+++ b/arch/frv/boot/Makefile
@@ -10,7 +10,7 @@
10 10
11targets := Image zImage bootpImage 11targets := Image zImage bootpImage
12 12
13SYSTEM =$(TOPDIR)/$(LINUX) 13SYSTEM =$(LINUX)
14 14
15ZTEXTADDR = 0x02080000 15ZTEXTADDR = 0x02080000
16PARAMS_PHYS = 0x0207c000 16PARAMS_PHYS = 0x0207c000
@@ -45,7 +45,7 @@ zImage: $(CONFIGURE) compressed/$(LINUX)
45bootpImage: bootp/bootp 45bootpImage: bootp/bootp
46 $(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@ 46 $(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@
47 47
48compressed/$(LINUX): $(TOPDIR)/$(LINUX) dep 48compressed/$(LINUX): $(LINUX) dep
49 @$(MAKE) -C compressed $(LINUX) 49 @$(MAKE) -C compressed $(LINUX)
50 50
51bootp/bootp: zImage initrd 51bootp/bootp: zImage initrd
@@ -59,10 +59,10 @@ initrd:
59# installation 59# installation
60# 60#
61install: $(CONFIGURE) Image 61install: $(CONFIGURE) Image
62 sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)" 62 sh ./install.sh $(KERNELRELEASE) Image System.map "$(INSTALL_PATH)"
63 63
64zinstall: $(CONFIGURE) zImage 64zinstall: $(CONFIGURE) zImage
65 sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)" 65 sh ./install.sh $(KERNELRELEASE) zImage System.map "$(INSTALL_PATH)"
66 66
67# 67#
68# miscellany 68# miscellany
diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c
index e89cad1192a9..48a0393e7cee 100644
--- a/arch/frv/kernel/gdb-stub.c
+++ b/arch/frv/kernel/gdb-stub.c
@@ -87,7 +87,7 @@
87 * Example: 87 * Example:
88 * $ cd ~/linux 88 * $ cd ~/linux
89 * $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging> 89 * $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging>
90 * $ make dep; make vmlinux 90 * $ make vmlinux
91 * 91 *
92 * Step 3: 92 * Step 3:
93 * Download the kernel to the remote target and start 93 * Download the kernel to the remote target and start
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index a17a81d58bf6..f42b328b1dd0 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -28,14 +28,14 @@ SECTIONS
28 .init.text : { 28 .init.text : {
29 *(.text.head) 29 *(.text.head)
30#ifndef CONFIG_DEBUG_INFO 30#ifndef CONFIG_DEBUG_INFO
31 *(.init.text) 31 INIT_TEXT
32 *(.exit.text) 32 EXIT_TEXT
33 *(.exit.data) 33 EXIT_DATA
34 *(.exitcall.exit) 34 *(.exitcall.exit)
35#endif 35#endif
36 } 36 }
37 _einittext = .; 37 _einittext = .;
38 .init.data : { *(.init.data) } 38 .init.data : { INIT_DATA }
39 39
40 . = ALIGN(8); 40 . = ALIGN(8);
41 __setup_start = .; 41 __setup_start = .;
@@ -106,8 +106,8 @@ SECTIONS
106 LOCK_TEXT 106 LOCK_TEXT
107#ifdef CONFIG_DEBUG_INFO 107#ifdef CONFIG_DEBUG_INFO
108 *( 108 *(
109 .init.text 109 INIT_TEXT
110 .exit.text 110 EXIT_TEXT
111 .exitcall.exit 111 .exitcall.exit
112 ) 112 )
113#endif 113#endif
@@ -138,7 +138,7 @@ SECTIONS
138 .data : { /* Data */ 138 .data : { /* Data */
139 DATA_DATA 139 DATA_DATA
140 *(.data.*) 140 *(.data.*)
141 *(.exit.data) 141 EXIT_DATA
142 CONSTRUCTORS 142 CONSTRUCTORS
143 } 143 }
144 144
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index a2e72d495551..43a87b9085b6 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -110,9 +110,9 @@ SECTIONS
110 . = ALIGN(0x4) ; 110 . = ALIGN(0x4) ;
111 ___init_begin = .; 111 ___init_begin = .;
112 __sinittext = .; 112 __sinittext = .;
113 *(.init.text) 113 INIT_TEXT
114 __einittext = .; 114 __einittext = .;
115 *(.init.data) 115 INIT_DATA
116 . = ALIGN(0x4) ; 116 . = ALIGN(0x4) ;
117 ___setup_start = .; 117 ___setup_start = .;
118 *(.init.setup) 118 *(.init.setup)
@@ -124,8 +124,8 @@ SECTIONS
124 ___con_initcall_start = .; 124 ___con_initcall_start = .;
125 *(.con_initcall.init) 125 *(.con_initcall.init)
126 ___con_initcall_end = .; 126 ___con_initcall_end = .;
127 *(.exit.text) 127 EXIT_TEXT
128 *(.exit.data) 128 EXIT_DATA
129#if defined(CONFIG_BLK_DEV_INITRD) 129#if defined(CONFIG_BLK_DEV_INITRD)
130 . = ALIGN(4); 130 . = ALIGN(4);
131 ___initramfs_start = .; 131 ___initramfs_start = .;
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 757e419ebcf8..80622acc95de 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -27,8 +27,8 @@ SECTIONS
27{ 27{
28 /* Sections to be discarded */ 28 /* Sections to be discarded */
29 /DISCARD/ : { 29 /DISCARD/ : {
30 *(.exit.text) 30 EXIT_TEXT
31 *(.exit.data) 31 EXIT_DATA
32 *(.exitcall.exit) 32 *(.exitcall.exit)
33 *(.IA_64.unwind.exit.text) 33 *(.IA_64.unwind.exit.text)
34 *(.IA_64.unwind_info.exit.text) 34 *(.IA_64.unwind_info.exit.text)
@@ -119,12 +119,12 @@ SECTIONS
119 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) 119 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET)
120 { 120 {
121 _sinittext = .; 121 _sinittext = .;
122 *(.init.text) 122 INIT_TEXT
123 _einittext = .; 123 _einittext = .;
124 } 124 }
125 125
126 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) 126 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET)
127 { *(.init.data) } 127 { INIT_DATA }
128 128
129#ifdef CONFIG_BLK_DEV_INITRD 129#ifdef CONFIG_BLK_DEV_INITRD
130 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) 130 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET)
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index 942a8c7a4417..41b07854fcc6 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -76,10 +76,10 @@ SECTIONS
76 __init_begin = .; 76 __init_begin = .;
77 .init.text : { 77 .init.text : {
78 _sinittext = .; 78 _sinittext = .;
79 *(.init.text) 79 INIT_TEXT
80 _einittext = .; 80 _einittext = .;
81 } 81 }
82 .init.data : { *(.init.data) } 82 .init.data : { INIT_DATA }
83 . = ALIGN(16); 83 . = ALIGN(16);
84 __setup_start = .; 84 __setup_start = .;
85 .init.setup : { *(.init.setup) } 85 .init.setup : { *(.init.setup) }
@@ -100,8 +100,8 @@ SECTIONS
100 .altinstr_replacement : { *(.altinstr_replacement) } 100 .altinstr_replacement : { *(.altinstr_replacement) }
101 /* .exit.text is discard at runtime, not link time, to deal with references 101 /* .exit.text is discard at runtime, not link time, to deal with references
102 from .altinstructions and .eh_frame */ 102 from .altinstructions and .eh_frame */
103 .exit.text : { *(.exit.text) } 103 .exit.text : { EXIT_TEXT }
104 .exit.data : { *(.exit.data) } 104 .exit.data : { EXIT_DATA }
105 105
106#ifdef CONFIG_BLK_DEV_INITRD 106#ifdef CONFIG_BLK_DEV_INITRD
107 . = ALIGN(4096); 107 . = ALIGN(4096);
@@ -124,8 +124,8 @@ SECTIONS
124 124
125 /* Sections to be discarded */ 125 /* Sections to be discarded */
126 /DISCARD/ : { 126 /DISCARD/ : {
127 *(.exit.text) 127 EXIT_TEXT
128 *(.exit.data) 128 EXIT_DATA
129 *(.exitcall.exit) 129 *(.exitcall.exit)
130 } 130 }
131 131
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 59fe285865ec..7537cc5e6159 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -45,10 +45,10 @@ SECTIONS
45 __init_begin = .; 45 __init_begin = .;
46 .init.text : { 46 .init.text : {
47 _sinittext = .; 47 _sinittext = .;
48 *(.init.text) 48 INIT_TEXT
49 _einittext = .; 49 _einittext = .;
50 } 50 }
51 .init.data : { *(.init.data) } 51 .init.data : { INIT_DATA }
52 . = ALIGN(16); 52 . = ALIGN(16);
53 __setup_start = .; 53 __setup_start = .;
54 .init.setup : { *(.init.setup) } 54 .init.setup : { *(.init.setup) }
@@ -82,8 +82,8 @@ SECTIONS
82 82
83 /* Sections to be discarded */ 83 /* Sections to be discarded */
84 /DISCARD/ : { 84 /DISCARD/ : {
85 *(.exit.text) 85 EXIT_TEXT
86 *(.exit.data) 86 EXIT_DATA
87 *(.exitcall.exit) 87 *(.exitcall.exit)
88 } 88 }
89 89
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index 4adffefb5c48..cdc313e7c299 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -38,10 +38,10 @@ SECTIONS
38__init_begin = .; 38__init_begin = .;
39 .init.text : { 39 .init.text : {
40 _sinittext = .; 40 _sinittext = .;
41 *(.init.text) 41 INIT_TEXT
42 _einittext = .; 42 _einittext = .;
43 } 43 }
44 .init.data : { *(.init.data) } 44 .init.data : { INIT_DATA }
45 . = ALIGN(16); 45 . = ALIGN(16);
46 __setup_start = .; 46 __setup_start = .;
47 .init.setup : { *(.init.setup) } 47 .init.setup : { *(.init.setup) }
@@ -77,8 +77,8 @@ __init_begin = .;
77 77
78 /* Sections to be discarded */ 78 /* Sections to be discarded */
79 /DISCARD/ : { 79 /DISCARD/ : {
80 *(.exit.text) 80 EXIT_TEXT
81 *(.exit.data) 81 EXIT_DATA
82 *(.exitcall.exit) 82 *(.exitcall.exit)
83 } 83 }
84 84
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 07a0055602f4..b44edb08e212 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -143,9 +143,9 @@ SECTIONS {
143 . = ALIGN(4096); 143 . = ALIGN(4096);
144 __init_begin = .; 144 __init_begin = .;
145 _sinittext = .; 145 _sinittext = .;
146 *(.init.text) 146 INIT_TEXT
147 _einittext = .; 147 _einittext = .;
148 *(.init.data) 148 INIT_DATA
149 . = ALIGN(16); 149 . = ALIGN(16);
150 __setup_start = .; 150 __setup_start = .;
151 *(.init.setup) 151 *(.init.setup)
@@ -170,8 +170,8 @@ SECTIONS {
170 } > INIT 170 } > INIT
171 171
172 /DISCARD/ : { 172 /DISCARD/ : {
173 *(.exit.text) 173 EXIT_TEXT
174 *(.exit.data) 174 EXIT_DATA
175 *(.exitcall.exit) 175 *(.exitcall.exit)
176 } 176 }
177 177
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 5fc2398bdb76..b5470ceb418b 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -114,11 +114,11 @@ SECTIONS
114 __init_begin = .; 114 __init_begin = .;
115 .init.text : { 115 .init.text : {
116 _sinittext = .; 116 _sinittext = .;
117 *(.init.text) 117 INIT_TEXT
118 _einittext = .; 118 _einittext = .;
119 } 119 }
120 .init.data : { 120 .init.data : {
121 *(.init.data) 121 INIT_DATA
122 } 122 }
123 . = ALIGN(16); 123 . = ALIGN(16);
124 .init.setup : { 124 .init.setup : {
@@ -144,10 +144,10 @@ SECTIONS
144 * references from .rodata 144 * references from .rodata
145 */ 145 */
146 .exit.text : { 146 .exit.text : {
147 *(.exit.text) 147 EXIT_TEXT
148 } 148 }
149 .exit.data : { 149 .exit.data : {
150 *(.exit.data) 150 EXIT_DATA
151 } 151 }
152#if defined(CONFIG_BLK_DEV_INITRD) 152#if defined(CONFIG_BLK_DEV_INITRD)
153 . = ALIGN(_PAGE_SIZE); 153 . = ALIGN(_PAGE_SIZE);
diff --git a/arch/mips/tx4927/common/Makefile b/arch/mips/tx4927/common/Makefile
index 18375787e094..e8629617f25d 100644
--- a/arch/mips/tx4927/common/Makefile
+++ b/arch/mips/tx4927/common/Makefile
@@ -1,10 +1,6 @@
1# 1#
2# Makefile for common code for Toshiba TX4927 based systems 2# Makefile for common code for Toshiba TX4927 based systems
3# 3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8 4
9obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o 5obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o
10 6
diff --git a/arch/mips/tx4938/common/Makefile b/arch/mips/tx4938/common/Makefile
index 8352eca67906..eff3d1d47f88 100644
--- a/arch/mips/tx4938/common/Makefile
+++ b/arch/mips/tx4938/common/Makefile
@@ -1,10 +1,6 @@
1# 1#
2# Makefile for common code for Toshiba TX4927 based systems 2# Makefile for common code for Toshiba TX4927 based systems
3# 3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8 4
9obj-y += prom.o setup.o irq.o 5obj-y += prom.o setup.o irq.o
10obj-$(CONFIG_KGDB) += dbgio.o 6obj-$(CONFIG_KGDB) += dbgio.o
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/Makefile b/arch/mips/tx4938/toshiba_rbtx4938/Makefile
index 675bb1c3e40c..2316dd7dd1bd 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/Makefile
+++ b/arch/mips/tx4938/toshiba_rbtx4938/Makefile
@@ -1,10 +1,6 @@
1# 1#
2# Makefile for common code for Toshiba TX4927 based systems 2# Makefile for common code for Toshiba TX4927 based systems
3# 3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8 4
9obj-y += prom.o setup.o irq.o spi_eeprom.o 5obj-y += prom.o setup.o irq.o spi_eeprom.o
10 6
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 40d0ff9b81ab..50b4a3a25d0a 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -172,11 +172,11 @@ SECTIONS
172 __init_begin = .; 172 __init_begin = .;
173 .init.text : { 173 .init.text : {
174 _sinittext = .; 174 _sinittext = .;
175 *(.init.text) 175 INIT_TEXT
176 _einittext = .; 176 _einittext = .;
177 } 177 }
178 .init.data : { 178 .init.data : {
179 *(.init.data) 179 INIT_DATA
180 } 180 }
181 . = ALIGN(16); 181 . = ALIGN(16);
182 .init.setup : { 182 .init.setup : {
@@ -215,10 +215,10 @@ SECTIONS
215 * from .altinstructions and .eh_frame 215 * from .altinstructions and .eh_frame
216 */ 216 */
217 .exit.text : { 217 .exit.text : {
218 *(.exit.text) 218 EXIT_TEXT
219 } 219 }
220 .exit.data : { 220 .exit.data : {
221 *(.exit.data) 221 EXIT_DATA
222 } 222 }
223#ifdef CONFIG_BLK_DEV_INITRD 223#ifdef CONFIG_BLK_DEV_INITRD
224 . = ALIGN(PAGE_SIZE); 224 . = ALIGN(PAGE_SIZE);
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 18e32719d0ed..4b1d98b8135e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -65,7 +65,7 @@ obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
65obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 65obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
66 66
67quiet_cmd_copy_zlib = COPY $@ 67quiet_cmd_copy_zlib = COPY $@
68 cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 68 cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
69 69
70quiet_cmd_copy_zlibheader = COPY $@ 70quiet_cmd_copy_zlibheader = COPY $@
71 cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ 71 cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 25d9a96484dd..c8127f832df0 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -158,7 +158,7 @@ static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
158 unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \ 158 unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \
159 return sprintf(buf, "%lx\n", val); \ 159 return sprintf(buf, "%lx\n", val); \
160} \ 160} \
161static ssize_t __attribute_used__ \ 161static ssize_t __used \
162 store_##NAME(struct sys_device *dev, const char *buf, size_t count) \ 162 store_##NAME(struct sys_device *dev, const char *buf, size_t count) \
163{ \ 163{ \
164 struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ 164 struct cpu *cpu = container_of(dev, struct cpu, sysdev); \
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index f66fa5d966b0..0afb9e31d2a0 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -23,7 +23,7 @@ SECTIONS
23 /* Sections to be discarded. */ 23 /* Sections to be discarded. */
24 /DISCARD/ : { 24 /DISCARD/ : {
25 *(.exitcall.exit) 25 *(.exitcall.exit)
26 *(.exit.data) 26 EXIT_DATA
27 } 27 }
28 28
29 . = KERNELBASE; 29 . = KERNELBASE;
@@ -76,17 +76,19 @@ SECTIONS
76 76
77 .init.text : { 77 .init.text : {
78 _sinittext = .; 78 _sinittext = .;
79 *(.init.text) 79 INIT_TEXT
80 _einittext = .; 80 _einittext = .;
81 } 81 }
82 82
83 /* .exit.text is discarded at runtime, not link time, 83 /* .exit.text is discarded at runtime, not link time,
84 * to deal with references from __bug_table 84 * to deal with references from __bug_table
85 */ 85 */
86 .exit.text : { *(.exit.text) } 86 .exit.text : {
87 EXIT_TEXT
88 }
87 89
88 .init.data : { 90 .init.data : {
89 *(.init.data); 91 INIT_DATA
90 __vtop_table_begin = .; 92 __vtop_table_begin = .;
91 *(.vtop_fixup); 93 *(.vtop_fixup);
92 __vtop_table_end = .; 94 __vtop_table_end = .;
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index cddc250a6a5c..446a8bbb847b 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -172,15 +172,15 @@ static void power4_stop(void)
172} 172}
173 173
174/* Fake functions used by canonicalize_pc */ 174/* Fake functions used by canonicalize_pc */
175static void __attribute_used__ hypervisor_bucket(void) 175static void __used hypervisor_bucket(void)
176{ 176{
177} 177}
178 178
179static void __attribute_used__ rtas_bucket(void) 179static void __used rtas_bucket(void)
180{ 180{
181} 181}
182 182
183static void __attribute_used__ kernel_unknown_bucket(void) 183static void __used kernel_unknown_bucket(void)
184{ 184{
185} 185}
186 186
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
index 98c1212674f6..52b64fcbdfc5 100644
--- a/arch/ppc/kernel/vmlinux.lds.S
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -97,14 +97,14 @@ SECTIONS
97 __init_begin = .; 97 __init_begin = .;
98 .init.text : { 98 .init.text : {
99 _sinittext = .; 99 _sinittext = .;
100 *(.init.text) 100 INIT_TEXT
101 _einittext = .; 101 _einittext = .;
102 } 102 }
103 /* .exit.text is discarded at runtime, not link time, 103 /* .exit.text is discarded at runtime, not link time,
104 to deal with references from __bug_table */ 104 to deal with references from __bug_table */
105 .exit.text : { *(.exit.text) } 105 .exit.text : { EXIT_TEXT }
106 .init.data : { 106 .init.data : {
107 *(.init.data); 107 INIT_DATA
108 __vtop_table_begin = .; 108 __vtop_table_begin = .;
109 *(.vtop_fixup); 109 *(.vtop_fixup);
110 __vtop_table_end = .; 110 __vtop_table_end = .;
@@ -164,6 +164,6 @@ SECTIONS
164 /* Sections to be discarded. */ 164 /* Sections to be discarded. */
165 /DISCARD/ : { 165 /DISCARD/ : {
166 *(.exitcall.exit) 166 *(.exitcall.exit)
167 *(.exit.data) 167 EXIT_DATA
168 } 168 }
169} 169}
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 936159199346..7d43c3cd3ef3 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -97,7 +97,7 @@ SECTIONS
97 __init_begin = .; 97 __init_begin = .;
98 .init.text : { 98 .init.text : {
99 _sinittext = .; 99 _sinittext = .;
100 *(.init.text) 100 INIT_TEXT
101 _einittext = .; 101 _einittext = .;
102 } 102 }
103 /* 103 /*
@@ -105,11 +105,11 @@ SECTIONS
105 * to deal with references from __bug_table 105 * to deal with references from __bug_table
106 */ 106 */
107 .exit.text : { 107 .exit.text : {
108 *(.exit.text) 108 EXIT_TEXT
109 } 109 }
110 110
111 .init.data : { 111 .init.data : {
112 *(.init.data) 112 INIT_DATA
113 } 113 }
114 . = ALIGN(0x100); 114 . = ALIGN(0x100);
115 .init.setup : { 115 .init.setup : {
@@ -156,7 +156,7 @@ SECTIONS
156 156
157 /* Sections to be discarded */ 157 /* Sections to be discarded */
158 /DISCARD/ : { 158 /DISCARD/ : {
159 *(.exit.data) 159 EXIT_DATA
160 *(.exitcall.exit) 160 *(.exitcall.exit)
161 } 161 }
162 162
diff --git a/arch/sh/kernel/vmlinux_32.lds.S b/arch/sh/kernel/vmlinux_32.lds.S
index d549fac6d3e7..c7113786ecd4 100644
--- a/arch/sh/kernel/vmlinux_32.lds.S
+++ b/arch/sh/kernel/vmlinux_32.lds.S
@@ -84,9 +84,9 @@ SECTIONS
84 . = ALIGN(PAGE_SIZE); /* Init code and data */ 84 . = ALIGN(PAGE_SIZE); /* Init code and data */
85 __init_begin = .; 85 __init_begin = .;
86 _sinittext = .; 86 _sinittext = .;
87 .init.text : { *(.init.text) } 87 .init.text : { INIT_TEXT }
88 _einittext = .; 88 _einittext = .;
89 .init.data : { *(.init.data) } 89 .init.data : { INIT_DATA }
90 90
91 . = ALIGN(16); 91 . = ALIGN(16);
92 __setup_start = .; 92 __setup_start = .;
@@ -122,8 +122,8 @@ SECTIONS
122 * .exit.text is discarded at runtime, not link time, to deal with 122 * .exit.text is discarded at runtime, not link time, to deal with
123 * references from __bug_table 123 * references from __bug_table
124 */ 124 */
125 .exit.text : { *(.exit.text) } 125 .exit.text : { EXIT_TEXT }
126 .exit.data : { *(.exit.data) } 126 .exit.data : { EXIT_DATA }
127 127
128 . = ALIGN(PAGE_SIZE); 128 . = ALIGN(PAGE_SIZE);
129 .bss : { 129 .bss : {
diff --git a/arch/sh/kernel/vmlinux_64.lds.S b/arch/sh/kernel/vmlinux_64.lds.S
index 2fd0f7401484..3f1bd6392bb3 100644
--- a/arch/sh/kernel/vmlinux_64.lds.S
+++ b/arch/sh/kernel/vmlinux_64.lds.S
@@ -96,9 +96,9 @@ SECTIONS
96 . = ALIGN(PAGE_SIZE); /* Init code and data */ 96 . = ALIGN(PAGE_SIZE); /* Init code and data */
97 __init_begin = .; 97 __init_begin = .;
98 _sinittext = .; 98 _sinittext = .;
99 .init.text : C_PHYS(.init.text) { *(.init.text) } 99 .init.text : C_PHYS(.init.text) { INIT_TEXT }
100 _einittext = .; 100 _einittext = .;
101 .init.data : C_PHYS(.init.data) { *(.init.data) } 101 .init.data : C_PHYS(.init.data) { INIT_DATA }
102 . = ALIGN(L1_CACHE_BYTES); /* Better if Cache Line aligned */ 102 . = ALIGN(L1_CACHE_BYTES); /* Better if Cache Line aligned */
103 __setup_start = .; 103 __setup_start = .;
104 .init.setup : C_PHYS(.init.setup) { *(.init.setup) } 104 .init.setup : C_PHYS(.init.setup) { *(.init.setup) }
@@ -134,8 +134,8 @@ SECTIONS
134 * .exit.text is discarded at runtime, not link time, to deal with 134 * .exit.text is discarded at runtime, not link time, to deal with
135 * references from __bug_table 135 * references from __bug_table
136 */ 136 */
137 .exit.text : C_PHYS(.exit.text) { *(.exit.text) } 137 .exit.text : C_PHYS(.exit.text) { EXIT_TEXT }
138 .exit.data : C_PHYS(.exit.data) { *(.exit.data) } 138 .exit.data : C_PHYS(.exit.data) { EXIT_DATA }
139 139
140 . = ALIGN(PAGE_SIZE); 140 . = ALIGN(PAGE_SIZE);
141 .bss : C_PHYS(.bss) { 141 .bss : C_PHYS(.bss) {
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index a8b4200f9cc3..216147d6e61f 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -48,12 +48,12 @@ SECTIONS
48 __init_begin = .; 48 __init_begin = .;
49 .init.text : { 49 .init.text : {
50 _sinittext = .; 50 _sinittext = .;
51 *(.init.text) 51 INIT_TEXT
52 _einittext = .; 52 _einittext = .;
53 } 53 }
54 __init_text_end = .; 54 __init_text_end = .;
55 .init.data : { 55 .init.data : {
56 *(.init.data) 56 INIT_DATA
57 } 57 }
58 . = ALIGN(16); 58 . = ALIGN(16);
59 .init.setup : { 59 .init.setup : {
@@ -102,8 +102,8 @@ SECTIONS
102 _end = . ; 102 _end = . ;
103 PROVIDE (end = .); 103 PROVIDE (end = .);
104 /DISCARD/ : { 104 /DISCARD/ : {
105 *(.exit.text) 105 EXIT_TEXT
106 *(.exit.data) 106 EXIT_DATA
107 *(.exitcall.exit) 107 *(.exitcall.exit)
108 } 108 }
109 109
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index 953be816fa25..dc7bf1b6321c 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -175,7 +175,7 @@ unsigned long compute_effective_address(struct pt_regs *regs,
175} 175}
176 176
177/* This is just to make gcc think die_if_kernel does return... */ 177/* This is just to make gcc think die_if_kernel does return... */
178static void __attribute_used__ unaligned_panic(char *str, struct pt_regs *regs) 178static void __used unaligned_panic(char *str, struct pt_regs *regs)
179{ 179{
180 die_if_kernel(str, regs); 180 die_if_kernel(str, regs);
181} 181}
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index 9fcd503bc04a..01f809617e5e 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -56,11 +56,11 @@ SECTIONS
56 .init.text : { 56 .init.text : {
57 __init_begin = .; 57 __init_begin = .;
58 _sinittext = .; 58 _sinittext = .;
59 *(.init.text) 59 INIT_TEXT
60 _einittext = .; 60 _einittext = .;
61 } 61 }
62 .init.data : { 62 .init.data : {
63 *(.init.data) 63 INIT_DATA
64 } 64 }
65 . = ALIGN(16); 65 . = ALIGN(16);
66 .init.setup : { 66 .init.setup : {
@@ -137,8 +137,8 @@ SECTIONS
137 PROVIDE (end = .); 137 PROVIDE (end = .);
138 138
139 /DISCARD/ : { 139 /DISCARD/ : {
140 *(.exit.text) 140 EXIT_TEXT
141 *(.exit.data) 141 EXIT_DATA
142 *(.exitcall.exit) 142 *(.exitcall.exit)
143 } 143 }
144 144
diff --git a/arch/um/include/init.h b/arch/um/include/init.h
index d4de7c0120ce..cebc6cae9190 100644
--- a/arch/um/include/init.h
+++ b/arch/um/include/init.h
@@ -42,15 +42,15 @@ typedef void (*exitcall_t)(void);
42 42
43/* These are for everybody (although not all archs will actually 43/* These are for everybody (although not all archs will actually
44 discard it in modules) */ 44 discard it in modules) */
45#define __init __attribute__ ((__section__ (".init.text"))) 45#define __init __section(.init.text)
46#define __initdata __attribute__ ((__section__ (".init.data"))) 46#define __initdata __section(.init.data)
47#define __exitdata __attribute__ ((__section__(".exit.data"))) 47#define __exitdata __section(.exit.data)
48#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 48#define __exit_call __used __section(.exitcall.exit)
49 49
50#ifdef MODULE 50#ifdef MODULE
51#define __exit __attribute__ ((__section__(".exit.text"))) 51#define __exit __section(.exit.text)
52#else 52#else
53#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) 53#define __exit __used __section(.exit.text)
54#endif 54#endif
55 55
56#endif 56#endif
@@ -103,16 +103,16 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
103 * Mark functions and data as being only used at initialization 103 * Mark functions and data as being only used at initialization
104 * or exit time. 104 * or exit time.
105 */ 105 */
106#define __uml_init_setup __attribute_used__ __attribute__ ((__section__ (".uml.setup.init"))) 106#define __uml_init_setup __used __section(.uml.setup.init)
107#define __uml_setup_help __attribute_used__ __attribute__ ((__section__ (".uml.help.init"))) 107#define __uml_setup_help __used __section(.uml.help.init)
108#define __uml_init_call __attribute_used__ __attribute__ ((__section__ (".uml.initcall.init"))) 108#define __uml_init_call __used __section(.uml.initcall.init)
109#define __uml_postsetup_call __attribute_used__ __attribute__ ((__section__ (".uml.postsetup.init"))) 109#define __uml_postsetup_call __used __section(.uml.postsetup.init)
110#define __uml_exit_call __attribute_used__ __attribute__ ((__section__ (".uml.exitcall.exit"))) 110#define __uml_exit_call __used __section(.uml.exitcall.exit)
111 111
112#ifndef __KERNEL__ 112#ifndef __KERNEL__
113 113
114#define __define_initcall(level,fn) \ 114#define __define_initcall(level,fn) \
115 static initcall_t __initcall_##fn __attribute_used__ \ 115 static initcall_t __initcall_##fn __used \
116 __attribute__((__section__(".initcall" level ".init"))) = fn 116 __attribute__((__section__(".initcall" level ".init"))) = fn
117 117
118/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll 118/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll
@@ -122,7 +122,7 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
122 122
123#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn 123#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
124 124
125#define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init"))) 125#define __init_call __used __section(.initcall.init)
126 126
127#endif 127#endif
128 128
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 3866f4960f04..26090b7f323e 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -17,7 +17,7 @@ SECTIONS
17 __init_begin = .; 17 __init_begin = .;
18 .init.text : { 18 .init.text : {
19 _sinittext = .; 19 _sinittext = .;
20 *(.init.text) 20 INIT_TEXT
21 _einittext = .; 21 _einittext = .;
22 } 22 }
23 23
@@ -84,7 +84,7 @@ SECTIONS
84 84
85 #include "asm/common.lds.S" 85 #include "asm/common.lds.S"
86 86
87 init.data : { *(.init.data) } 87 init.data : { INIT_DATA }
88 88
89 /* Ensure the __preinit_array_start label is properly aligned. We 89 /* Ensure the __preinit_array_start label is properly aligned. We
90 could instead move the label definition inside the section, but 90 could instead move the label definition inside the section, but
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 13df191e2b41..5828c1d54505 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -23,7 +23,7 @@ SECTIONS
23 __init_begin = .; 23 __init_begin = .;
24 .init.text : { 24 .init.text : {
25 _sinittext = .; 25 _sinittext = .;
26 *(.init.text) 26 INIT_TEXT
27 _einittext = .; 27 _einittext = .;
28 } 28 }
29 . = ALIGN(4096); 29 . = ALIGN(4096);
@@ -48,7 +48,7 @@ SECTIONS
48 48
49 #include "asm/common.lds.S" 49 #include "asm/common.lds.S"
50 50
51 init.data : { *(init.data) } 51 init.data : { INIT_DATA }
52 .data : 52 .data :
53 { 53 {
54 . = ALIGN(KERNEL_STACK_SIZE); /* init_task */ 54 . = ALIGN(KERNEL_STACK_SIZE); /* init_task */
diff --git a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
index 6172599b4ce2..d08cd1d27f27 100644
--- a/arch/v850/kernel/vmlinux.lds.S
+++ b/arch/v850/kernel/vmlinux.lds.S
@@ -114,7 +114,7 @@
114#define DATA_CONTENTS \ 114#define DATA_CONTENTS \
115 __sdata = . ; \ 115 __sdata = . ; \
116 DATA_DATA \ 116 DATA_DATA \
117 *(.exit.data) /* 2.5 convention */ \ 117 EXIT_DATA /* 2.5 convention */ \
118 *(.data.exit) /* 2.4 convention */ \ 118 *(.data.exit) /* 2.4 convention */ \
119 . = ALIGN (16) ; \ 119 . = ALIGN (16) ; \
120 *(.data.cacheline_aligned) \ 120 *(.data.cacheline_aligned) \
@@ -157,9 +157,9 @@
157 . = ALIGN (4096) ; \ 157 . = ALIGN (4096) ; \
158 __init_start = . ; \ 158 __init_start = . ; \
159 __sinittext = .; \ 159 __sinittext = .; \
160 *(.init.text) /* 2.5 convention */ \ 160 INIT_TEXT /* 2.5 convention */ \
161 __einittext = .; \ 161 __einittext = .; \
162 *(.init.data) \ 162 INIT_DATA \
163 *(.text.init) /* 2.4 convention */ \ 163 *(.text.init) /* 2.4 convention */ \
164 *(.data.init) \ 164 *(.data.init) \
165 INITCALL_CONTENTS \ 165 INITCALL_CONTENTS \
@@ -170,7 +170,7 @@
170#define ROMK_INIT_RAM_CONTENTS \ 170#define ROMK_INIT_RAM_CONTENTS \
171 . = ALIGN (4096) ; \ 171 . = ALIGN (4096) ; \
172 __init_start = . ; \ 172 __init_start = . ; \
173 *(.init.data) /* 2.5 convention */ \ 173 INIT_DATA /* 2.5 convention */ \
174 *(.data.init) /* 2.4 convention */ \ 174 *(.data.init) /* 2.4 convention */ \
175 __init_end = . ; \ 175 __init_end = . ; \
176 . = ALIGN (4096) ; 176 . = ALIGN (4096) ;
@@ -179,7 +179,7 @@
179 should go into ROM. */ 179 should go into ROM. */
180#define ROMK_INIT_ROM_CONTENTS \ 180#define ROMK_INIT_ROM_CONTENTS \
181 _sinittext = .; \ 181 _sinittext = .; \
182 *(.init.text) /* 2.5 convention */ \ 182 INIT_TEXT /* 2.5 convention */ \
183 _einittext = .; \ 183 _einittext = .; \
184 *(.text.init) /* 2.4 convention */ \ 184 *(.text.init) /* 2.4 convention */ \
185 INITCALL_CONTENTS \ 185 INITCALL_CONTENTS \
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index 7d72cce00529..84c913f38f98 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -131,10 +131,12 @@ SECTIONS
131 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 131 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
132 __init_begin = .; 132 __init_begin = .;
133 _sinittext = .; 133 _sinittext = .;
134 *(.init.text) 134 INIT_TEXT
135 _einittext = .; 135 _einittext = .;
136 } 136 }
137 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } 137 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
138 INIT_DATA
139 }
138 . = ALIGN(16); 140 . = ALIGN(16);
139 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { 141 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
140 __setup_start = .; 142 __setup_start = .;
@@ -169,8 +171,12 @@ SECTIONS
169 } 171 }
170 /* .exit.text is discard at runtime, not link time, to deal with references 172 /* .exit.text is discard at runtime, not link time, to deal with references
171 from .altinstructions and .eh_frame */ 173 from .altinstructions and .eh_frame */
172 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } 174 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
173 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } 175 EXIT_TEXT
176 }
177 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
178 EXIT_DATA
179 }
174#if defined(CONFIG_BLK_DEV_INITRD) 180#if defined(CONFIG_BLK_DEV_INITRD)
175 . = ALIGN(4096); 181 . = ALIGN(4096);
176 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { 182 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index ba8ea97abd21..ea5386944e67 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -155,12 +155,15 @@ SECTIONS
155 __init_begin = .; 155 __init_begin = .;
156 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 156 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
157 _sinittext = .; 157 _sinittext = .;
158 *(.init.text) 158 INIT_TEXT
159 _einittext = .; 159 _einittext = .;
160 } 160 }
161 __initdata_begin = .; 161 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
162 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } 162 __initdata_begin = .;
163 __initdata_end = .; 163 INIT_DATA
164 __initdata_end = .;
165 }
166
164 . = ALIGN(16); 167 . = ALIGN(16);
165 __setup_start = .; 168 __setup_start = .;
166 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) } 169 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
@@ -187,8 +190,12 @@ SECTIONS
187 } 190 }
188 /* .exit.text is discard at runtime, not link time, to deal with references 191 /* .exit.text is discard at runtime, not link time, to deal with references
189 from .altinstructions and .eh_frame */ 192 from .altinstructions and .eh_frame */
190 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } 193 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
191 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } 194 EXIT_TEXT
195 }
196 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
197 EXIT_DATA
198 }
192 199
193/* vdso blob that is mapped into user space */ 200/* vdso blob that is mapped into user space */
194 vdso_start = . ; 201 vdso_start = . ;
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index ac4ed52034db..7d0f55a4982d 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -136,13 +136,13 @@ SECTIONS
136 __init_begin = .; 136 __init_begin = .;
137 .init.text : { 137 .init.text : {
138 _sinittext = .; 138 _sinittext = .;
139 *(.init.literal) *(.init.text) 139 *(.init.literal) INIT_TEXT
140 _einittext = .; 140 _einittext = .;
141 } 141 }
142 142
143 .init.data : 143 .init.data :
144 { 144 {
145 *(.init.data) 145 INIT_DATA
146 . = ALIGN(0x4); 146 . = ALIGN(0x4);
147 __tagtable_begin = .; 147 __tagtable_begin = .;
148 *(.taglist) 148 *(.taglist)
@@ -278,8 +278,9 @@ SECTIONS
278 /* Sections to be discarded */ 278 /* Sections to be discarded */
279 /DISCARD/ : 279 /DISCARD/ :
280 { 280 {
281 *(.exit.literal .exit.text) 281 *(.exit.literal)
282 *(.exit.data) 282 EXIT_TEXT
283 EXIT_DATA
283 *(.exitcall.exit) 284 *(.exitcall.exit)
284 } 285 }
285 286
diff --git a/arch/xtensa/mm/Makefile b/arch/xtensa/mm/Makefile
index 10aec22a8f98..64e304a2f884 100644
--- a/arch/xtensa/mm/Makefile
+++ b/arch/xtensa/mm/Makefile
@@ -1,9 +1,5 @@
1# 1#
2# Makefile for the Linux/Xtensa-specific parts of the memory manager. 2# Makefile for the Linux/Xtensa-specific parts of the memory manager.
3# 3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8 4
9obj-y := init.o fault.o tlb.o misc.o cache.o 5obj-y := init.o fault.o tlb.o misc.o cache.o
diff --git a/arch/xtensa/platform-iss/Makefile b/arch/xtensa/platform-iss/Makefile
index 5b394e9620e5..af96e314d71f 100644
--- a/arch/xtensa/platform-iss/Makefile
+++ b/arch/xtensa/platform-iss/Makefile
@@ -3,11 +3,6 @@
3# Makefile for the Xtensa Instruction Set Simulator (ISS) 3# Makefile for the Xtensa Instruction Set Simulator (ISS)
4# "prom monitor" library routines under Linux. 4# "prom monitor" library routines under Linux.
5# 5#
6# Note! Dependencies are done automagically by 'make dep', which also
7# removes any old dependencies. DON'T put your own dependencies here
8# unless it's something special (ie not a .c file).
9#
10# Note 2! The CFLAGS definitions are in the main makefile...
11 6
12obj-y = io.o console.o setup.o network.o 7obj-y = io.o console.o setup.o network.o
13 8
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile
index 06a86fe6a78d..de28dfd3b96c 100644
--- a/drivers/base/power/Makefile
+++ b/drivers/base/power/Makefile
@@ -2,9 +2,5 @@ obj-$(CONFIG_PM) += sysfs.o
2obj-$(CONFIG_PM_SLEEP) += main.o 2obj-$(CONFIG_PM_SLEEP) += main.o
3obj-$(CONFIG_PM_TRACE) += trace.o 3obj-$(CONFIG_PM_TRACE) += trace.o
4 4
5ifeq ($(CONFIG_DEBUG_DRIVER),y) 5ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
6EXTRA_CFLAGS += -DDEBUG 6ccflags-$(CONFIG_PM_VERBOSE) += -DDEBUG
7endif
8ifeq ($(CONFIG_PM_VERBOSE),y)
9EXTRA_CFLAGS += -DDEBUG
10endif
diff --git a/drivers/infiniband/hw/cxgb3/Makefile b/drivers/infiniband/hw/cxgb3/Makefile
index 36b98989b15e..7e7b5a66f042 100644
--- a/drivers/infiniband/hw/cxgb3/Makefile
+++ b/drivers/infiniband/hw/cxgb3/Makefile
@@ -1,5 +1,4 @@
1EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \ 1EXTRA_CFLAGS += -Idrivers/net/cxgb3
2 -I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core
3 2
4obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o 3obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o
5 4
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h
index b242cee656e7..80e3f03b5041 100644
--- a/drivers/rapidio/rio.h
+++ b/drivers/rapidio/rio.h
@@ -31,8 +31,8 @@ extern struct rio_route_ops __end_rio_route_ops[];
31 31
32/* Helpers internal to the RIO core code */ 32/* Helpers internal to the RIO core code */
33#define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \ 33#define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \
34 static struct rio_route_ops __rio_route_ops __attribute_used__ \ 34 static struct rio_route_ops __rio_route_ops __used \
35 __attribute__((__section__(#section))) = { vid, did, add_hook, get_hook }; 35 __section(section)= { vid, did, add_hook, get_hook };
36 36
37/** 37/**
38 * DECLARE_RIO_ROUTE_OPS - Registers switch routing operations 38 * DECLARE_RIO_ROUTE_OPS - Registers switch routing operations
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index da8cb3b3592c..ffdc022cae64 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1376,7 +1376,7 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg)
1376 return -EINVAL; 1376 return -EINVAL;
1377} 1377}
1378 1378
1379static __attribute_used__ int 1379static __used int
1380ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg) 1380ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg)
1381{ 1381{
1382 return -EINVAL; 1382 return -EINVAL;
diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile
index 6673ee82cb4c..4faf8c4722c3 100644
--- a/fs/smbfs/Makefile
+++ b/fs/smbfs/Makefile
@@ -16,23 +16,3 @@ EXTRA_CFLAGS += -DSMBFS_PARANOIA
16#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP 16#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP
17#EXTRA_CFLAGS += -Werror 17#EXTRA_CFLAGS += -Werror
18 18
19#
20# Maintainer rules
21#
22
23# getopt.c not included. It is intentionally separate
24SRC = proc.c dir.c cache.c sock.c inode.c file.c ioctl.c smbiod.c request.c \
25 symlink.c
26
27proto:
28 -rm -f proto.h
29 @echo > proto2.h "/*"
30 @echo >> proto2.h " * Autogenerated with cproto on: " `date`
31 @echo >> proto2.h " */"
32 @echo >> proto2.h ""
33 @echo >> proto2.h "struct smb_request;"
34 @echo >> proto2.h "struct sock;"
35 @echo >> proto2.h "struct statfs;"
36 @echo >> proto2.h ""
37 cproto -E "gcc -E" -e -v -I $(TOPDIR)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
38 mv proto2.h proto.h
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h
index b0828d43e110..ea3070ff13a5 100644
--- a/include/asm-avr32/setup.h
+++ b/include/asm-avr32/setup.h
@@ -110,7 +110,7 @@ struct tagtable {
110 int (*parse)(struct tag *); 110 int (*parse)(struct tag *);
111}; 111};
112 112
113#define __tag __attribute_used__ __attribute__((__section__(".taglist.init"))) 113#define __tag __used __attribute__((__section__(".taglist.init")))
114#define __tagtable(tag, fn) \ 114#define __tagtable(tag, fn) \
115 static struct tagtable __tagtable_##fn __tag = { tag, fn } 115 static struct tagtable __tagtable_##fn __tag = { tag, fn }
116 116
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9f584cc5c5fb..76df771be585 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -9,10 +9,46 @@
9/* Align . to a 8 byte boundary equals to maximum function alignment. */ 9/* Align . to a 8 byte boundary equals to maximum function alignment. */
10#define ALIGN_FUNCTION() . = ALIGN(8) 10#define ALIGN_FUNCTION() . = ALIGN(8)
11 11
12/* The actual configuration determine if the init/exit sections
13 * are handled as text/data or they can be discarded (which
14 * often happens at runtime)
15 */
16#ifdef CONFIG_HOTPLUG
17#define DEV_KEEP(sec) *(.dev##sec)
18#define DEV_DISCARD(sec)
19#else
20#define DEV_KEEP(sec)
21#define DEV_DISCARD(sec) *(.dev##sec)
22#endif
23
24#ifdef CONFIG_HOTPLUG_CPU
25#define CPU_KEEP(sec) *(.cpu##sec)
26#define CPU_DISCARD(sec)
27#else
28#define CPU_KEEP(sec)
29#define CPU_DISCARD(sec) *(.cpu##sec)
30#endif
31
32#if defined(CONFIG_MEMORY_HOTPLUG)
33#define MEM_KEEP(sec) *(.mem##sec)
34#define MEM_DISCARD(sec)
35#else
36#define MEM_KEEP(sec)
37#define MEM_DISCARD(sec) *(.mem##sec)
38#endif
39
40
12/* .data section */ 41/* .data section */
13#define DATA_DATA \ 42#define DATA_DATA \
14 *(.data) \ 43 *(.data) \
15 *(.data.init.refok) \ 44 *(.data.init.refok) \
45 *(.ref.data) \
46 DEV_KEEP(init.data) \
47 DEV_KEEP(exit.data) \
48 CPU_KEEP(init.data) \
49 CPU_KEEP(exit.data) \
50 MEM_KEEP(init.data) \
51 MEM_KEEP(exit.data) \
16 . = ALIGN(8); \ 52 . = ALIGN(8); \
17 VMLINUX_SYMBOL(__start___markers) = .; \ 53 VMLINUX_SYMBOL(__start___markers) = .; \
18 *(__markers) \ 54 *(__markers) \
@@ -132,6 +168,17 @@
132 *(__ksymtab_strings) \ 168 *(__ksymtab_strings) \
133 } \ 169 } \
134 \ 170 \
171 /* __*init sections */ \
172 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
173 *(.ref.rodata) \
174 DEV_KEEP(init.rodata) \
175 DEV_KEEP(exit.rodata) \
176 CPU_KEEP(init.rodata) \
177 CPU_KEEP(exit.rodata) \
178 MEM_KEEP(init.rodata) \
179 MEM_KEEP(exit.rodata) \
180 } \
181 \
135 /* Built-in module parameters. */ \ 182 /* Built-in module parameters. */ \
136 __param : AT(ADDR(__param) - LOAD_OFFSET) { \ 183 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
137 VMLINUX_SYMBOL(__start___param) = .; \ 184 VMLINUX_SYMBOL(__start___param) = .; \
@@ -139,7 +186,6 @@
139 VMLINUX_SYMBOL(__stop___param) = .; \ 186 VMLINUX_SYMBOL(__stop___param) = .; \
140 VMLINUX_SYMBOL(__end_rodata) = .; \ 187 VMLINUX_SYMBOL(__end_rodata) = .; \
141 } \ 188 } \
142 \
143 . = ALIGN((align)); 189 . = ALIGN((align));
144 190
145/* RODATA provided for backward compatibility. 191/* RODATA provided for backward compatibility.
@@ -158,8 +204,16 @@
158#define TEXT_TEXT \ 204#define TEXT_TEXT \
159 ALIGN_FUNCTION(); \ 205 ALIGN_FUNCTION(); \
160 *(.text) \ 206 *(.text) \
207 *(.ref.text) \
161 *(.text.init.refok) \ 208 *(.text.init.refok) \
162 *(.exit.text.refok) 209 *(.exit.text.refok) \
210 DEV_KEEP(init.text) \
211 DEV_KEEP(exit.text) \
212 CPU_KEEP(init.text) \
213 CPU_KEEP(exit.text) \
214 MEM_KEEP(init.text) \
215 MEM_KEEP(exit.text)
216
163 217
164/* sched.text is aling to function alignment to secure we have same 218/* sched.text is aling to function alignment to secure we have same
165 * address even at second ld pass when generating System.map */ 219 * address even at second ld pass when generating System.map */
@@ -183,6 +237,37 @@
183 *(.kprobes.text) \ 237 *(.kprobes.text) \
184 VMLINUX_SYMBOL(__kprobes_text_end) = .; 238 VMLINUX_SYMBOL(__kprobes_text_end) = .;
185 239
240/* init and exit section handling */
241#define INIT_DATA \
242 *(.init.data) \
243 DEV_DISCARD(init.data) \
244 DEV_DISCARD(init.rodata) \
245 CPU_DISCARD(init.data) \
246 CPU_DISCARD(init.rodata) \
247 MEM_DISCARD(init.data) \
248 MEM_DISCARD(init.rodata)
249
250#define INIT_TEXT \
251 *(.init.text) \
252 DEV_DISCARD(init.text) \
253 CPU_DISCARD(init.text) \
254 MEM_DISCARD(init.text)
255
256#define EXIT_DATA \
257 *(.exit.data) \
258 DEV_DISCARD(exit.data) \
259 DEV_DISCARD(exit.rodata) \
260 CPU_DISCARD(exit.data) \
261 CPU_DISCARD(exit.rodata) \
262 MEM_DISCARD(exit.data) \
263 MEM_DISCARD(exit.rodata)
264
265#define EXIT_TEXT \
266 *(.exit.text) \
267 DEV_DISCARD(exit.text) \
268 CPU_DISCARD(exit.text) \
269 MEM_DISCARD(exit.text)
270
186 /* DWARF debug sections. 271 /* DWARF debug sections.
187 Symbols in the DWARF debugging sections are relative to 272 Symbols in the DWARF debugging sections are relative to
188 the beginning of the section so we begin them at 0. */ 273 the beginning of the section so we begin them at 0. */
diff --git a/include/asm-ia64/gcc_intrin.h b/include/asm-ia64/gcc_intrin.h
index e58d3298fa10..5b6665c754c9 100644
--- a/include/asm-ia64/gcc_intrin.h
+++ b/include/asm-ia64/gcc_intrin.h
@@ -24,7 +24,7 @@
24extern void ia64_bad_param_for_setreg (void); 24extern void ia64_bad_param_for_setreg (void);
25extern void ia64_bad_param_for_getreg (void); 25extern void ia64_bad_param_for_getreg (void);
26 26
27register unsigned long ia64_r13 asm ("r13") __attribute_used__; 27register unsigned long ia64_r13 asm ("r13") __used;
28 28
29#define ia64_setreg(regnum, val) \ 29#define ia64_setreg(regnum, val) \
30({ \ 30({ \
diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h
index ddb18ad23303..b2e4124070ae 100644
--- a/include/asm-sh/machvec.h
+++ b/include/asm-sh/machvec.h
@@ -65,6 +65,6 @@ extern struct sh_machine_vector sh_mv;
65#define get_system_type() sh_mv.mv_name 65#define get_system_type() sh_mv.mv_name
66 66
67#define __initmv \ 67#define __initmv \
68 __attribute_used__ __attribute__((__section__ (".machvec.init"))) 68 __used __section(.machvec.init)
69 69
70#endif /* _ASM_SH_MACHVEC_H */ 70#endif /* _ASM_SH_MACHVEC_H */
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index c6577d3dc46d..c50e5d35fe84 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -68,7 +68,7 @@ struct thread_info {
68#define init_stack (init_thread_union.stack) 68#define init_stack (init_thread_union.stack)
69 69
70/* how to get the current stack pointer from C */ 70/* how to get the current stack pointer from C */
71register unsigned long current_stack_pointer asm("r15") __attribute_used__; 71register unsigned long current_stack_pointer asm("r15") __used;
72 72
73/* how to get the thread information struct from C */ 73/* how to get the thread information struct from C */
74static inline struct thread_info *current_thread_info(void) 74static inline struct thread_info *current_thread_info(void)
diff --git a/include/asm-x86/thread_info_32.h b/include/asm-x86/thread_info_32.h
index ef58fd2a6eb0..a516e9192f11 100644
--- a/include/asm-x86/thread_info_32.h
+++ b/include/asm-x86/thread_info_32.h
@@ -85,7 +85,7 @@ struct thread_info {
85 85
86 86
87/* how to get the current stack pointer from C */ 87/* how to get the current stack pointer from C */
88register unsigned long current_stack_pointer asm("esp") __attribute_used__; 88register unsigned long current_stack_pointer asm("esp") __used;
89 89
90/* how to get the thread information struct from C */ 90/* how to get the thread information struct from C */
91static inline struct thread_info *current_thread_info(void) 91static inline struct thread_info *current_thread_info(void)
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index bd694f779346..ad99ce9f9169 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -34,7 +34,6 @@ header-y += atmsap.h
34header-y += atmsvc.h 34header-y += atmsvc.h
35header-y += atm_zatm.h 35header-y += atm_zatm.h
36header-y += auto_fs4.h 36header-y += auto_fs4.h
37header-y += auxvec.h
38header-y += ax25.h 37header-y += ax25.h
39header-y += b1lli.h 38header-y += b1lli.h
40header-y += baycom.h 39header-y += baycom.h
@@ -73,7 +72,7 @@ header-y += gen_stats.h
73header-y += gigaset_dev.h 72header-y += gigaset_dev.h
74header-y += hdsmart.h 73header-y += hdsmart.h
75header-y += hysdn_if.h 74header-y += hysdn_if.h
76header-y += i2c-dev.h 75header-y += i2o-dev.h
77header-y += i8k.h 76header-y += i8k.h
78header-y += if_arcnet.h 77header-y += if_arcnet.h
79header-y += if_bonding.h 78header-y += if_bonding.h
@@ -158,7 +157,6 @@ header-y += veth.h
158header-y += video_decoder.h 157header-y += video_decoder.h
159header-y += video_encoder.h 158header-y += video_encoder.h
160header-y += videotext.h 159header-y += videotext.h
161header-y += vt.h
162header-y += x25.h 160header-y += x25.h
163 161
164unifdef-y += acct.h 162unifdef-y += acct.h
@@ -173,6 +171,7 @@ unifdef-y += atm.h
173unifdef-y += atm_tcp.h 171unifdef-y += atm_tcp.h
174unifdef-y += audit.h 172unifdef-y += audit.h
175unifdef-y += auto_fs.h 173unifdef-y += auto_fs.h
174unifdef-y += auxvec.h
176unifdef-y += binfmts.h 175unifdef-y += binfmts.h
177unifdef-y += capability.h 176unifdef-y += capability.h
178unifdef-y += capi.h 177unifdef-y += capi.h
@@ -214,7 +213,7 @@ unifdef-y += hdreg.h
214unifdef-y += hiddev.h 213unifdef-y += hiddev.h
215unifdef-y += hpet.h 214unifdef-y += hpet.h
216unifdef-y += i2c.h 215unifdef-y += i2c.h
217unifdef-y += i2o-dev.h 216unifdef-y += i2c-dev.h
218unifdef-y += icmp.h 217unifdef-y += icmp.h
219unifdef-y += icmpv6.h 218unifdef-y += icmpv6.h
220unifdef-y += if_addr.h 219unifdef-y += if_addr.h
@@ -349,6 +348,7 @@ unifdef-y += videodev.h
349unifdef-y += virtio_config.h 348unifdef-y += virtio_config.h
350unifdef-y += virtio_blk.h 349unifdef-y += virtio_blk.h
351unifdef-y += virtio_net.h 350unifdef-y += virtio_net.h
351unifdef-y += vt.h
352unifdef-y += wait.h 352unifdef-y += wait.h
353unifdef-y += wanrouter.h 353unifdef-y += wanrouter.h
354unifdef-y += watchdog.h 354unifdef-y += watchdog.h
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 2d8c0f48f55e..e5eb795f78a1 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -7,10 +7,8 @@
7 7
8#if __GNUC_MINOR__ >= 3 8#if __GNUC_MINOR__ >= 3
9# define __used __attribute__((__used__)) 9# define __used __attribute__((__used__))
10# define __attribute_used__ __used /* deprecated */
11#else 10#else
12# define __used __attribute__((__unused__)) 11# define __used __attribute__((__unused__))
13# define __attribute_used__ __used /* deprecated */
14#endif 12#endif
15 13
16#if __GNUC_MINOR__ >= 4 14#if __GNUC_MINOR__ >= 4
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index ee7ca5de970c..0ab3a3232330 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -15,7 +15,6 @@
15#endif 15#endif
16 16
17#define __used __attribute__((__used__)) 17#define __used __attribute__((__used__))
18#define __attribute_used__ __used /* deprecated */
19#define __must_check __attribute__((warn_unused_result)) 18#define __must_check __attribute__((warn_unused_result))
20#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 19#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
21#define __always_inline inline __attribute__((always_inline)) 20#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c68b67b86ef1..d0e17e1657dc 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -126,10 +126,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
126 * Mark functions that are referenced only in inline assembly as __used so 126 * Mark functions that are referenced only in inline assembly as __used so
127 * the code is emitted even though it appears to be unreferenced. 127 * the code is emitted even though it appears to be unreferenced.
128 */ 128 */
129#ifndef __attribute_used__
130# define __attribute_used__ /* deprecated */
131#endif
132
133#ifndef __used 129#ifndef __used
134# define __used /* unimplemented */ 130# define __used /* unimplemented */
135#endif 131#endif
@@ -175,4 +171,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
175#define __cold 171#define __cold
176#endif 172#endif
177 173
174/* Simple shorthand for a section definition */
175#ifndef __section
176# define __section(S) __attribute__ ((__section__(#S)))
177#endif
178
178#endif /* __LINUX_COMPILER_H */ 179#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index e831759b2fb5..278e3ef05336 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -76,7 +76,7 @@
76 typeof(desc) _desc \ 76 typeof(desc) _desc \
77 __attribute__((aligned(sizeof(Elf##size##_Word)))); \ 77 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
78 } _ELFNOTE_PASTE(_note_, unique) \ 78 } _ELFNOTE_PASTE(_note_, unique) \
79 __attribute_used__ \ 79 __used \
80 __attribute__((section(".note." name), \ 80 __attribute__((section(".note." name), \
81 aligned(sizeof(Elf##size##_Word)), \ 81 aligned(sizeof(Elf##size##_Word)), \
82 unused)) = { \ 82 unused)) = { \
diff --git a/include/linux/init.h b/include/linux/init.h
index 5141381a7527..2efbda016741 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -40,10 +40,10 @@
40 40
41/* These are for everybody (although not all archs will actually 41/* These are for everybody (although not all archs will actually
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __attribute__ ((__section__ (".init.text"))) __cold 43#define __init __section(.init.text) __cold
44#define __initdata __attribute__ ((__section__ (".init.data"))) 44#define __initdata __section(.init.data)
45#define __exitdata __attribute__ ((__section__(".exit.data"))) 45#define __exitdata __section(.exit.data)
46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 46#define __exit_call __used __section(.exitcall.exit)
47 47
48/* modpost check for section mismatches during the kernel build. 48/* modpost check for section mismatches during the kernel build.
49 * A section mismatch happens when there are references from a 49 * A section mismatch happens when there are references from a
@@ -52,25 +52,81 @@
52 * when early init has completed so all such references are potential bugs. 52 * when early init has completed so all such references are potential bugs.
53 * For exit sections the same issue exists. 53 * For exit sections the same issue exists.
54 * The following markers are used for the cases where the reference to 54 * The following markers are used for the cases where the reference to
55 * the init/exit section (code or data) is valid and will teach modpost 55 * the *init / *exit section (code or data) is valid and will teach
56 * not to issue a warning. 56 * modpost not to issue a warning.
57 * The markers follow same syntax rules as __init / __initdata. */ 57 * The markers follow same syntax rules as __init / __initdata. */
58#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) 58#define __ref __section(.ref.text) noinline
59#define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) 59#define __refdata __section(.ref.data)
60#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok"))) 60#define __refconst __section(.ref.rodata)
61
62/* backward compatibility note
63 * A few places hardcode the old section names:
64 * .text.init.refok
65 * .data.init.refok
66 * .exit.text.refok
67 * They should be converted to use the defines from this file
68 */
69
70/* compatibility defines */
71#define __init_refok __ref
72#define __initdata_refok __refdata
73#define __exit_refok __ref
74
61 75
62#ifdef MODULE 76#ifdef MODULE
63#define __exit __attribute__ ((__section__(".exit.text"))) __cold 77#define __exitused
64#else 78#else
65#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold 79#define __exitused __used
66#endif 80#endif
67 81
82#define __exit __section(.exit.text) __exitused __cold
83
84/* Used for HOTPLUG */
85#define __devinit __section(.devinit.text) __cold
86#define __devinitdata __section(.devinit.data)
87#define __devinitconst __section(.devinit.rodata)
88#define __devexit __section(.devexit.text) __exitused __cold
89#define __devexitdata __section(.devexit.data)
90#define __devexitconst __section(.devexit.rodata)
91
92/* Used for HOTPLUG_CPU */
93#define __cpuinit __section(.cpuinit.text) __cold
94#define __cpuinitdata __section(.cpuinit.data)
95#define __cpuinitconst __section(.cpuinit.rodata)
96#define __cpuexit __section(.cpuexit.text) __exitused __cold
97#define __cpuexitdata __section(.cpuexit.data)
98#define __cpuexitconst __section(.cpuexit.rodata)
99
100/* Used for MEMORY_HOTPLUG */
101#define __meminit __section(.meminit.text) __cold
102#define __meminitdata __section(.meminit.data)
103#define __meminitconst __section(.meminit.rodata)
104#define __memexit __section(.memexit.text) __exitused __cold
105#define __memexitdata __section(.memexit.data)
106#define __memexitconst __section(.memexit.rodata)
107
68/* For assembly routines */ 108/* For assembly routines */
69#define __INIT .section ".init.text","ax" 109#define __INIT .section ".init.text","ax"
70#define __INIT_REFOK .section ".text.init.refok","ax"
71#define __FINIT .previous 110#define __FINIT .previous
111
72#define __INITDATA .section ".init.data","aw" 112#define __INITDATA .section ".init.data","aw"
73#define __INITDATA_REFOK .section ".data.init.refok","aw" 113
114#define __DEVINIT .section ".devinit.text", "ax"
115#define __DEVINITDATA .section ".devinit.data", "aw"
116
117#define __CPUINIT .section ".cpuinit.text", "ax"
118#define __CPUINITDATA .section ".cpuinit.data", "aw"
119
120#define __MEMINIT .section ".meminit.text", "ax"
121#define __MEMINITDATA .section ".meminit.data", "aw"
122
123/* silence warnings when references are OK */
124#define __REF .section ".ref.text", "ax"
125#define __REFDATA .section ".ref.data", "aw"
126#define __REFCONST .section ".ref.rodata", "aw"
127/* backward compatibility */
128#define __INIT_REFOK .section __REF
129#define __INITDATA_REFOK .section __REFDATA
74 130
75#ifndef __ASSEMBLY__ 131#ifndef __ASSEMBLY__
76/* 132/*
@@ -108,7 +164,7 @@ void prepare_namespace(void);
108 */ 164 */
109 165
110#define __define_initcall(level,fn,id) \ 166#define __define_initcall(level,fn,id) \
111 static initcall_t __initcall_##fn##id __attribute_used__ \ 167 static initcall_t __initcall_##fn##id __used \
112 __attribute__((__section__(".initcall" level ".init"))) = fn 168 __attribute__((__section__(".initcall" level ".init"))) = fn
113 169
114/* 170/*
@@ -142,11 +198,11 @@ void prepare_namespace(void);
142 198
143#define console_initcall(fn) \ 199#define console_initcall(fn) \
144 static initcall_t __initcall_##fn \ 200 static initcall_t __initcall_##fn \
145 __attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn 201 __used __section(.con_initcall.init) = fn
146 202
147#define security_initcall(fn) \ 203#define security_initcall(fn) \
148 static initcall_t __initcall_##fn \ 204 static initcall_t __initcall_##fn \
149 __attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn 205 __used __section(.security_initcall.init) = fn
150 206
151struct obs_kernel_param { 207struct obs_kernel_param {
152 const char *str; 208 const char *str;
@@ -163,8 +219,7 @@ struct obs_kernel_param {
163#define __setup_param(str, unique_id, fn, early) \ 219#define __setup_param(str, unique_id, fn, early) \
164 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ 220 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
165 static struct obs_kernel_param __setup_##unique_id \ 221 static struct obs_kernel_param __setup_##unique_id \
166 __attribute_used__ \ 222 __used __section(.init.setup) \
167 __attribute__((__section__(".init.setup"))) \
168 __attribute__((aligned((sizeof(long))))) \ 223 __attribute__((aligned((sizeof(long))))) \
169 = { __setup_str_##unique_id, fn, early } 224 = { __setup_str_##unique_id, fn, early }
170 225
@@ -242,7 +297,7 @@ void __init parse_early_param(void);
242#endif 297#endif
243 298
244/* Data marked not to be saved by software suspend */ 299/* Data marked not to be saved by software suspend */
245#define __nosavedata __attribute__ ((__section__ (".data.nosave"))) 300#define __nosavedata __section(.data.nosave)
246 301
247/* This means "can be init if no module support, otherwise module load 302/* This means "can be init if no module support, otherwise module load
248 may call it." */ 303 may call it." */
@@ -254,43 +309,6 @@ void __init parse_early_param(void);
254#define __initdata_or_module __initdata 309#define __initdata_or_module __initdata
255#endif /*CONFIG_MODULES*/ 310#endif /*CONFIG_MODULES*/
256 311
257#ifdef CONFIG_HOTPLUG
258#define __devinit
259#define __devinitdata
260#define __devexit
261#define __devexitdata
262#else
263#define __devinit __init
264#define __devinitdata __initdata
265#define __devexit __exit
266#define __devexitdata __exitdata
267#endif
268
269#ifdef CONFIG_HOTPLUG_CPU
270#define __cpuinit
271#define __cpuinitdata
272#define __cpuexit
273#define __cpuexitdata
274#else
275#define __cpuinit __init
276#define __cpuinitdata __initdata
277#define __cpuexit __exit
278#define __cpuexitdata __exitdata
279#endif
280
281#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
282 || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
283#define __meminit
284#define __meminitdata
285#define __memexit
286#define __memexitdata
287#else
288#define __meminit __init
289#define __meminitdata __initdata
290#define __memexit __exit
291#define __memexitdata __exitdata
292#endif
293
294/* Functions marked as __devexit may be discarded at kernel link time, depending 312/* Functions marked as __devexit may be discarded at kernel link time, depending
295 on config options. Newer versions of binutils detect references from 313 on config options. Newer versions of binutils detect references from
296 retained sections to discarded sections and flag an error. Pointers to 314 retained sections to discarded sections and flag an error. Pointers to
diff --git a/include/linux/module.h b/include/linux/module.h
index aedc06be1de8..ac481e2094fd 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol);
178#define __CRC_SYMBOL(sym, sec) \ 178#define __CRC_SYMBOL(sym, sec) \
179 extern void *__crc_##sym __attribute__((weak)); \ 179 extern void *__crc_##sym __attribute__((weak)); \
180 static const unsigned long __kcrctab_##sym \ 180 static const unsigned long __kcrctab_##sym \
181 __attribute_used__ \ 181 __used \
182 __attribute__((section("__kcrctab" sec), unused)) \ 182 __attribute__((section("__kcrctab" sec), unused)) \
183 = (unsigned long) &__crc_##sym; 183 = (unsigned long) &__crc_##sym;
184#else 184#else
@@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol);
193 __attribute__((section("__ksymtab_strings"))) \ 193 __attribute__((section("__ksymtab_strings"))) \
194 = MODULE_SYMBOL_PREFIX #sym; \ 194 = MODULE_SYMBOL_PREFIX #sym; \
195 static const struct kernel_symbol __ksymtab_##sym \ 195 static const struct kernel_symbol __ksymtab_##sym \
196 __attribute_used__ \ 196 __used \
197 __attribute__((section("__ksymtab" sec), unused)) \ 197 __attribute__((section("__ksymtab" sec), unused)) \
198 = { (unsigned long)&sym, __kstrtab_##sym } 198 = { (unsigned long)&sym, __kstrtab_##sym }
199 199
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 13410b20600f..8126e55c5bdc 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -18,7 +18,7 @@
18#define __module_cat(a,b) ___module_cat(a,b) 18#define __module_cat(a,b) ___module_cat(a,b)
19#define __MODULE_INFO(tag, name, info) \ 19#define __MODULE_INFO(tag, name, info) \
20static const char __module_cat(name,__LINE__)[] \ 20static const char __module_cat(name,__LINE__)[] \
21 __attribute_used__ \ 21 __used \
22 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info 22 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
23#else /* !MODULE */ 23#else /* !MODULE */
24#define __MODULE_INFO(tag, name, info) 24#define __MODULE_INFO(tag, name, info)
@@ -72,7 +72,7 @@ struct kparam_array
72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ 72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
73 static const char __param_str_##name[] = prefix #name; \ 73 static const char __param_str_##name[] = prefix #name; \
74 static struct kernel_param const __param_##name \ 74 static struct kernel_param const __param_##name \
75 __attribute_used__ \ 75 __used \
76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
77 = { __param_str_##name, perm, set, get, { arg } } 77 = { __param_str_##name, perm, set, get, { arg } }
78 78
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0dd93bb62fbe..ae1006322f80 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -867,7 +867,7 @@ enum pci_fixup_pass {
867 867
868/* Anonymous variables would be nice... */ 868/* Anonymous variables would be nice... */
869#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ 869#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \
870 static const struct pci_fixup __pci_fixup_##name __attribute_used__ \ 870 static const struct pci_fixup __pci_fixup_##name __used \
871 __attribute__((__section__(#section))) = { vendor, device, hook }; 871 __attribute__((__section__(#section))) = { vendor, device, hook };
872#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 872#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
873 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 873 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
diff --git a/init/Kconfig b/init/Kconfig
index 288444b4cd8a..0d0bbf218f1f 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1,3 +1,11 @@
1config ARCH
2 string
3 option env="ARCH"
4
5config KERNELVERSION
6 string
7 option env="KERNELVERSION"
8
1config DEFCONFIG_LIST 9config DEFCONFIG_LIST
2 string 10 string
3 depends on !UML 11 depends on !UML
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 14fb355e3caa..c4ecb2994ba3 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -79,6 +79,38 @@ config HEADERS_CHECK
79 exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in 79 exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
80 your build tree), to make sure they're suitable. 80 your build tree), to make sure they're suitable.
81 81
82config DEBUG_SECTION_MISMATCH
83 bool "Enable full Section mismatch analysis"
84 default n
85 help
86 The section mismatch analysis checks if there are illegal
87 references from one section to another section.
88 Linux will during link or during runtime drop some sections
89 and any use of code/data previously in these sections will
90 most likely result in an oops.
91 In the code functions and variables are annotated with
92 __init, __devinit etc. (see full list in include/linux/init.h)
93 which result in the code/data being placed in specific sections.
94 The section mismatch anaylsis are always done after a full
95 kernel build but enabling this options will in addition
96 do the following:
97 - Add the option -fno-inline-functions-called-once to gcc
98 When inlining a function annotated __init in a non-init
99 function we would loose the section information and thus
100 the analysis would not catch the illegal reference.
101 This options tell gcc to inline less but will also
102 result in a larger kernel.
103 - Run the section mismatch analysis for each module/built-in.o
104 When we run the section mismatch analysis on vmlinux.o we
105 looses valueable information about where the mismatch was
106 introduced.
107 Running the analysis for each module/built-in.o file
108 will tell where the mismatch happens much closer to the
109 source. The drawback is that we will report the same
110 mismatch at least twice.
111 - Enable verbose reporting from modpost to help solving
112 the section mismatches reported.
113
82config DEBUG_KERNEL 114config DEBUG_KERNEL
83 bool "Kernel debugging" 115 bool "Kernel debugging"
84 help 116 help
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index de9836eee8bb..67fb4530a6ff 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -83,10 +83,12 @@ ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
83builtin-target := $(obj)/built-in.o 83builtin-target := $(obj)/built-in.o
84endif 84endif
85 85
86modorder-target := $(obj)/modules.order
87
86# We keep a list of all modules in $(MODVERDIR) 88# We keep a list of all modules in $(MODVERDIR)
87 89
88__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ 90__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
89 $(if $(KBUILD_MODULES),$(obj-m)) \ 91 $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \
90 $(subdir-ym) $(always) 92 $(subdir-ym) $(always)
91 @: 93 @:
92 94
@@ -101,6 +103,10 @@ ifneq ($(KBUILD_CHECKSRC),0)
101 endif 103 endif
102endif 104endif
103 105
106# Do section mismatch analysis for each module/built-in.o
107ifdef CONFIG_DEBUG_SECTION_MISMATCH
108 cmd_secanalysis = ; scripts/mod/modpost $@
109endif
104 110
105# Compile C sources (.c) 111# Compile C sources (.c)
106# --------------------------------------------------------------------------- 112# ---------------------------------------------------------------------------
@@ -266,7 +272,8 @@ ifdef builtin-target
266quiet_cmd_link_o_target = LD $@ 272quiet_cmd_link_o_target = LD $@
267# If the list of objects to link is empty, just create an empty built-in.o 273# If the list of objects to link is empty, just create an empty built-in.o
268cmd_link_o_target = $(if $(strip $(obj-y)),\ 274cmd_link_o_target = $(if $(strip $(obj-y)),\
269 $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\ 275 $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
276 $(cmd_secanalysis),\
270 rm -f $@; $(AR) rcs $@) 277 rm -f $@; $(AR) rcs $@)
271 278
272$(builtin-target): $(obj-y) FORCE 279$(builtin-target): $(obj-y) FORCE
@@ -276,6 +283,19 @@ targets += $(builtin-target)
276endif # builtin-target 283endif # builtin-target
277 284
278# 285#
286# Rule to create modules.order file
287#
288# Create commands to either record .ko file or cat modules.order from
289# a subdirectory
290modorder-cmds = \
291 $(foreach m, $(modorder), \
292 $(if $(filter %/modules.order, $m), \
293 cat $m;, echo kernel/$m;))
294
295$(modorder-target): $(subdir-ym) FORCE
296 $(Q)(cat /dev/null; $(modorder-cmds)) > $@
297
298#
279# Rule to compile a set of .o files into one .a file 299# Rule to compile a set of .o files into one .a file
280# 300#
281ifdef lib-target 301ifdef lib-target
@@ -301,7 +321,7 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
301$($(subst $(obj)/,,$(@:.o=-y)))), $^) 321$($(subst $(obj)/,,$(@:.o=-y)))), $^)
302 322
303quiet_cmd_link_multi-y = LD $@ 323quiet_cmd_link_multi-y = LD $@
304cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) 324cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
305 325
306quiet_cmd_link_multi-m = LD [M] $@ 326quiet_cmd_link_multi-m = LD [M] $@
307cmd_link_multi-m = $(cmd_link_multi-y) 327cmd_link_multi-m = $(cmd_link_multi-y)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3c5e88bfecf1..8e440233c27d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -25,6 +25,11 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
25# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) 25# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
26# and add the directory to the list of dirs to descend into: $(subdir-m) 26# and add the directory to the list of dirs to descend into: $(subdir-m)
27 27
28# Determine modorder.
29# Unfortunately, we don't have information about ordering between -y
30# and -m subdirs. Just put -y's first.
31modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
32
28__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) 33__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
29subdir-y += $(__subdir-y) 34subdir-y += $(__subdir-y)
30__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) 35__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
@@ -64,6 +69,7 @@ real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)
64extra-y := $(addprefix $(obj)/,$(extra-y)) 69extra-y := $(addprefix $(obj)/,$(extra-y))
65always := $(addprefix $(obj)/,$(always)) 70always := $(addprefix $(obj)/,$(always))
66targets := $(addprefix $(obj)/,$(targets)) 71targets := $(addprefix $(obj)/,$(targets))
72modorder := $(addprefix $(obj)/,$(modorder))
67obj-y := $(addprefix $(obj)/,$(obj-y)) 73obj-y := $(addprefix $(obj)/,$(obj-y))
68obj-m := $(addprefix $(obj)/,$(obj-m)) 74obj-m := $(addprefix $(obj)/,$(obj-m))
69lib-y := $(addprefix $(obj)/,$(lib-y)) 75lib-y := $(addprefix $(obj)/,$(lib-y))
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index f0ff248f5e6f..efa5d940e632 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -21,7 +21,7 @@ quiet_cmd_modules_install = INSTALL $@
21 21
22# Modules built outside the kernel source tree go into extra by default 22# Modules built outside the kernel source tree go into extra by default
23INSTALL_MOD_DIR ?= extra 23INSTALL_MOD_DIR ?= extra
24ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(KBUILD_EXTMOD),,$(@D)) 24ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
25 25
26modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D)) 26modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
27 27
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index d988f5d21e3d..65e707e1ffc3 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -62,6 +62,7 @@ modpost = scripts/mod/modpost \
62 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ 62 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
63 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 63 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
64 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 64 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
65 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
65 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 66 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
66 67
67quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules 68quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
index 0e4bd5459df4..35bdc68b6e66 100644
--- a/scripts/basic/docproc.c
+++ b/scripts/basic/docproc.c
@@ -30,6 +30,7 @@
30 * !Ifilename 30 * !Ifilename
31 * !Dfilename 31 * !Dfilename
32 * !Ffilename 32 * !Ffilename
33 * !Pfilename
33 * 34 *
34 */ 35 */
35 36
@@ -57,6 +58,7 @@ FILEONLY *symbolsonly;
57typedef void FILELINE(char * file, char * line); 58typedef void FILELINE(char * file, char * line);
58FILELINE * singlefunctions; 59FILELINE * singlefunctions;
59FILELINE * entity_system; 60FILELINE * entity_system;
61FILELINE * docsection;
60 62
61#define MAXLINESZ 2048 63#define MAXLINESZ 2048
62#define MAXFILES 250 64#define MAXFILES 250
@@ -65,6 +67,7 @@ FILELINE * entity_system;
65#define DOCBOOK "-docbook" 67#define DOCBOOK "-docbook"
66#define FUNCTION "-function" 68#define FUNCTION "-function"
67#define NOFUNCTION "-nofunction" 69#define NOFUNCTION "-nofunction"
70#define NODOCSECTIONS "-no-doc-sections"
68 71
69char *srctree; 72char *srctree;
70 73
@@ -231,13 +234,14 @@ void docfunctions(char * filename, char * type)
231 234
232 for (i=0; i <= symfilecnt; i++) 235 for (i=0; i <= symfilecnt; i++)
233 symcnt += symfilelist[i].symbolcnt; 236 symcnt += symfilelist[i].symbolcnt;
234 vec = malloc((2 + 2 * symcnt + 2) * sizeof(char*)); 237 vec = malloc((2 + 2 * symcnt + 3) * sizeof(char *));
235 if (vec == NULL) { 238 if (vec == NULL) {
236 perror("docproc: "); 239 perror("docproc: ");
237 exit(1); 240 exit(1);
238 } 241 }
239 vec[idx++] = KERNELDOC; 242 vec[idx++] = KERNELDOC;
240 vec[idx++] = DOCBOOK; 243 vec[idx++] = DOCBOOK;
244 vec[idx++] = NODOCSECTIONS;
241 for (i=0; i < symfilecnt; i++) { 245 for (i=0; i < symfilecnt; i++) {
242 struct symfile * sym = &symfilelist[i]; 246 struct symfile * sym = &symfilelist[i];
243 for (j=0; j < sym->symbolcnt; j++) { 247 for (j=0; j < sym->symbolcnt; j++) {
@@ -287,12 +291,36 @@ void singfunc(char * filename, char * line)
287} 291}
288 292
289/* 293/*
294 * Insert specific documentation section from a file.
295 * Call kernel-doc with the following parameters:
296 * kernel-doc -docbook -function "doc section" filename
297 */
298void docsect(char *filename, char *line)
299{
300 char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */
301 char *s;
302
303 for (s = line; *s; s++)
304 if (*s == '\n')
305 *s = '\0';
306
307 vec[0] = KERNELDOC;
308 vec[1] = DOCBOOK;
309 vec[2] = FUNCTION;
310 vec[3] = line;
311 vec[4] = filename;
312 vec[5] = NULL;
313 exec_kernel_doc(vec);
314}
315
316/*
290 * Parse file, calling action specific functions for: 317 * Parse file, calling action specific functions for:
291 * 1) Lines containing !E 318 * 1) Lines containing !E
292 * 2) Lines containing !I 319 * 2) Lines containing !I
293 * 3) Lines containing !D 320 * 3) Lines containing !D
294 * 4) Lines containing !F 321 * 4) Lines containing !F
295 * 5) Default lines - lines not matching the above 322 * 5) Lines containing !P
323 * 6) Default lines - lines not matching the above
296 */ 324 */
297void parse_file(FILE *infile) 325void parse_file(FILE *infile)
298{ 326{
@@ -326,6 +354,15 @@ void parse_file(FILE *infile)
326 s++; 354 s++;
327 singlefunctions(line +2, s); 355 singlefunctions(line +2, s);
328 break; 356 break;
357 case 'P':
358 /* filename */
359 while (*s && !isspace(*s)) s++;
360 *s++ = '\0';
361 /* DOC: section name */
362 while (isspace(*s))
363 s++;
364 docsection(line + 2, s);
365 break;
329 default: 366 default:
330 defaultline(line); 367 defaultline(line);
331 } 368 }
@@ -372,6 +409,7 @@ int main(int argc, char *argv[])
372 externalfunctions = find_export_symbols; 409 externalfunctions = find_export_symbols;
373 symbolsonly = find_export_symbols; 410 symbolsonly = find_export_symbols;
374 singlefunctions = noaction2; 411 singlefunctions = noaction2;
412 docsection = noaction2;
375 parse_file(infile); 413 parse_file(infile);
376 414
377 /* Rewind to start from beginning of file again */ 415 /* Rewind to start from beginning of file again */
@@ -381,6 +419,7 @@ int main(int argc, char *argv[])
381 externalfunctions = extfunc; 419 externalfunctions = extfunc;
382 symbolsonly = printline; 420 symbolsonly = printline;
383 singlefunctions = singfunc; 421 singlefunctions = singfunc;
422 docsection = docsect;
384 423
385 parse_file(infile); 424 parse_file(infile);
386 } 425 }
@@ -394,6 +433,7 @@ int main(int argc, char *argv[])
394 externalfunctions = adddep; 433 externalfunctions = adddep;
395 symbolsonly = adddep; 434 symbolsonly = adddep;
396 singlefunctions = adddep2; 435 singlefunctions = adddep2;
436 docsection = adddep2;
397 parse_file(infile); 437 parse_file(infile);
398 printf("\n"); 438 printf("\n");
399 } 439 }
diff --git a/scripts/decodecode b/scripts/decodecode
index 1e1a8f620c47..235d3938529d 100644
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -6,7 +6,19 @@
6# e.g., to decode an i386 oops on an x86_64 system, use: 6# e.g., to decode an i386 oops on an x86_64 system, use:
7# AFLAGS=--32 decodecode < 386.oops 7# AFLAGS=--32 decodecode < 386.oops
8 8
9T=`mktemp` 9cleanup() {
10 rm -f $T $T.s $T.o
11 exit 1
12}
13
14die() {
15 echo "$@"
16 exit 1
17}
18
19trap cleanup EXIT
20
21T=`mktemp` || die "cannot create temp file"
10code= 22code=
11 23
12while read i ; do 24while read i ; do
@@ -20,6 +32,7 @@ esac
20done 32done
21 33
22if [ -z "$code" ]; then 34if [ -z "$code" ]; then
35 rm $T
23 exit 36 exit
24fi 37fi
25 38
@@ -48,4 +61,4 @@ echo -n " .byte 0x" > $T.s
48echo $code >> $T.s 61echo $code >> $T.s
49as $AFLAGS -o $T.o $T.s 62as $AFLAGS -o $T.o $T.s
50objdump -S $T.o 63objdump -S $T.o
51rm $T.o $T.s 64rm $T $T.s $T.o
diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh
index a5121a6d8949..cc767b388baf 100644
--- a/scripts/gcc-version.sh
+++ b/scripts/gcc-version.sh
@@ -9,7 +9,10 @@
9# gcc-2.95.3, `030301' for gcc-3.3.1, etc. 9# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
10# 10#
11 11
12if [[ $1 = "-p" ]] ; then with_patchlevel=1; shift; fi 12if [ "$1" = "-p" ] ; then
13 with_patchlevel=1;
14 shift;
15fi
13 16
14compiler="$*" 17compiler="$*"
15 18
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 511023b430a8..dca5e0dd09bf 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -440,17 +440,21 @@ void error_with_pos(const char *fmt, ...)
440 440
441static void genksyms_usage(void) 441static void genksyms_usage(void)
442{ 442{
443 fputs("Usage:\n" "genksyms [-dDwqhV] > /path/to/.tmp_obj.ver\n" "\n" 443 fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
444#ifdef __GNU_LIBRARY__ 444#ifdef __GNU_LIBRARY__
445 " -a, --arch Select architecture\n"
445 " -d, --debug Increment the debug level (repeatable)\n" 446 " -d, --debug Increment the debug level (repeatable)\n"
446 " -D, --dump Dump expanded symbol defs (for debugging only)\n" 447 " -D, --dump Dump expanded symbol defs (for debugging only)\n"
448 " -T, --dump-types file Dump expanded types into file (for debugging only)\n"
447 " -w, --warnings Enable warnings\n" 449 " -w, --warnings Enable warnings\n"
448 " -q, --quiet Disable warnings (default)\n" 450 " -q, --quiet Disable warnings (default)\n"
449 " -h, --help Print this message\n" 451 " -h, --help Print this message\n"
450 " -V, --version Print the release version\n" 452 " -V, --version Print the release version\n"
451#else /* __GNU_LIBRARY__ */ 453#else /* __GNU_LIBRARY__ */
454 " -a Select architecture\n"
452 " -d Increment the debug level (repeatable)\n" 455 " -d Increment the debug level (repeatable)\n"
453 " -D Dump expanded symbol defs (for debugging only)\n" 456 " -D Dump expanded symbol defs (for debugging only)\n"
457 " -T file Dump expanded types into file (for debugging only)\n"
454 " -w Enable warnings\n" 458 " -w Enable warnings\n"
455 " -q Disable warnings (default)\n" 459 " -q Disable warnings (default)\n"
456 " -h Print this message\n" 460 " -h Print this message\n"
@@ -477,10 +481,10 @@ int main(int argc, char **argv)
477 {0, 0, 0, 0} 481 {0, 0, 0, 0}
478 }; 482 };
479 483
480 while ((o = getopt_long(argc, argv, "a:dwqVDT:k:p:", 484 while ((o = getopt_long(argc, argv, "a:dwqVDT:h",
481 &long_opts[0], NULL)) != EOF) 485 &long_opts[0], NULL)) != EOF)
482#else /* __GNU_LIBRARY__ */ 486#else /* __GNU_LIBRARY__ */
483 while ((o = getopt(argc, argv, "a:dwqVDT:k:p:")) != EOF) 487 while ((o = getopt(argc, argv, "a:dwqVDT:h")) != EOF)
484#endif /* __GNU_LIBRARY__ */ 488#endif /* __GNU_LIBRARY__ */
485 switch (o) { 489 switch (o) {
486 case 'a': 490 case 'a':
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 1ad6f7fc490a..32e8c5a227c3 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -24,22 +24,25 @@ oldconfig: $(obj)/conf
24silentoldconfig: $(obj)/conf 24silentoldconfig: $(obj)/conf
25 $< -s $(Kconfig) 25 $< -s $(Kconfig)
26 26
27# Create new linux.po file 27# Create new linux.pot file
28# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 28# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
29# The symlink is used to repair a deficiency in arch/um 29# The symlink is used to repair a deficiency in arch/um
30update-po-config: $(obj)/kxgettext 30update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
31 xgettext --default-domain=linux \ 31 $(Q)echo " GEN config"
32 $(Q)xgettext --default-domain=linux \
32 --add-comments --keyword=_ --keyword=N_ \ 33 --add-comments --keyword=_ --keyword=N_ \
33 --from-code=UTF-8 \ 34 --from-code=UTF-8 \
34 --files-from=scripts/kconfig/POTFILES.in \ 35 --files-from=scripts/kconfig/POTFILES.in \
35 --output $(obj)/config.pot 36 --output $(obj)/config.pot
36 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot 37 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
37 $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch 38 $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
38 (for i in `ls arch/`; \ 39 $(Q)(for i in `ls arch/`; \
39 do \ 40 do \
40 $(obj)/kxgettext arch/$$i/Kconfig; \ 41 echo " GEN $$i"; \
41 done ) >> $(obj)/config.pot 42 $(obj)/kxgettext arch/$$i/Kconfig \
42 msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ 43 >> $(obj)/config.pot; \
44 done )
45 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
43 --output $(obj)/linux.pot 46 --output $(obj)/linux.pot
44 $(Q)rm -f arch/um/Kconfig.arch 47 $(Q)rm -f arch/um/Kconfig.arch
45 $(Q)rm -f $(obj)/config.pot 48 $(Q)rm -f $(obj)/config.pot
@@ -93,12 +96,6 @@ HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
93 96
94HOST_EXTRACFLAGS += -DLOCALE 97HOST_EXTRACFLAGS += -DLOCALE
95 98
96PHONY += $(obj)/dochecklxdialog
97$(obj)/dochecklxdialog:
98 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)
99
100always := dochecklxdialog
101
102 99
103# =========================================================================== 100# ===========================================================================
104# Shared Makefile for the various kconfig executables: 101# Shared Makefile for the various kconfig executables:
@@ -142,8 +139,17 @@ gconf-objs := gconf.o kconfig_load.o zconf.tab.o
142endif 139endif
143 140
144clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ 141clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
145 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c 142 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
146clean-files += mconf qconf gconf 143clean-files += mconf qconf gconf
144clean-files += config.pot linux.pot
145
146# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
147PHONY += $(obj)/dochecklxdialog
148$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
149$(obj)/dochecklxdialog:
150 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
151
152always := dochecklxdialog
147 153
148# Add environment specific flags 154# Add environment specific flags
149HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) 155HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
@@ -248,6 +254,9 @@ $(obj)/%.moc: $(src)/%.h
248$(obj)/lkc_defs.h: $(src)/lkc_proto.h 254$(obj)/lkc_defs.h: $(src)/lkc_proto.h
249 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' 255 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
250 256
257# Extract gconf menu items for I18N support
258$(obj)/gconf.glade.h: $(obj)/gconf.glade
259 intltool-extract --type=gettext/glade $(obj)/gconf.glade
251 260
252### 261###
253# The following requires flex/bison/gperf 262# The following requires flex/bison/gperf
diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in
index cc94e46a79e8..967457396990 100644
--- a/scripts/kconfig/POTFILES.in
+++ b/scripts/kconfig/POTFILES.in
@@ -1,5 +1,12 @@
1scripts/kconfig/lxdialog/checklist.c
2scripts/kconfig/lxdialog/inputbox.c
3scripts/kconfig/lxdialog/menubox.c
4scripts/kconfig/lxdialog/textbox.c
5scripts/kconfig/lxdialog/util.c
6scripts/kconfig/lxdialog/yesno.c
1scripts/kconfig/mconf.c 7scripts/kconfig/mconf.c
2scripts/kconfig/conf.c 8scripts/kconfig/conf.c
3scripts/kconfig/confdata.c 9scripts/kconfig/confdata.c
4scripts/kconfig/gconf.c 10scripts/kconfig/gconf.c
11scripts/kconfig/gconf.glade.h
5scripts/kconfig/qconf.cc 12scripts/kconfig/qconf.cc
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 8d6f17490c5e..fda63136ae68 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -3,12 +3,13 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <locale.h>
6#include <ctype.h> 7#include <ctype.h>
7#include <stdlib.h>
8#include <stdio.h> 8#include <stdio.h>
9#include <stdlib.h>
9#include <string.h> 10#include <string.h>
10#include <unistd.h>
11#include <time.h> 11#include <time.h>
12#include <unistd.h>
12#include <sys/stat.h> 13#include <sys/stat.h>
13 14
14#define LKC_DIRECT_LINK 15#define LKC_DIRECT_LINK
@@ -40,7 +41,7 @@ static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"
40static const char *get_help(struct menu *menu) 41static const char *get_help(struct menu *menu)
41{ 42{
42 if (menu_has_help(menu)) 43 if (menu_has_help(menu))
43 return menu_get_help(menu); 44 return _(menu_get_help(menu));
44 else 45 else
45 return nohelp_text; 46 return nohelp_text;
46} 47}
@@ -78,7 +79,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
78 tristate val; 79 tristate val;
79 80
80 if (!sym_has_value(sym)) 81 if (!sym_has_value(sym))
81 printf("(NEW) "); 82 printf(_("(NEW) "));
82 83
83 line[0] = '\n'; 84 line[0] = '\n';
84 line[1] = 0; 85 line[1] = 0;
@@ -160,7 +161,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
160 } 161 }
161 case set_random: 162 case set_random:
162 do { 163 do {
163 val = (tristate)(random() % 3); 164 val = (tristate)(rand() % 3);
164 } while (!sym_tristate_within_range(sym, val)); 165 } while (!sym_tristate_within_range(sym, val));
165 switch (val) { 166 switch (val) {
166 case no: line[0] = 'n'; break; 167 case no: line[0] = 'n'; break;
@@ -183,7 +184,7 @@ int conf_string(struct menu *menu)
183 const char *def; 184 const char *def;
184 185
185 while (1) { 186 while (1) {
186 printf("%*s%s ", indent - 1, "", menu->prompt->text); 187 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
187 printf("(%s) ", sym->name); 188 printf("(%s) ", sym->name);
188 def = sym_get_string_value(sym); 189 def = sym_get_string_value(sym);
189 if (sym_get_string_value(sym)) 190 if (sym_get_string_value(sym))
@@ -216,7 +217,7 @@ static int conf_sym(struct menu *menu)
216 tristate oldval, newval; 217 tristate oldval, newval;
217 218
218 while (1) { 219 while (1) {
219 printf("%*s%s ", indent - 1, "", menu->prompt->text); 220 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
220 if (sym->name) 221 if (sym->name)
221 printf("(%s) ", sym->name); 222 printf("(%s) ", sym->name);
222 type = sym_get_type(sym); 223 type = sym_get_type(sym);
@@ -306,7 +307,7 @@ static int conf_choice(struct menu *menu)
306 case no: 307 case no:
307 return 1; 308 return 1;
308 case mod: 309 case mod:
309 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); 310 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
310 return 0; 311 return 0;
311 case yes: 312 case yes:
312 break; 313 break;
@@ -316,7 +317,7 @@ static int conf_choice(struct menu *menu)
316 while (1) { 317 while (1) {
317 int cnt, def; 318 int cnt, def;
318 319
319 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); 320 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
320 def_sym = sym_get_choice_value(sym); 321 def_sym = sym_get_choice_value(sym);
321 cnt = def = 0; 322 cnt = def = 0;
322 line[0] = 0; 323 line[0] = 0;
@@ -324,7 +325,7 @@ static int conf_choice(struct menu *menu)
324 if (!menu_is_visible(child)) 325 if (!menu_is_visible(child))
325 continue; 326 continue;
326 if (!child->sym) { 327 if (!child->sym) {
327 printf("%*c %s\n", indent, '*', menu_get_prompt(child)); 328 printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
328 continue; 329 continue;
329 } 330 }
330 cnt++; 331 cnt++;
@@ -333,14 +334,14 @@ static int conf_choice(struct menu *menu)
333 printf("%*c", indent, '>'); 334 printf("%*c", indent, '>');
334 } else 335 } else
335 printf("%*c", indent, ' '); 336 printf("%*c", indent, ' ');
336 printf(" %d. %s", cnt, menu_get_prompt(child)); 337 printf(" %d. %s", cnt, _(menu_get_prompt(child)));
337 if (child->sym->name) 338 if (child->sym->name)
338 printf(" (%s)", child->sym->name); 339 printf(" (%s)", child->sym->name);
339 if (!sym_has_value(child->sym)) 340 if (!sym_has_value(child->sym))
340 printf(" (NEW)"); 341 printf(_(" (NEW)"));
341 printf("\n"); 342 printf("\n");
342 } 343 }
343 printf("%*schoice", indent - 1, ""); 344 printf(_("%*schoice"), indent - 1, "");
344 if (cnt == 1) { 345 if (cnt == 1) {
345 printf("[1]: 1\n"); 346 printf("[1]: 1\n");
346 goto conf_childs; 347 goto conf_childs;
@@ -375,7 +376,7 @@ static int conf_choice(struct menu *menu)
375 break; 376 break;
376 case set_random: 377 case set_random:
377 if (is_new) 378 if (is_new)
378 def = (random() % cnt) + 1; 379 def = (rand() % cnt) + 1;
379 case set_default: 380 case set_default:
380 case set_yes: 381 case set_yes:
381 case set_mod: 382 case set_mod:
@@ -399,9 +400,9 @@ static int conf_choice(struct menu *menu)
399 continue; 400 continue;
400 } 401 }
401 sym_set_choice_value(sym, child->sym); 402 sym_set_choice_value(sym, child->sym);
402 if (child->list) { 403 for (child = child->list; child; child = child->next) {
403 indent += 2; 404 indent += 2;
404 conf(child->list); 405 conf(child);
405 indent -= 2; 406 indent -= 2;
406 } 407 }
407 return 1; 408 return 1;
@@ -433,7 +434,7 @@ static void conf(struct menu *menu)
433 if (prompt) 434 if (prompt)
434 printf("%*c\n%*c %s\n%*c\n", 435 printf("%*c\n%*c %s\n%*c\n",
435 indent, '*', 436 indent, '*',
436 indent, '*', prompt, 437 indent, '*', _(prompt),
437 indent, '*'); 438 indent, '*');
438 default: 439 default:
439 ; 440 ;
@@ -495,12 +496,16 @@ static void check_conf(struct menu *menu)
495 496
496int main(int ac, char **av) 497int main(int ac, char **av)
497{ 498{
498 int i = 1; 499 int opt;
499 const char *name; 500 const char *name;
500 struct stat tmpstat; 501 struct stat tmpstat;
501 502
502 if (ac > i && av[i][0] == '-') { 503 setlocale(LC_ALL, "");
503 switch (av[i++][1]) { 504 bindtextdomain(PACKAGE, LOCALEDIR);
505 textdomain(PACKAGE);
506
507 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
508 switch (opt) {
504 case 'o': 509 case 'o':
505 input_mode = ask_new; 510 input_mode = ask_new;
506 break; 511 break;
@@ -513,12 +518,7 @@ int main(int ac, char **av)
513 break; 518 break;
514 case 'D': 519 case 'D':
515 input_mode = set_default; 520 input_mode = set_default;
516 defconfig_file = av[i++]; 521 defconfig_file = optarg;
517 if (!defconfig_file) {
518 printf(_("%s: No default config file specified\n"),
519 av[0]);
520 exit(1);
521 }
522 break; 522 break;
523 case 'n': 523 case 'n':
524 input_mode = set_no; 524 input_mode = set_no;
@@ -531,19 +531,22 @@ int main(int ac, char **av)
531 break; 531 break;
532 case 'r': 532 case 'r':
533 input_mode = set_random; 533 input_mode = set_random;
534 srandom(time(NULL)); 534 srand(time(NULL));
535 break; 535 break;
536 case 'h': 536 case 'h':
537 case '?': 537 printf(_("See README for usage info\n"));
538 fprintf(stderr, "See README for usage info\n");
539 exit(0); 538 exit(0);
539 break;
540 default:
541 fprintf(stderr, _("See README for usage info\n"));
542 exit(1);
540 } 543 }
541 } 544 }
542 name = av[i]; 545 if (ac == optind) {
543 if (!name) {
544 printf(_("%s: Kconfig file missing\n"), av[0]); 546 printf(_("%s: Kconfig file missing\n"), av[0]);
545 exit(1); 547 exit(1);
546 } 548 }
549 name = av[optind];
547 conf_parse(name); 550 conf_parse(name);
548 //zconfdump(stdout); 551 //zconfdump(stdout);
549 switch (input_mode) { 552 switch (input_mode) {
@@ -551,9 +554,9 @@ int main(int ac, char **av)
551 if (!defconfig_file) 554 if (!defconfig_file)
552 defconfig_file = conf_get_default_confname(); 555 defconfig_file = conf_get_default_confname();
553 if (conf_read(defconfig_file)) { 556 if (conf_read(defconfig_file)) {
554 printf("***\n" 557 printf(_("***\n"
555 "*** Can't find default configuration \"%s\"!\n" 558 "*** Can't find default configuration \"%s\"!\n"
556 "***\n", defconfig_file); 559 "***\n"), defconfig_file);
557 exit(1); 560 exit(1);
558 } 561 }
559 break; 562 break;
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index e0f402f3b75d..ee5fe943d58d 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -232,8 +232,7 @@ load:
232 sym->type = S_BOOLEAN; 232 sym->type = S_BOOLEAN;
233 } 233 }
234 if (sym->flags & def_flags) { 234 if (sym->flags & def_flags) {
235 conf_warning("trying to reassign symbol %s", sym->name); 235 conf_warning("override: reassigning to symbol %s", sym->name);
236 break;
237 } 236 }
238 switch (sym->type) { 237 switch (sym->type) {
239 case S_BOOLEAN: 238 case S_BOOLEAN:
@@ -272,8 +271,7 @@ load:
272 sym->type = S_OTHER; 271 sym->type = S_OTHER;
273 } 272 }
274 if (sym->flags & def_flags) { 273 if (sym->flags & def_flags) {
275 conf_warning("trying to reassign symbol %s", sym->name); 274 conf_warning("override: reassigning to symbol %s", sym->name);
276 break;
277 } 275 }
278 if (conf_set_sym_val(sym, def, def_flags, p)) 276 if (conf_set_sym_val(sym, def, def_flags, p))
279 continue; 277 continue;
@@ -297,14 +295,12 @@ load:
297 } 295 }
298 break; 296 break;
299 case yes: 297 case yes:
300 if (cs->def[def].tri != no) { 298 if (cs->def[def].tri != no)
301 conf_warning("%s creates inconsistent choice state", sym->name); 299 conf_warning("override: %s changes choice state", sym->name);
302 cs->flags &= ~def_flags; 300 cs->def[def].val = sym;
303 } else
304 cs->def[def].val = sym;
305 break; 301 break;
306 } 302 }
307 cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri); 303 cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
308 } 304 }
309 } 305 }
310 fclose(in); 306 fclose(in);
@@ -316,7 +312,7 @@ load:
316 312
317int conf_read(const char *name) 313int conf_read(const char *name)
318{ 314{
319 struct symbol *sym; 315 struct symbol *sym, *choice_sym;
320 struct property *prop; 316 struct property *prop;
321 struct expr *e; 317 struct expr *e;
322 int i, flags; 318 int i, flags;
@@ -357,9 +353,9 @@ int conf_read(const char *name)
357 */ 353 */
358 prop = sym_get_choice_prop(sym); 354 prop = sym_get_choice_prop(sym);
359 flags = sym->flags; 355 flags = sym->flags;
360 for (e = prop->expr; e; e = e->left.expr) 356 expr_list_for_each_sym(prop->expr, e, choice_sym)
361 if (e->right.sym->visible != no) 357 if (choice_sym->visible != no)
362 flags &= e->right.sym->flags; 358 flags &= choice_sym->flags;
363 sym->flags &= flags | ~SYMBOL_DEF_USER; 359 sym->flags &= flags | ~SYMBOL_DEF_USER;
364 } 360 }
365 361
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 6f98dbfe70cf..579ece4fa584 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -87,7 +87,7 @@ struct expr *expr_copy(struct expr *org)
87 break; 87 break;
88 case E_AND: 88 case E_AND:
89 case E_OR: 89 case E_OR:
90 case E_CHOICE: 90 case E_LIST:
91 e->left.expr = expr_copy(org->left.expr); 91 e->left.expr = expr_copy(org->left.expr);
92 e->right.expr = expr_copy(org->right.expr); 92 e->right.expr = expr_copy(org->right.expr);
93 break; 93 break;
@@ -217,7 +217,7 @@ int expr_eq(struct expr *e1, struct expr *e2)
217 expr_free(e2); 217 expr_free(e2);
218 trans_count = old_count; 218 trans_count = old_count;
219 return res; 219 return res;
220 case E_CHOICE: 220 case E_LIST:
221 case E_RANGE: 221 case E_RANGE:
222 case E_NONE: 222 case E_NONE:
223 /* panic */; 223 /* panic */;
@@ -648,7 +648,7 @@ struct expr *expr_transform(struct expr *e)
648 case E_EQUAL: 648 case E_EQUAL:
649 case E_UNEQUAL: 649 case E_UNEQUAL:
650 case E_SYMBOL: 650 case E_SYMBOL:
651 case E_CHOICE: 651 case E_LIST:
652 break; 652 break;
653 default: 653 default:
654 e->left.expr = expr_transform(e->left.expr); 654 e->left.expr = expr_transform(e->left.expr);
@@ -932,7 +932,7 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb
932 break; 932 break;
933 case E_SYMBOL: 933 case E_SYMBOL:
934 return expr_alloc_comp(type, e->left.sym, sym); 934 return expr_alloc_comp(type, e->left.sym, sym);
935 case E_CHOICE: 935 case E_LIST:
936 case E_RANGE: 936 case E_RANGE:
937 case E_NONE: 937 case E_NONE:
938 /* panic */; 938 /* panic */;
@@ -955,14 +955,14 @@ tristate expr_calc_value(struct expr *e)
955 case E_AND: 955 case E_AND:
956 val1 = expr_calc_value(e->left.expr); 956 val1 = expr_calc_value(e->left.expr);
957 val2 = expr_calc_value(e->right.expr); 957 val2 = expr_calc_value(e->right.expr);
958 return E_AND(val1, val2); 958 return EXPR_AND(val1, val2);
959 case E_OR: 959 case E_OR:
960 val1 = expr_calc_value(e->left.expr); 960 val1 = expr_calc_value(e->left.expr);
961 val2 = expr_calc_value(e->right.expr); 961 val2 = expr_calc_value(e->right.expr);
962 return E_OR(val1, val2); 962 return EXPR_OR(val1, val2);
963 case E_NOT: 963 case E_NOT:
964 val1 = expr_calc_value(e->left.expr); 964 val1 = expr_calc_value(e->left.expr);
965 return E_NOT(val1); 965 return EXPR_NOT(val1);
966 case E_EQUAL: 966 case E_EQUAL:
967 sym_calc_value(e->left.sym); 967 sym_calc_value(e->left.sym);
968 sym_calc_value(e->right.sym); 968 sym_calc_value(e->right.sym);
@@ -1000,9 +1000,9 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
1000 if (t2 == E_OR) 1000 if (t2 == E_OR)
1001 return 1; 1001 return 1;
1002 case E_OR: 1002 case E_OR:
1003 if (t2 == E_CHOICE) 1003 if (t2 == E_LIST)
1004 return 1; 1004 return 1;
1005 case E_CHOICE: 1005 case E_LIST:
1006 if (t2 == 0) 1006 if (t2 == 0)
1007 return 1; 1007 return 1;
1008 default: 1008 default:
@@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
1034 expr_print(e->left.expr, fn, data, E_NOT); 1034 expr_print(e->left.expr, fn, data, E_NOT);
1035 break; 1035 break;
1036 case E_EQUAL: 1036 case E_EQUAL:
1037 fn(data, e->left.sym, e->left.sym->name); 1037 if (e->left.sym->name)
1038 fn(data, e->left.sym, e->left.sym->name);
1039 else
1040 fn(data, NULL, "<choice>");
1038 fn(data, NULL, "="); 1041 fn(data, NULL, "=");
1039 fn(data, e->right.sym, e->right.sym->name); 1042 fn(data, e->right.sym, e->right.sym->name);
1040 break; 1043 break;
1041 case E_UNEQUAL: 1044 case E_UNEQUAL:
1042 fn(data, e->left.sym, e->left.sym->name); 1045 if (e->left.sym->name)
1046 fn(data, e->left.sym, e->left.sym->name);
1047 else
1048 fn(data, NULL, "<choice>");
1043 fn(data, NULL, "!="); 1049 fn(data, NULL, "!=");
1044 fn(data, e->right.sym, e->right.sym->name); 1050 fn(data, e->right.sym, e->right.sym->name);
1045 break; 1051 break;
@@ -1053,11 +1059,11 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
1053 fn(data, NULL, " && "); 1059 fn(data, NULL, " && ");
1054 expr_print(e->right.expr, fn, data, E_AND); 1060 expr_print(e->right.expr, fn, data, E_AND);
1055 break; 1061 break;
1056 case E_CHOICE: 1062 case E_LIST:
1057 fn(data, e->right.sym, e->right.sym->name); 1063 fn(data, e->right.sym, e->right.sym->name);
1058 if (e->left.expr) { 1064 if (e->left.expr) {
1059 fn(data, NULL, " ^ "); 1065 fn(data, NULL, " ^ ");
1060 expr_print(e->left.expr, fn, data, E_CHOICE); 1066 expr_print(e->left.expr, fn, data, E_LIST);
1061 } 1067 }
1062 break; 1068 break;
1063 case E_RANGE: 1069 case E_RANGE:
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index a195986eec6f..9d4cba1c001d 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -25,14 +25,13 @@ struct file {
25 25
26#define FILE_BUSY 0x0001 26#define FILE_BUSY 0x0001
27#define FILE_SCANNED 0x0002 27#define FILE_SCANNED 0x0002
28#define FILE_PRINTED 0x0004
29 28
30typedef enum tristate { 29typedef enum tristate {
31 no, mod, yes 30 no, mod, yes
32} tristate; 31} tristate;
33 32
34enum expr_type { 33enum expr_type {
35 E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE 34 E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_LIST, E_SYMBOL, E_RANGE
36}; 35};
37 36
38union expr_data { 37union expr_data {
@@ -45,9 +44,12 @@ struct expr {
45 union expr_data left, right; 44 union expr_data left, right;
46}; 45};
47 46
48#define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2)) 47#define EXPR_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
49#define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) 48#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
50#define E_NOT(dep) (2-(dep)) 49#define EXPR_NOT(dep) (2-(dep))
50
51#define expr_list_for_each_sym(l, e, s) \
52 for (e = (l); e && (s = e->right.sym); e = e->left.expr)
51 53
52struct expr_value { 54struct expr_value {
53 struct expr *expr; 55 struct expr *expr;
@@ -86,7 +88,6 @@ struct symbol {
86#define SYMBOL_CHECK 0x0008 88#define SYMBOL_CHECK 0x0008
87#define SYMBOL_CHOICE 0x0010 89#define SYMBOL_CHOICE 0x0010
88#define SYMBOL_CHOICEVAL 0x0020 90#define SYMBOL_CHOICEVAL 0x0020
89#define SYMBOL_PRINTED 0x0040
90#define SYMBOL_VALID 0x0080 91#define SYMBOL_VALID 0x0080
91#define SYMBOL_OPTIONAL 0x0100 92#define SYMBOL_OPTIONAL 0x0100
92#define SYMBOL_WRITE 0x0200 93#define SYMBOL_WRITE 0x0200
@@ -105,7 +106,8 @@ struct symbol {
105#define SYMBOL_HASHMASK 0xff 106#define SYMBOL_HASHMASK 0xff
106 107
107enum prop_type { 108enum prop_type {
108 P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE 109 P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE,
110 P_SELECT, P_RANGE, P_ENV
109}; 111};
110 112
111struct property { 113struct property {
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 262908cfc2ac..199b22bb49e2 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -119,8 +119,6 @@ const char *dbg_print_flags(int val)
119 strcat(buf, "choice/"); 119 strcat(buf, "choice/");
120 if (val & SYMBOL_CHOICEVAL) 120 if (val & SYMBOL_CHOICEVAL)
121 strcat(buf, "choiceval/"); 121 strcat(buf, "choiceval/");
122 if (val & SYMBOL_PRINTED)
123 strcat(buf, "printed/");
124 if (val & SYMBOL_VALID) 122 if (val & SYMBOL_VALID)
125 strcat(buf, "valid/"); 123 strcat(buf, "valid/");
126 if (val & SYMBOL_OPTIONAL) 124 if (val & SYMBOL_OPTIONAL)
@@ -457,14 +455,18 @@ static void text_insert_help(struct menu *menu)
457{ 455{
458 GtkTextBuffer *buffer; 456 GtkTextBuffer *buffer;
459 GtkTextIter start, end; 457 GtkTextIter start, end;
460 const char *prompt = menu_get_prompt(menu); 458 const char *prompt = _(menu_get_prompt(menu));
461 gchar *name; 459 gchar *name;
462 const char *help; 460 const char *help;
463 461
464 help = _(menu_get_help(menu)); 462 help = menu_get_help(menu);
463
464 /* Gettextize if the help text not empty */
465 if ((help != 0) && (help[0] != 0))
466 help = _(help);
465 467
466 if (menu->sym && menu->sym->name) 468 if (menu->sym && menu->sym->name)
467 name = g_strdup_printf(_(menu->sym->name)); 469 name = g_strdup_printf(menu->sym->name);
468 else 470 else
469 name = g_strdup(""); 471 name = g_strdup("");
470 472
@@ -1171,7 +1173,7 @@ static gchar **fill_row(struct menu *menu)
1171 bzero(row, sizeof(row)); 1173 bzero(row, sizeof(row));
1172 1174
1173 row[COL_OPTION] = 1175 row[COL_OPTION] =
1174 g_strdup_printf("%s %s", menu_get_prompt(menu), 1176 g_strdup_printf("%s %s", _(menu_get_prompt(menu)),
1175 sym && sym_has_value(sym) ? "(NEW)" : ""); 1177 sym && sym_has_value(sym) ? "(NEW)" : "");
1176 1178
1177 if (show_all && !menu_is_visible(menu)) 1179 if (show_all && !menu_is_visible(menu))
@@ -1221,7 +1223,7 @@ static gchar **fill_row(struct menu *menu)
1221 1223
1222 if (def_menu) 1224 if (def_menu)
1223 row[COL_VALUE] = 1225 row[COL_VALUE] =
1224 g_strdup(menu_get_prompt(def_menu)); 1226 g_strdup(_(menu_get_prompt(def_menu)));
1225 } 1227 }
1226 if (sym->flags & SYMBOL_CHOICEVAL) 1228 if (sym->flags & SYMBOL_CHOICEVAL)
1227 row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); 1229 row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index a065d5a57c01..bed0f4e2d2f7 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -1275,6 +1275,11 @@ YY_RULE_SETUP
1275case 32: 1275case 32:
1276YY_RULE_SETUP 1276YY_RULE_SETUP
1277{ 1277{
1278 while (zconfleng) {
1279 if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
1280 break;
1281 zconfleng--;
1282 }
1278 append_string(zconftext, zconfleng); 1283 append_string(zconftext, zconfleng);
1279 if (!first_ts) 1284 if (!first_ts)
1280 first_ts = last_ts; 1285 first_ts = last_ts;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 8a07ee4f6bd4..4bc68f20a73c 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -44,6 +44,7 @@ extern "C" {
44 44
45#define T_OPT_MODULES 1 45#define T_OPT_MODULES 1
46#define T_OPT_DEFCONFIG_LIST 2 46#define T_OPT_DEFCONFIG_LIST 2
47#define T_OPT_ENV 3
47 48
48struct kconf_id { 49struct kconf_id {
49 int name; 50 int name;
@@ -74,6 +75,7 @@ void kconfig_load(void);
74 75
75/* menu.c */ 76/* menu.c */
76void menu_init(void); 77void menu_init(void);
78void menu_warn(struct menu *menu, const char *fmt, ...);
77struct menu *menu_add_menu(void); 79struct menu *menu_add_menu(void);
78void menu_end_menu(void); 80void menu_end_menu(void);
79void menu_add_entry(struct symbol *sym); 81void menu_add_entry(struct symbol *sym);
@@ -103,6 +105,8 @@ void str_printf(struct gstr *gs, const char *fmt, ...);
103const char *str_get(struct gstr *gs); 105const char *str_get(struct gstr *gs);
104 106
105/* symbol.c */ 107/* symbol.c */
108extern struct expr *sym_env_list;
109
106void sym_init(void); 110void sym_init(void);
107void sym_clear_all_valid(void); 111void sym_clear_all_valid(void);
108void sym_set_all_changed(void); 112void sym_set_all_changed(void);
@@ -110,6 +114,7 @@ void sym_set_changed(struct symbol *sym);
110struct symbol *sym_check_deps(struct symbol *sym); 114struct symbol *sym_check_deps(struct symbol *sym);
111struct property *prop_alloc(enum prop_type type, struct symbol *sym); 115struct property *prop_alloc(enum prop_type type, struct symbol *sym);
112struct symbol *prop_get_symbol(struct property *prop); 116struct symbol *prop_get_symbol(struct property *prop);
117struct property *sym_get_env_prop(struct symbol *sym);
113 118
114static inline tristate sym_get_tristate_value(struct symbol *sym) 119static inline tristate sym_get_tristate_value(struct symbol *sym)
115{ 120{
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 9681476b96e7..62e1e02126e6 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -36,14 +36,16 @@ trap "rm -f $tmp" 0 1 2 3 15
36 36
37# Check if we can link to ncurses 37# Check if we can link to ncurses
38check() { 38check() {
39 echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null 39 echo -e " #include CURSES_LOC \n main() {}" |
40 $cc -xc - -o $tmp 2> /dev/null
40 if [ $? != 0 ]; then 41 if [ $? != 0 ]; then
41 echo " *** Unable to find the ncurses libraries." 1>&2 42 echo " *** Unable to find the ncurses libraries or the" 1>&2
42 echo " *** make menuconfig require the ncurses libraries" 1>&2 43 echo " *** required header files." 1>&2
43 echo " *** " 1>&2 44 echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
44 echo " *** Install ncurses (ncurses-devel) and try again" 1>&2 45 echo " *** " 1>&2
45 echo " *** " 1>&2 46 echo " *** Install ncurses (ncurses-devel) and try again." 1>&2
46 exit 1 47 echo " *** " 1>&2
48 exit 1
47 fi 49 fi
48} 50}
49 51
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index cf697080dddd..b2a878c936d6 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -97,8 +97,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
97 int x = width / 2 - 11; 97 int x = width / 2 - 11;
98 int y = height - 2; 98 int y = height - 2;
99 99
100 print_button(dialog, "Select", y, x, selected == 0); 100 print_button(dialog, gettext("Select"), y, x, selected == 0);
101 print_button(dialog, " Help ", y, x + 14, selected == 1); 101 print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
102 102
103 wmove(dialog, y, x + 1 + 14 * selected); 103 wmove(dialog, y, x + 1 + 14 * selected);
104 wrefresh(dialog); 104 wrefresh(dialog);
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index 7e17eba75ae8..b5211fce0d94 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -26,6 +26,12 @@
26#include <string.h> 26#include <string.h>
27#include <stdbool.h> 27#include <stdbool.h>
28 28
29#ifndef KBUILD_NO_NLS
30# include <libintl.h>
31#else
32# define gettext(Msgid) ((const char *) (Msgid))
33#endif
34
29#ifdef __sun__ 35#ifdef __sun__
30#define CURS_MACROS 36#define CURS_MACROS
31#endif 37#endif
@@ -187,10 +193,9 @@ int item_is_tag(char tag);
187int on_key_esc(WINDOW *win); 193int on_key_esc(WINDOW *win);
188int on_key_resize(void); 194int on_key_resize(void);
189 195
190void init_dialog(const char *backtitle); 196int init_dialog(const char *backtitle);
191void set_dialog_backtitle(const char *backtitle); 197void set_dialog_backtitle(const char *backtitle);
192void reset_dialog(void); 198void end_dialog(int x, int y);
193void end_dialog(void);
194void attr_clear(WINDOW * win, int height, int width, chtype attr); 199void attr_clear(WINDOW * win, int height, int width, chtype attr);
195void dialog_clear(void); 200void dialog_clear(void);
196void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); 201void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 05e72066b359..4946bd02b46d 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -31,8 +31,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
31 int x = width / 2 - 11; 31 int x = width / 2 - 11;
32 int y = height - 2; 32 int y = height - 2;
33 33
34 print_button(dialog, " Ok ", y, x, selected == 0); 34 print_button(dialog, gettext(" Ok "), y, x, selected == 0);
35 print_button(dialog, " Help ", y, x + 14, selected == 1); 35 print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
36 36
37 wmove(dialog, y, x + 1 + 14 * selected); 37 wmove(dialog, y, x + 1 + 14 * selected);
38 wrefresh(dialog); 38 wrefresh(dialog);
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 0d83159d9012..fa9d633f293c 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -157,9 +157,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected)
157 int x = width / 2 - 16; 157 int x = width / 2 - 16;
158 int y = height - 2; 158 int y = height - 2;
159 159
160 print_button(win, "Select", y, x, selected == 0); 160 print_button(win, gettext("Select"), y, x, selected == 0);
161 print_button(win, " Exit ", y, x + 12, selected == 1); 161 print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
162 print_button(win, " Help ", y, x + 24, selected == 2); 162 print_button(win, gettext(" Help "), y, x + 24, selected == 2);
163 163
164 wmove(win, y, x + 1 + 12 * selected); 164 wmove(win, y, x + 1 + 12 * selected);
165 wrefresh(win); 165 wrefresh(win);
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index fabfc1ad789d..c704712d0227 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -114,7 +114,7 @@ do_resize:
114 114
115 print_title(dialog, title, width); 115 print_title(dialog, title, width);
116 116
117 print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); 117 print_button(dialog, gettext(" Exit "), height - 2, width / 2 - 4, TRUE);
118 wnoutrefresh(dialog); 118 wnoutrefresh(dialog);
119 getyx(dialog, cur_y, cur_x); /* Save cursor position */ 119 getyx(dialog, cur_y, cur_x); /* Save cursor position */
120 120
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index a1bddefe73d0..86d95cca46a7 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -266,31 +266,41 @@ void dialog_clear(void)
266/* 266/*
267 * Do some initialization for dialog 267 * Do some initialization for dialog
268 */ 268 */
269void init_dialog(const char *backtitle) 269int init_dialog(const char *backtitle)
270{ 270{
271 dlg.backtitle = backtitle; 271 int height, width;
272 color_setup(getenv("MENUCONFIG_COLOR")); 272
273} 273 initscr(); /* Init curses */
274 getmaxyx(stdscr, height, width);
275 if (height < 19 || width < 80) {
276 endwin();
277 return -ERRDISPLAYTOOSMALL;
278 }
274 279
275void set_dialog_backtitle(const char *backtitle)
276{
277 dlg.backtitle = backtitle; 280 dlg.backtitle = backtitle;
278} 281 color_setup(getenv("MENUCONFIG_COLOR"));
279 282
280void reset_dialog(void)
281{
282 initscr(); /* Init curses */
283 keypad(stdscr, TRUE); 283 keypad(stdscr, TRUE);
284 cbreak(); 284 cbreak();
285 noecho(); 285 noecho();
286 dialog_clear(); 286 dialog_clear();
287
288 return 0;
289}
290
291void set_dialog_backtitle(const char *backtitle)
292{
293 dlg.backtitle = backtitle;
287} 294}
288 295
289/* 296/*
290 * End using dialog functions. 297 * End using dialog functions.
291 */ 298 */
292void end_dialog(void) 299void end_dialog(int x, int y)
293{ 300{
301 /* move cursor back to original position */
302 move(y, x);
303 refresh();
294 endwin(); 304 endwin();
295} 305}
296 306
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c
index ee0a04e3e012..4e6e8090c20b 100644
--- a/scripts/kconfig/lxdialog/yesno.c
+++ b/scripts/kconfig/lxdialog/yesno.c
@@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
29 int x = width / 2 - 10; 29 int x = width / 2 - 10;
30 int y = height - 2; 30 int y = height - 2;
31 31
32 print_button(dialog, " Yes ", y, x, selected == 0); 32 print_button(dialog, gettext(" Yes "), y, x, selected == 0);
33 print_button(dialog, " No ", y, x + 13, selected == 1); 33 print_button(dialog, gettext(" No "), y, x + 13, selected == 1);
34 34
35 wmove(dialog, y, x + 1 + 13 * selected); 35 wmove(dialog, y, x + 1 + 13 * selected);
36 wrefresh(dialog); 36 wrefresh(dialog);
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 47e226fdedd7..50e61c411bc0 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -8,17 +8,13 @@
8 * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> 8 * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br>
9 */ 9 */
10 10
11#include <sys/ioctl.h>
12#include <sys/wait.h>
13#include <ctype.h> 11#include <ctype.h>
14#include <errno.h> 12#include <errno.h>
15#include <fcntl.h> 13#include <fcntl.h>
16#include <limits.h> 14#include <limits.h>
17#include <signal.h>
18#include <stdarg.h> 15#include <stdarg.h>
19#include <stdlib.h> 16#include <stdlib.h>
20#include <string.h> 17#include <string.h>
21#include <termios.h>
22#include <unistd.h> 18#include <unistd.h>
23#include <locale.h> 19#include <locale.h>
24 20
@@ -275,8 +271,6 @@ search_help[] = N_(
275 "\n"); 271 "\n");
276 272
277static int indent; 273static int indent;
278static struct termios ios_org;
279static int rows = 0, cols = 0;
280static struct menu *current_menu; 274static struct menu *current_menu;
281static int child_count; 275static int child_count;
282static int single_menu_mode; 276static int single_menu_mode;
@@ -290,51 +284,16 @@ static void show_textbox(const char *title, const char *text, int r, int c);
290static void show_helptext(const char *title, const char *text); 284static void show_helptext(const char *title, const char *text);
291static void show_help(struct menu *menu); 285static void show_help(struct menu *menu);
292 286
293static void init_wsize(void)
294{
295 struct winsize ws;
296 char *env;
297
298 if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) {
299 rows = ws.ws_row;
300 cols = ws.ws_col;
301 }
302
303 if (!rows) {
304 env = getenv("LINES");
305 if (env)
306 rows = atoi(env);
307 if (!rows)
308 rows = 24;
309 }
310 if (!cols) {
311 env = getenv("COLUMNS");
312 if (env)
313 cols = atoi(env);
314 if (!cols)
315 cols = 80;
316 }
317
318 if (rows < 19 || cols < 80) {
319 fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
320 fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
321 exit(1);
322 }
323
324 rows -= 4;
325 cols -= 5;
326}
327
328static void get_prompt_str(struct gstr *r, struct property *prop) 287static void get_prompt_str(struct gstr *r, struct property *prop)
329{ 288{
330 int i, j; 289 int i, j;
331 struct menu *submenu[8], *menu; 290 struct menu *submenu[8], *menu;
332 291
333 str_printf(r, "Prompt: %s\n", prop->text); 292 str_printf(r, _("Prompt: %s\n"), _(prop->text));
334 str_printf(r, " Defined at %s:%d\n", prop->menu->file->name, 293 str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
335 prop->menu->lineno); 294 prop->menu->lineno);
336 if (!expr_is_yes(prop->visible.expr)) { 295 if (!expr_is_yes(prop->visible.expr)) {
337 str_append(r, " Depends on: "); 296 str_append(r, _(" Depends on: "));
338 expr_gstr_print(prop->visible.expr, r); 297 expr_gstr_print(prop->visible.expr, r);
339 str_append(r, "\n"); 298 str_append(r, "\n");
340 } 299 }
@@ -342,13 +301,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop)
342 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) 301 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
343 submenu[i++] = menu; 302 submenu[i++] = menu;
344 if (i > 0) { 303 if (i > 0) {
345 str_printf(r, " Location:\n"); 304 str_printf(r, _(" Location:\n"));
346 for (j = 4; --i >= 0; j += 2) { 305 for (j = 4; --i >= 0; j += 2) {
347 menu = submenu[i]; 306 menu = submenu[i];
348 str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); 307 str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
349 if (menu->sym) { 308 if (menu->sym) {
350 str_printf(r, " (%s [=%s])", menu->sym->name ? 309 str_printf(r, " (%s [=%s])", menu->sym->name ?
351 menu->sym->name : "<choice>", 310 menu->sym->name : _("<choice>"),
352 sym_get_string_value(menu->sym)); 311 sym_get_string_value(menu->sym));
353 } 312 }
354 str_append(r, "\n"); 313 str_append(r, "\n");
@@ -378,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym)
378 if (hit) 337 if (hit)
379 str_append(r, "\n"); 338 str_append(r, "\n");
380 if (sym->rev_dep.expr) { 339 if (sym->rev_dep.expr) {
381 str_append(r, " Selected by: "); 340 str_append(r, _(" Selected by: "));
382 expr_gstr_print(sym->rev_dep.expr, r); 341 expr_gstr_print(sym->rev_dep.expr, r);
383 str_append(r, "\n"); 342 str_append(r, "\n");
384 } 343 }
@@ -394,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr)
394 for (i = 0; sym_arr && (sym = sym_arr[i]); i++) 353 for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
395 get_symbol_str(&res, sym); 354 get_symbol_str(&res, sym);
396 if (!i) 355 if (!i)
397 str_append(&res, "No matches found.\n"); 356 str_append(&res, _("No matches found.\n"));
398 return res; 357 return res;
399} 358}
400 359
@@ -474,6 +433,7 @@ static void build_conf(struct menu *menu)
474 switch (prop->type) { 433 switch (prop->type) {
475 case P_MENU: 434 case P_MENU:
476 child_count++; 435 child_count++;
436 prompt = _(prompt);
477 if (single_menu_mode) { 437 if (single_menu_mode) {
478 item_make("%s%*c%s", 438 item_make("%s%*c%s",
479 menu->data ? "-->" : "++>", 439 menu->data ? "-->" : "++>",
@@ -489,7 +449,7 @@ static void build_conf(struct menu *menu)
489 case P_COMMENT: 449 case P_COMMENT:
490 if (prompt) { 450 if (prompt) {
491 child_count++; 451 child_count++;
492 item_make(" %*c*** %s ***", indent + 1, ' ', prompt); 452 item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt));
493 item_set_tag(':'); 453 item_set_tag(':');
494 item_set_data(menu); 454 item_set_data(menu);
495 } 455 }
@@ -497,7 +457,7 @@ static void build_conf(struct menu *menu)
497 default: 457 default:
498 if (prompt) { 458 if (prompt) {
499 child_count++; 459 child_count++;
500 item_make("---%*c%s", indent + 1, ' ', prompt); 460 item_make("---%*c%s", indent + 1, ' ', _(prompt));
501 item_set_tag(':'); 461 item_set_tag(':');
502 item_set_data(menu); 462 item_set_data(menu);
503 } 463 }
@@ -541,10 +501,10 @@ static void build_conf(struct menu *menu)
541 item_set_data(menu); 501 item_set_data(menu);
542 } 502 }
543 503
544 item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); 504 item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
545 if (val == yes) { 505 if (val == yes) {
546 if (def_menu) { 506 if (def_menu) {
547 item_add_str(" (%s)", menu_get_prompt(def_menu)); 507 item_add_str(" (%s)", _(menu_get_prompt(def_menu)));
548 item_add_str(" --->"); 508 item_add_str(" --->");
549 if (def_menu->list) { 509 if (def_menu->list) {
550 indent += 2; 510 indent += 2;
@@ -556,7 +516,7 @@ static void build_conf(struct menu *menu)
556 } 516 }
557 } else { 517 } else {
558 if (menu == current_menu) { 518 if (menu == current_menu) {
559 item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); 519 item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
560 item_set_tag(':'); 520 item_set_tag(':');
561 item_set_data(menu); 521 item_set_data(menu);
562 goto conf_childs; 522 goto conf_childs;
@@ -599,17 +559,17 @@ static void build_conf(struct menu *menu)
599 tmp = indent - tmp + 4; 559 tmp = indent - tmp + 4;
600 if (tmp < 0) 560 if (tmp < 0)
601 tmp = 0; 561 tmp = 0;
602 item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), 562 item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)),
603 (sym_has_value(sym) || !sym_is_changable(sym)) ? 563 (sym_has_value(sym) || !sym_is_changable(sym)) ?
604 "" : " (NEW)"); 564 "" : _(" (NEW)"));
605 item_set_tag('s'); 565 item_set_tag('s');
606 item_set_data(menu); 566 item_set_data(menu);
607 goto conf_childs; 567 goto conf_childs;
608 } 568 }
609 } 569 }
610 item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), 570 item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)),
611 (sym_has_value(sym) || !sym_is_changable(sym)) ? 571 (sym_has_value(sym) || !sym_is_changable(sym)) ?
612 "" : " (NEW)"); 572 "" : _(" (NEW)"));
613 if (menu->prompt->type == P_MENU) { 573 if (menu->prompt->type == P_MENU) {
614 item_add_str(" --->"); 574 item_add_str(" --->");
615 return; 575 return;
@@ -647,7 +607,7 @@ static void conf(struct menu *menu)
647 item_set_tag('S'); 607 item_set_tag('S');
648 } 608 }
649 dialog_clear(); 609 dialog_clear();
650 res = dialog_menu(prompt ? prompt : _("Main Menu"), 610 res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
651 _(menu_instructions), 611 _(menu_instructions),
652 active_menu, &s_scroll); 612 active_menu, &s_scroll);
653 if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) 613 if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
@@ -694,7 +654,7 @@ static void conf(struct menu *menu)
694 if (sym) 654 if (sym)
695 show_help(submenu); 655 show_help(submenu);
696 else 656 else
697 show_helptext("README", _(mconf_readme)); 657 show_helptext(_("README"), _(mconf_readme));
698 break; 658 break;
699 case 3: 659 case 3:
700 if (item_is_tag('t')) { 660 if (item_is_tag('t')) {
@@ -752,13 +712,13 @@ static void show_help(struct menu *menu)
752 str_append(&help, nohelp_text); 712 str_append(&help, nohelp_text);
753 } 713 }
754 get_symbol_str(&help, sym); 714 get_symbol_str(&help, sym);
755 show_helptext(menu_get_prompt(menu), str_get(&help)); 715 show_helptext(_(menu_get_prompt(menu)), str_get(&help));
756 str_free(&help); 716 str_free(&help);
757} 717}
758 718
759static void conf_choice(struct menu *menu) 719static void conf_choice(struct menu *menu)
760{ 720{
761 const char *prompt = menu_get_prompt(menu); 721 const char *prompt = _(menu_get_prompt(menu));
762 struct menu *child; 722 struct menu *child;
763 struct symbol *active; 723 struct symbol *active;
764 724
@@ -772,7 +732,7 @@ static void conf_choice(struct menu *menu)
772 for (child = menu->list; child; child = child->next) { 732 for (child = menu->list; child; child = child->next) {
773 if (!menu_is_visible(child)) 733 if (!menu_is_visible(child))
774 continue; 734 continue;
775 item_make("%s", menu_get_prompt(child)); 735 item_make("%s", _(menu_get_prompt(child)));
776 item_set_data(child); 736 item_set_data(child);
777 if (child->sym == active) 737 if (child->sym == active)
778 item_set_selected(1); 738 item_set_selected(1);
@@ -780,7 +740,7 @@ static void conf_choice(struct menu *menu)
780 item_set_tag('X'); 740 item_set_tag('X');
781 } 741 }
782 dialog_clear(); 742 dialog_clear();
783 res = dialog_checklist(prompt ? prompt : _("Main Menu"), 743 res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
784 _(radiolist_instructions), 744 _(radiolist_instructions),
785 15, 70, 6); 745 15, 70, 6);
786 selected = item_activate_selected(); 746 selected = item_activate_selected();
@@ -826,10 +786,10 @@ static void conf_string(struct menu *menu)
826 heading = _(inputbox_instructions_string); 786 heading = _(inputbox_instructions_string);
827 break; 787 break;
828 default: 788 default:
829 heading = "Internal mconf error!"; 789 heading = _("Internal mconf error!");
830 } 790 }
831 dialog_clear(); 791 dialog_clear();
832 res = dialog_inputbox(prompt ? prompt : _("Main Menu"), 792 res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"),
833 heading, 10, 75, 793 heading, 10, 75,
834 sym_get_string_value(menu->sym)); 794 sym_get_string_value(menu->sym));
835 switch (res) { 795 switch (res) {
@@ -900,13 +860,9 @@ static void conf_save(void)
900 } 860 }
901} 861}
902 862
903static void conf_cleanup(void)
904{
905 tcsetattr(1, TCSAFLUSH, &ios_org);
906}
907
908int main(int ac, char **av) 863int main(int ac, char **av)
909{ 864{
865 int saved_x, saved_y;
910 char *mode; 866 char *mode;
911 int res; 867 int res;
912 868
@@ -923,11 +879,13 @@ int main(int ac, char **av)
923 single_menu_mode = 1; 879 single_menu_mode = 1;
924 } 880 }
925 881
926 tcgetattr(1, &ios_org); 882 getyx(stdscr, saved_y, saved_x);
927 atexit(conf_cleanup); 883 if (init_dialog(NULL)) {
928 init_wsize(); 884 fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
929 reset_dialog(); 885 fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
930 init_dialog(NULL); 886 return 1;
887 }
888
931 set_config_filename(conf_get_configname()); 889 set_config_filename(conf_get_configname());
932 do { 890 do {
933 conf(&rootmenu); 891 conf(&rootmenu);
@@ -941,7 +899,7 @@ int main(int ac, char **av)
941 else 899 else
942 res = -1; 900 res = -1;
943 } while (res == KEY_ESC); 901 } while (res == KEY_ESC);
944 end_dialog(); 902 end_dialog(saved_x, saved_y);
945 903
946 switch (res) { 904 switch (res) {
947 case 0: 905 case 0:
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index f9d0d91a3fe4..fdad17367f61 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -15,7 +15,7 @@ static struct menu **last_entry_ptr;
15struct file *file_list; 15struct file *file_list;
16struct file *current_file; 16struct file *current_file;
17 17
18static void menu_warn(struct menu *menu, const char *fmt, ...) 18void menu_warn(struct menu *menu, const char *fmt, ...)
19{ 19{
20 va_list ap; 20 va_list ap;
21 va_start(ap, fmt); 21 va_start(ap, fmt);
@@ -172,6 +172,9 @@ void menu_add_option(int token, char *arg)
172 else if (sym_defconfig_list != current_entry->sym) 172 else if (sym_defconfig_list != current_entry->sym)
173 zconf_error("trying to redefine defconfig symbol"); 173 zconf_error("trying to redefine defconfig symbol");
174 break; 174 break;
175 case T_OPT_ENV:
176 prop_add_env(arg);
177 break;
175 } 178 }
176} 179}
177 180
@@ -239,9 +242,11 @@ void menu_finalize(struct menu *parent)
239 for (menu = parent->list; menu; menu = menu->next) { 242 for (menu = parent->list; menu; menu = menu->next) {
240 if (menu->sym) { 243 if (menu->sym) {
241 current_entry = parent; 244 current_entry = parent;
242 menu_set_type(menu->sym->type); 245 if (sym->type == S_UNKNOWN)
246 menu_set_type(menu->sym->type);
243 current_entry = menu; 247 current_entry = menu;
244 menu_set_type(sym->type); 248 if (menu->sym->type == S_UNKNOWN)
249 menu_set_type(sym->type);
245 break; 250 break;
246 } 251 }
247 } 252 }
@@ -326,12 +331,42 @@ void menu_finalize(struct menu *parent)
326 "values not supported"); 331 "values not supported");
327 } 332 }
328 current_entry = menu; 333 current_entry = menu;
329 menu_set_type(sym->type); 334 if (menu->sym->type == S_UNKNOWN)
335 menu_set_type(sym->type);
336 /* Non-tristate choice values of tristate choices must
337 * depend on the choice being set to Y. The choice
338 * values' dependencies were propagated to their
339 * properties above, so the change here must be re-
340 * propagated. */
341 if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
342 basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
343 basedep = expr_alloc_and(basedep, menu->dep);
344 basedep = expr_eliminate_dups(basedep);
345 menu->dep = basedep;
346 for (prop = menu->sym->prop; prop; prop = prop->next) {
347 if (prop->menu != menu)
348 continue;
349 dep = expr_alloc_and(expr_copy(basedep),
350 prop->visible.expr);
351 dep = expr_eliminate_dups(dep);
352 dep = expr_trans_bool(dep);
353 prop->visible.expr = dep;
354 if (prop->type == P_SELECT) {
355 struct symbol *es = prop_get_symbol(prop);
356 dep2 = expr_alloc_symbol(menu->sym);
357 dep = expr_alloc_and(dep2,
358 expr_copy(dep));
359 dep = expr_alloc_or(es->rev_dep.expr, dep);
360 dep = expr_eliminate_dups(dep);
361 es->rev_dep.expr = dep;
362 }
363 }
364 }
330 menu_add_symbol(P_CHOICE, sym, NULL); 365 menu_add_symbol(P_CHOICE, sym, NULL);
331 prop = sym_get_choice_prop(sym); 366 prop = sym_get_choice_prop(sym);
332 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr) 367 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
333 ; 368 ;
334 *ep = expr_alloc_one(E_CHOICE, NULL); 369 *ep = expr_alloc_one(E_LIST, NULL);
335 (*ep)->right.sym = menu->sym; 370 (*ep)->right.sym = menu->sym;
336 } 371 }
337 if (menu->list && (!menu->prompt || !menu->prompt->text)) { 372 if (menu->list && (!menu->prompt || !menu->prompt->text)) {
@@ -394,9 +429,9 @@ bool menu_is_visible(struct menu *menu)
394const char *menu_get_prompt(struct menu *menu) 429const char *menu_get_prompt(struct menu *menu)
395{ 430{
396 if (menu->prompt) 431 if (menu->prompt)
397 return _(menu->prompt->text); 432 return menu->prompt->text;
398 else if (menu->sym) 433 else if (menu->sym)
399 return _(menu->sym->name); 434 return menu->sym->name;
400 return NULL; 435 return NULL;
401} 436}
402 437
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index b9bb32dfd628..5d0fd38b089b 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -114,7 +114,7 @@ void ConfigItem::updateMenu(void)
114 114
115 sym = menu->sym; 115 sym = menu->sym;
116 prop = menu->prompt; 116 prop = menu->prompt;
117 prompt = QString::fromLocal8Bit(menu_get_prompt(menu)); 117 prompt = _(menu_get_prompt(menu));
118 118
119 if (prop) switch (prop->type) { 119 if (prop) switch (prop->type) {
120 case P_MENU: 120 case P_MENU:
@@ -208,7 +208,7 @@ void ConfigItem::updateMenu(void)
208 break; 208 break;
209 } 209 }
210 if (!sym_has_value(sym) && visible) 210 if (!sym_has_value(sym) && visible)
211 prompt += " (NEW)"; 211 prompt += _(" (NEW)");
212set_prompt: 212set_prompt:
213 setText(promptColIdx, prompt); 213 setText(promptColIdx, prompt);
214} 214}
@@ -346,7 +346,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
346 346
347 for (i = 0; i < colNr; i++) 347 for (i = 0; i < colNr; i++)
348 colMap[i] = colRevMap[i] = -1; 348 colMap[i] = colRevMap[i] = -1;
349 addColumn(promptColIdx, "Option"); 349 addColumn(promptColIdx, _("Option"));
350 350
351 reinit(); 351 reinit();
352} 352}
@@ -360,14 +360,14 @@ void ConfigList::reinit(void)
360 removeColumn(nameColIdx); 360 removeColumn(nameColIdx);
361 361
362 if (showName) 362 if (showName)
363 addColumn(nameColIdx, "Name"); 363 addColumn(nameColIdx, _("Name"));
364 if (showRange) { 364 if (showRange) {
365 addColumn(noColIdx, "N"); 365 addColumn(noColIdx, "N");
366 addColumn(modColIdx, "M"); 366 addColumn(modColIdx, "M");
367 addColumn(yesColIdx, "Y"); 367 addColumn(yesColIdx, "Y");
368 } 368 }
369 if (showData) 369 if (showData)
370 addColumn(dataColIdx, "Value"); 370 addColumn(dataColIdx, _("Value"));
371 371
372 updateListAll(); 372 updateListAll();
373} 373}
@@ -803,7 +803,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
803 QAction *action; 803 QAction *action;
804 804
805 headerPopup = new QPopupMenu(this); 805 headerPopup = new QPopupMenu(this);
806 action = new QAction(NULL, "Show Name", 0, this); 806 action = new QAction(NULL, _("Show Name"), 0, this);
807 action->setToggleAction(TRUE); 807 action->setToggleAction(TRUE);
808 connect(action, SIGNAL(toggled(bool)), 808 connect(action, SIGNAL(toggled(bool)),
809 parent(), SLOT(setShowName(bool))); 809 parent(), SLOT(setShowName(bool)));
@@ -811,7 +811,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
811 action, SLOT(setOn(bool))); 811 action, SLOT(setOn(bool)));
812 action->setOn(showName); 812 action->setOn(showName);
813 action->addTo(headerPopup); 813 action->addTo(headerPopup);
814 action = new QAction(NULL, "Show Range", 0, this); 814 action = new QAction(NULL, _("Show Range"), 0, this);
815 action->setToggleAction(TRUE); 815 action->setToggleAction(TRUE);
816 connect(action, SIGNAL(toggled(bool)), 816 connect(action, SIGNAL(toggled(bool)),
817 parent(), SLOT(setShowRange(bool))); 817 parent(), SLOT(setShowRange(bool)));
@@ -819,7 +819,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
819 action, SLOT(setOn(bool))); 819 action, SLOT(setOn(bool)));
820 action->setOn(showRange); 820 action->setOn(showRange);
821 action->addTo(headerPopup); 821 action->addTo(headerPopup);
822 action = new QAction(NULL, "Show Data", 0, this); 822 action = new QAction(NULL, _("Show Data"), 0, this);
823 action->setToggleAction(TRUE); 823 action->setToggleAction(TRUE);
824 connect(action, SIGNAL(toggled(bool)), 824 connect(action, SIGNAL(toggled(bool)),
825 parent(), SLOT(setShowData(bool))); 825 parent(), SLOT(setShowData(bool)));
@@ -1041,7 +1041,12 @@ void ConfigInfoView::menuInfo(void)
1041 if (showDebug()) 1041 if (showDebug())
1042 debug = debug_info(sym); 1042 debug = debug_info(sym);
1043 1043
1044 help = print_filter(_(menu_get_help(menu))); 1044 help = menu_get_help(menu);
1045 /* Gettextize if the help text not empty */
1046 if (help.isEmpty())
1047 help = print_filter(menu_get_help(menu));
1048 else
1049 help = print_filter(_(menu_get_help(menu)));
1045 } else if (menu->prompt) { 1050 } else if (menu->prompt) {
1046 head += "<big><b>"; 1051 head += "<big><b>";
1047 head += print_filter(_(menu->prompt->text)); 1052 head += print_filter(_(menu->prompt->text));
@@ -1083,7 +1088,11 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
1083 debug += "</a><br>"; 1088 debug += "</a><br>";
1084 break; 1089 break;
1085 case P_DEFAULT: 1090 case P_DEFAULT:
1086 debug += "default: "; 1091 case P_SELECT:
1092 case P_RANGE:
1093 case P_ENV:
1094 debug += prop_get_type_name(prop->type);
1095 debug += ": ";
1087 expr_print(prop->expr, expr_print_help, &debug, E_NONE); 1096 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
1088 debug += "<br>"; 1097 debug += "<br>";
1089 break; 1098 break;
@@ -1094,16 +1103,6 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
1094 debug += "<br>"; 1103 debug += "<br>";
1095 } 1104 }
1096 break; 1105 break;
1097 case P_SELECT:
1098 debug += "select: ";
1099 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
1100 debug += "<br>";
1101 break;
1102 case P_RANGE:
1103 debug += "range: ";
1104 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
1105 debug += "<br>";
1106 break;
1107 default: 1106 default:
1108 debug += "unknown property: "; 1107 debug += "unknown property: ";
1109 debug += prop_get_type_name(prop->type); 1108 debug += prop_get_type_name(prop->type);
@@ -1167,7 +1166,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
1167QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) 1166QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
1168{ 1167{
1169 QPopupMenu* popup = Parent::createPopupMenu(pos); 1168 QPopupMenu* popup = Parent::createPopupMenu(pos);
1170 QAction* action = new QAction(NULL,"Show Debug Info", 0, popup); 1169 QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
1171 action->setToggleAction(TRUE); 1170 action->setToggleAction(TRUE);
1172 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1171 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
1173 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1172 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1189,11 +1188,11 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
1189 1188
1190 QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6); 1189 QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6);
1191 QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6); 1190 QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6);
1192 layout2->addWidget(new QLabel("Find:", this)); 1191 layout2->addWidget(new QLabel(_("Find:"), this));
1193 editField = new QLineEdit(this); 1192 editField = new QLineEdit(this);
1194 connect(editField, SIGNAL(returnPressed()), SLOT(search())); 1193 connect(editField, SIGNAL(returnPressed()), SLOT(search()));
1195 layout2->addWidget(editField); 1194 layout2->addWidget(editField);
1196 searchButton = new QPushButton("Search", this); 1195 searchButton = new QPushButton(_("Search"), this);
1197 searchButton->setAutoDefault(FALSE); 1196 searchButton->setAutoDefault(FALSE);
1198 connect(searchButton, SIGNAL(clicked()), SLOT(search())); 1197 connect(searchButton, SIGNAL(clicked()), SLOT(search()));
1199 layout2->addWidget(searchButton); 1198 layout2->addWidget(searchButton);
@@ -1313,58 +1312,58 @@ ConfigMainWindow::ConfigMainWindow(void)
1313 menu = menuBar(); 1312 menu = menuBar();
1314 toolBar = new QToolBar("Tools", this); 1313 toolBar = new QToolBar("Tools", this);
1315 1314
1316 backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this); 1315 backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this);
1317 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 1316 connect(backAction, SIGNAL(activated()), SLOT(goBack()));
1318 backAction->setEnabled(FALSE); 1317 backAction->setEnabled(FALSE);
1319 QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this); 1318 QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this);
1320 connect(quitAction, SIGNAL(activated()), SLOT(close())); 1319 connect(quitAction, SIGNAL(activated()), SLOT(close()));
1321 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); 1320 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), CTRL+Key_L, this);
1322 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); 1321 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
1323 saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); 1322 saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), CTRL+Key_S, this);
1324 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1323 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
1325 conf_set_changed_callback(conf_changed); 1324 conf_set_changed_callback(conf_changed);
1326 // Set saveAction's initial state 1325 // Set saveAction's initial state
1327 conf_changed(); 1326 conf_changed();
1328 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); 1327 QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this);
1329 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1328 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
1330 QAction *searchAction = new QAction("Find", "&Find", CTRL+Key_F, this); 1329 QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this);
1331 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); 1330 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
1332 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); 1331 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
1333 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1332 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
1334 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this); 1333 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
1335 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); 1334 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
1336 QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this); 1335 QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
1337 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); 1336 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
1338 1337
1339 QAction *showNameAction = new QAction(NULL, "Show Name", 0, this); 1338 QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
1340 showNameAction->setToggleAction(TRUE); 1339 showNameAction->setToggleAction(TRUE);
1341 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1340 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
1342 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); 1341 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
1343 showNameAction->setOn(configView->showName()); 1342 showNameAction->setOn(configView->showName());
1344 QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this); 1343 QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this);
1345 showRangeAction->setToggleAction(TRUE); 1344 showRangeAction->setToggleAction(TRUE);
1346 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); 1345 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
1347 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); 1346 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
1348 showRangeAction->setOn(configList->showRange); 1347 showRangeAction->setOn(configList->showRange);
1349 QAction *showDataAction = new QAction(NULL, "Show Data", 0, this); 1348 QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this);
1350 showDataAction->setToggleAction(TRUE); 1349 showDataAction->setToggleAction(TRUE);
1351 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1350 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
1352 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); 1351 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
1353 showDataAction->setOn(configList->showData); 1352 showDataAction->setOn(configList->showData);
1354 QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this); 1353 QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
1355 showAllAction->setToggleAction(TRUE); 1354 showAllAction->setToggleAction(TRUE);
1356 connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); 1355 connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
1357 connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); 1356 connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
1358 showAllAction->setOn(configList->showAll); 1357 showAllAction->setOn(configList->showAll);
1359 QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); 1358 QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
1360 showDebugAction->setToggleAction(TRUE); 1359 showDebugAction->setToggleAction(TRUE);
1361 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1360 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
1362 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); 1361 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
1363 showDebugAction->setOn(helpText->showDebug()); 1362 showDebugAction->setOn(helpText->showDebug());
1364 1363
1365 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); 1364 QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this);
1366 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); 1365 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
1367 QAction *showAboutAction = new QAction(NULL, "About", 0, this); 1366 QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
1368 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); 1367 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
1369 1368
1370 // init tool bar 1369 // init tool bar
@@ -1379,7 +1378,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1379 1378
1380 // create config menu 1379 // create config menu
1381 QPopupMenu* config = new QPopupMenu(this); 1380 QPopupMenu* config = new QPopupMenu(this);
1382 menu->insertItem("&File", config); 1381 menu->insertItem(_("&File"), config);
1383 loadAction->addTo(config); 1382 loadAction->addTo(config);
1384 saveAction->addTo(config); 1383 saveAction->addTo(config);
1385 saveAsAction->addTo(config); 1384 saveAsAction->addTo(config);
@@ -1388,12 +1387,12 @@ ConfigMainWindow::ConfigMainWindow(void)
1388 1387
1389 // create edit menu 1388 // create edit menu
1390 QPopupMenu* editMenu = new QPopupMenu(this); 1389 QPopupMenu* editMenu = new QPopupMenu(this);
1391 menu->insertItem("&Edit", editMenu); 1390 menu->insertItem(_("&Edit"), editMenu);
1392 searchAction->addTo(editMenu); 1391 searchAction->addTo(editMenu);
1393 1392
1394 // create options menu 1393 // create options menu
1395 QPopupMenu* optionMenu = new QPopupMenu(this); 1394 QPopupMenu* optionMenu = new QPopupMenu(this);
1396 menu->insertItem("&Option", optionMenu); 1395 menu->insertItem(_("&Option"), optionMenu);
1397 showNameAction->addTo(optionMenu); 1396 showNameAction->addTo(optionMenu);
1398 showRangeAction->addTo(optionMenu); 1397 showRangeAction->addTo(optionMenu);
1399 showDataAction->addTo(optionMenu); 1398 showDataAction->addTo(optionMenu);
@@ -1404,7 +1403,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1404 // create help menu 1403 // create help menu
1405 QPopupMenu* helpMenu = new QPopupMenu(this); 1404 QPopupMenu* helpMenu = new QPopupMenu(this);
1406 menu->insertSeparator(); 1405 menu->insertSeparator();
1407 menu->insertItem("&Help", helpMenu); 1406 menu->insertItem(_("&Help"), helpMenu);
1408 showIntroAction->addTo(helpMenu); 1407 showIntroAction->addTo(helpMenu);
1409 showAboutAction->addTo(helpMenu); 1408 showAboutAction->addTo(helpMenu);
1410 1409
@@ -1452,14 +1451,14 @@ void ConfigMainWindow::loadConfig(void)
1452 if (s.isNull()) 1451 if (s.isNull())
1453 return; 1452 return;
1454 if (conf_read(QFile::encodeName(s))) 1453 if (conf_read(QFile::encodeName(s)))
1455 QMessageBox::information(this, "qconf", "Unable to load configuration!"); 1454 QMessageBox::information(this, "qconf", _("Unable to load configuration!"));
1456 ConfigView::updateListAll(); 1455 ConfigView::updateListAll();
1457} 1456}
1458 1457
1459void ConfigMainWindow::saveConfig(void) 1458void ConfigMainWindow::saveConfig(void)
1460{ 1459{
1461 if (conf_write(NULL)) 1460 if (conf_write(NULL))
1462 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1461 QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
1463} 1462}
1464 1463
1465void ConfigMainWindow::saveConfigAs(void) 1464void ConfigMainWindow::saveConfigAs(void)
@@ -1468,7 +1467,7 @@ void ConfigMainWindow::saveConfigAs(void)
1468 if (s.isNull()) 1467 if (s.isNull())
1469 return; 1468 return;
1470 if (conf_write(QFile::encodeName(s))) 1469 if (conf_write(QFile::encodeName(s)))
1471 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1470 QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
1472} 1471}
1473 1472
1474void ConfigMainWindow::searchConfig(void) 1473void ConfigMainWindow::searchConfig(void)
@@ -1612,11 +1611,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
1612 e->accept(); 1611 e->accept();
1613 return; 1612 return;
1614 } 1613 }
1615 QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning, 1614 QMessageBox mb("qconf", _("Save configuration?"), QMessageBox::Warning,
1616 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); 1615 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape);
1617 mb.setButtonText(QMessageBox::Yes, "&Save Changes"); 1616 mb.setButtonText(QMessageBox::Yes, _("&Save Changes"));
1618 mb.setButtonText(QMessageBox::No, "&Discard Changes"); 1617 mb.setButtonText(QMessageBox::No, _("&Discard Changes"));
1619 mb.setButtonText(QMessageBox::Cancel, "Cancel Exit"); 1618 mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
1620 switch (mb.exec()) { 1619 switch (mb.exec()) {
1621 case QMessageBox::Yes: 1620 case QMessageBox::Yes:
1622 conf_write(NULL); 1621 conf_write(NULL);
@@ -1631,7 +1630,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
1631 1630
1632void ConfigMainWindow::showIntro(void) 1631void ConfigMainWindow::showIntro(void)
1633{ 1632{
1634 static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" 1633 static const QString str = _("Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
1635 "For each option, a blank box indicates the feature is disabled, a check\n" 1634 "For each option, a blank box indicates the feature is disabled, a check\n"
1636 "indicates it is enabled, and a dot indicates that it is to be compiled\n" 1635 "indicates it is enabled, and a dot indicates that it is to be compiled\n"
1637 "as a module. Clicking on the box will cycle through the three states.\n\n" 1636 "as a module. Clicking on the box will cycle through the three states.\n\n"
@@ -1641,15 +1640,15 @@ void ConfigMainWindow::showIntro(void)
1641 "options must be enabled to support the option you are interested in, you can\n" 1640 "options must be enabled to support the option you are interested in, you can\n"
1642 "still view the help of a grayed-out option.\n\n" 1641 "still view the help of a grayed-out option.\n\n"
1643 "Toggling Show Debug Info under the Options menu will show the dependencies,\n" 1642 "Toggling Show Debug Info under the Options menu will show the dependencies,\n"
1644 "which you can then match by examining other options.\n\n"; 1643 "which you can then match by examining other options.\n\n");
1645 1644
1646 QMessageBox::information(this, "qconf", str); 1645 QMessageBox::information(this, "qconf", str);
1647} 1646}
1648 1647
1649void ConfigMainWindow::showAbout(void) 1648void ConfigMainWindow::showAbout(void)
1650{ 1649{
1651 static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n" 1650 static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
1652 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; 1651 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n");
1653 1652
1654 QMessageBox::information(this, "qconf", str); 1653 QMessageBox::information(this, "qconf", str);
1655} 1654}
@@ -1707,7 +1706,7 @@ static const char *progname;
1707 1706
1708static void usage(void) 1707static void usage(void)
1709{ 1708{
1710 printf("%s <config>\n", progname); 1709 printf(_("%s <config>\n"), progname);
1711 exit(0); 1710 exit(0);
1712} 1711}
1713 1712
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index c35dcc5d6189..3929e5b35e79 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -34,6 +34,8 @@ struct symbol *sym_defconfig_list;
34struct symbol *modules_sym; 34struct symbol *modules_sym;
35tristate modules_val; 35tristate modules_val;
36 36
37struct expr *sym_env_list;
38
37void sym_add_default(struct symbol *sym, const char *def) 39void sym_add_default(struct symbol *sym, const char *def)
38{ 40{
39 struct property *prop = prop_alloc(P_DEFAULT, sym); 41 struct property *prop = prop_alloc(P_DEFAULT, sym);
@@ -45,7 +47,6 @@ void sym_init(void)
45{ 47{
46 struct symbol *sym; 48 struct symbol *sym;
47 struct utsname uts; 49 struct utsname uts;
48 char *p;
49 static bool inited = false; 50 static bool inited = false;
50 51
51 if (inited) 52 if (inited)
@@ -54,20 +55,6 @@ void sym_init(void)
54 55
55 uname(&uts); 56 uname(&uts);
56 57
57 sym = sym_lookup("ARCH", 0);
58 sym->type = S_STRING;
59 sym->flags |= SYMBOL_AUTO;
60 p = getenv("ARCH");
61 if (p)
62 sym_add_default(sym, p);
63
64 sym = sym_lookup("KERNELVERSION", 0);
65 sym->type = S_STRING;
66 sym->flags |= SYMBOL_AUTO;
67 p = getenv("KERNELVERSION");
68 if (p)
69 sym_add_default(sym, p);
70
71 sym = sym_lookup("UNAME_RELEASE", 0); 58 sym = sym_lookup("UNAME_RELEASE", 0);
72 sym->type = S_STRING; 59 sym->type = S_STRING;
73 sym->flags |= SYMBOL_AUTO; 60 sym->flags |= SYMBOL_AUTO;
@@ -117,6 +104,15 @@ struct property *sym_get_choice_prop(struct symbol *sym)
117 return NULL; 104 return NULL;
118} 105}
119 106
107struct property *sym_get_env_prop(struct symbol *sym)
108{
109 struct property *prop;
110
111 for_all_properties(sym, prop, P_ENV)
112 return prop;
113 return NULL;
114}
115
120struct property *sym_get_default_prop(struct symbol *sym) 116struct property *sym_get_default_prop(struct symbol *sym)
121{ 117{
122 struct property *prop; 118 struct property *prop;
@@ -199,7 +195,7 @@ static void sym_calc_visibility(struct symbol *sym)
199 tri = no; 195 tri = no;
200 for_all_prompts(sym, prop) { 196 for_all_prompts(sym, prop) {
201 prop->visible.tri = expr_calc_value(prop->visible.expr); 197 prop->visible.tri = expr_calc_value(prop->visible.expr);
202 tri = E_OR(tri, prop->visible.tri); 198 tri = EXPR_OR(tri, prop->visible.tri);
203 } 199 }
204 if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) 200 if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
205 tri = yes; 201 tri = yes;
@@ -247,8 +243,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
247 243
248 /* just get the first visible value */ 244 /* just get the first visible value */
249 prop = sym_get_choice_prop(sym); 245 prop = sym_get_choice_prop(sym);
250 for (e = prop->expr; e; e = e->left.expr) { 246 expr_list_for_each_sym(prop->expr, e, def_sym) {
251 def_sym = e->right.sym;
252 sym_calc_visibility(def_sym); 247 sym_calc_visibility(def_sym);
253 if (def_sym->visible != no) 248 if (def_sym->visible != no)
254 return def_sym; 249 return def_sym;
@@ -303,7 +298,7 @@ void sym_calc_value(struct symbol *sym)
303 if (sym_is_choice_value(sym) && sym->visible == yes) { 298 if (sym_is_choice_value(sym) && sym->visible == yes) {
304 prop = sym_get_choice_prop(sym); 299 prop = sym_get_choice_prop(sym);
305 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; 300 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
306 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { 301 } else if (EXPR_OR(sym->visible, sym->rev_dep.tri) != no) {
307 sym->flags |= SYMBOL_WRITE; 302 sym->flags |= SYMBOL_WRITE;
308 if (sym_has_value(sym)) 303 if (sym_has_value(sym))
309 newval.tri = sym->def[S_DEF_USER].tri; 304 newval.tri = sym->def[S_DEF_USER].tri;
@@ -312,7 +307,7 @@ void sym_calc_value(struct symbol *sym)
312 if (prop) 307 if (prop)
313 newval.tri = expr_calc_value(prop->expr); 308 newval.tri = expr_calc_value(prop->expr);
314 } 309 }
315 newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri); 310 newval.tri = EXPR_OR(EXPR_AND(newval.tri, sym->visible), sym->rev_dep.tri);
316 } else if (!sym_is_choice(sym)) { 311 } else if (!sym_is_choice(sym)) {
317 prop = sym_get_default_prop(sym); 312 prop = sym_get_default_prop(sym);
318 if (prop) { 313 if (prop) {
@@ -347,6 +342,9 @@ void sym_calc_value(struct symbol *sym)
347 ; 342 ;
348 } 343 }
349 344
345 if (sym->flags & SYMBOL_AUTO)
346 sym->flags &= ~SYMBOL_WRITE;
347
350 sym->curr = newval; 348 sym->curr = newval;
351 if (sym_is_choice(sym) && newval.tri == yes) 349 if (sym_is_choice(sym) && newval.tri == yes)
352 sym->curr.val = sym_calc_choice(sym); 350 sym->curr.val = sym_calc_choice(sym);
@@ -361,12 +359,14 @@ void sym_calc_value(struct symbol *sym)
361 } 359 }
362 360
363 if (sym_is_choice(sym)) { 361 if (sym_is_choice(sym)) {
362 struct symbol *choice_sym;
364 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); 363 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
364
365 prop = sym_get_choice_prop(sym); 365 prop = sym_get_choice_prop(sym);
366 for (e = prop->expr; e; e = e->left.expr) { 366 expr_list_for_each_sym(prop->expr, e, choice_sym) {
367 e->right.sym->flags |= flags; 367 choice_sym->flags |= flags;
368 if (flags & SYMBOL_CHANGED) 368 if (flags & SYMBOL_CHANGED)
369 sym_set_changed(e->right.sym); 369 sym_set_changed(choice_sym);
370 } 370 }
371 } 371 }
372} 372}
@@ -849,7 +849,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
849struct symbol *prop_get_symbol(struct property *prop) 849struct symbol *prop_get_symbol(struct property *prop)
850{ 850{
851 if (prop->expr && (prop->expr->type == E_SYMBOL || 851 if (prop->expr && (prop->expr->type == E_SYMBOL ||
852 prop->expr->type == E_CHOICE)) 852 prop->expr->type == E_LIST))
853 return prop->expr->left.sym; 853 return prop->expr->left.sym;
854 return NULL; 854 return NULL;
855} 855}
@@ -859,6 +859,8 @@ const char *prop_get_type_name(enum prop_type type)
859 switch (type) { 859 switch (type) {
860 case P_PROMPT: 860 case P_PROMPT:
861 return "prompt"; 861 return "prompt";
862 case P_ENV:
863 return "env";
862 case P_COMMENT: 864 case P_COMMENT:
863 return "comment"; 865 return "comment";
864 case P_MENU: 866 case P_MENU:
@@ -876,3 +878,32 @@ const char *prop_get_type_name(enum prop_type type)
876 } 878 }
877 return "unknown"; 879 return "unknown";
878} 880}
881
882void prop_add_env(const char *env)
883{
884 struct symbol *sym, *sym2;
885 struct property *prop;
886 char *p;
887
888 sym = current_entry->sym;
889 sym->flags |= SYMBOL_AUTO;
890 for_all_properties(sym, prop, P_ENV) {
891 sym2 = prop_get_symbol(prop);
892 if (strcmp(sym2->name, env))
893 menu_warn(current_entry, "redefining environment symbol from %s",
894 sym2->name);
895 return;
896 }
897
898 prop = prop_alloc(P_ENV, sym);
899 prop->expr = expr_alloc_symbol(sym_lookup(env, 1));
900
901 sym_env_list = expr_alloc_one(E_LIST, sym_env_list);
902 sym_env_list->right.sym = sym;
903
904 p = getenv(env);
905 if (p)
906 sym_add_default(sym, p);
907 else
908 menu_warn(current_entry, "environment variable %s undefined", env);
909}
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index e1cad924c0a4..f8e73c039dc8 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -29,6 +29,8 @@ struct file *file_lookup(const char *name)
29/* write a dependency file as used by kbuild to track dependencies */ 29/* write a dependency file as used by kbuild to track dependencies */
30int file_write_dep(const char *name) 30int file_write_dep(const char *name)
31{ 31{
32 struct symbol *sym, *env_sym;
33 struct expr *e;
32 struct file *file; 34 struct file *file;
33 FILE *out; 35 FILE *out;
34 36
@@ -45,8 +47,25 @@ int file_write_dep(const char *name)
45 fprintf(out, "\t%s\n", file->name); 47 fprintf(out, "\t%s\n", file->name);
46 } 48 }
47 fprintf(out, "\ninclude/config/auto.conf: \\\n" 49 fprintf(out, "\ninclude/config/auto.conf: \\\n"
48 "\t$(deps_config)\n\n" 50 "\t$(deps_config)\n\n");
49 "$(deps_config): ;\n"); 51
52 expr_list_for_each_sym(sym_env_list, e, sym) {
53 struct property *prop;
54 const char *value;
55
56 prop = sym_get_env_prop(sym);
57 env_sym = prop_get_symbol(prop);
58 if (!env_sym)
59 continue;
60 value = getenv(env_sym->name);
61 if (!value)
62 value = "";
63 fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
64 fprintf(out, "include/config/auto.conf: FORCE\n");
65 fprintf(out, "endif\n");
66 }
67
68 fprintf(out, "\n$(deps_config): ;\n");
50 fclose(out); 69 fclose(out);
51 rename("..config.tmp", name); 70 rename("..config.tmp", name);
52 return 0; 71 return 0;
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
index 93538e567bda..25ef5d01c0af 100644
--- a/scripts/kconfig/zconf.gperf
+++ b/scripts/kconfig/zconf.gperf
@@ -35,10 +35,10 @@ int, T_TYPE, TF_COMMAND, S_INT
35hex, T_TYPE, TF_COMMAND, S_HEX 35hex, T_TYPE, TF_COMMAND, S_HEX
36string, T_TYPE, TF_COMMAND, S_STRING 36string, T_TYPE, TF_COMMAND, S_STRING
37select, T_SELECT, TF_COMMAND 37select, T_SELECT, TF_COMMAND
38enable, T_SELECT, TF_COMMAND
39range, T_RANGE, TF_COMMAND 38range, T_RANGE, TF_COMMAND
40option, T_OPTION, TF_COMMAND 39option, T_OPTION, TF_COMMAND
41on, T_ON, TF_PARAM 40on, T_ON, TF_PARAM
42modules, T_OPT_MODULES, TF_OPTION 41modules, T_OPT_MODULES, TF_OPTION
43defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION 42defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
43env, T_OPT_ENV, TF_OPTION
44%% 44%%
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped
index ab28b18153a7..5c73d51339d8 100644
--- a/scripts/kconfig/zconf.hash.c_shipped
+++ b/scripts/kconfig/zconf.hash.c_shipped
@@ -1,4 +1,4 @@
1/* ANSI-C code produced by gperf version 3.0.2 */ 1/* ANSI-C code produced by gperf version 3.0.3 */
2/* Command-line: gperf */ 2/* Command-line: gperf */
3/* Computed positions: -k'1,3' */ 3/* Computed positions: -k'1,3' */
4 4
@@ -53,9 +53,9 @@ kconf_id_hash (register const char *str, register unsigned int len)
53 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 53 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
54 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 54 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
55 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 55 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
56 49, 49, 49, 49, 49, 49, 49, 18, 11, 5, 56 49, 49, 49, 49, 49, 49, 49, 49, 11, 5,
57 0, 0, 5, 49, 5, 20, 49, 49, 5, 20, 57 0, 0, 5, 49, 5, 20, 49, 49, 5, 20,
58 5, 0, 30, 49, 0, 15, 0, 10, 49, 49, 58 5, 0, 30, 49, 0, 15, 0, 10, 0, 49,
59 25, 49, 49, 49, 49, 49, 49, 49, 49, 49, 59 25, 49, 49, 49, 49, 49, 49, 49, 49, 49,
60 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 60 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
61 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 61 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
@@ -89,6 +89,7 @@ kconf_id_hash (register const char *str, register unsigned int len)
89struct kconf_id_strings_t 89struct kconf_id_strings_t
90 { 90 {
91 char kconf_id_strings_str2[sizeof("on")]; 91 char kconf_id_strings_str2[sizeof("on")];
92 char kconf_id_strings_str3[sizeof("env")];
92 char kconf_id_strings_str5[sizeof("endif")]; 93 char kconf_id_strings_str5[sizeof("endif")];
93 char kconf_id_strings_str6[sizeof("option")]; 94 char kconf_id_strings_str6[sizeof("option")];
94 char kconf_id_strings_str7[sizeof("endmenu")]; 95 char kconf_id_strings_str7[sizeof("endmenu")];
@@ -107,7 +108,6 @@ struct kconf_id_strings_t
107 char kconf_id_strings_str21[sizeof("string")]; 108 char kconf_id_strings_str21[sizeof("string")];
108 char kconf_id_strings_str22[sizeof("if")]; 109 char kconf_id_strings_str22[sizeof("if")];
109 char kconf_id_strings_str23[sizeof("int")]; 110 char kconf_id_strings_str23[sizeof("int")];
110 char kconf_id_strings_str24[sizeof("enable")];
111 char kconf_id_strings_str26[sizeof("select")]; 111 char kconf_id_strings_str26[sizeof("select")];
112 char kconf_id_strings_str27[sizeof("modules")]; 112 char kconf_id_strings_str27[sizeof("modules")];
113 char kconf_id_strings_str28[sizeof("tristate")]; 113 char kconf_id_strings_str28[sizeof("tristate")];
@@ -123,6 +123,7 @@ struct kconf_id_strings_t
123static struct kconf_id_strings_t kconf_id_strings_contents = 123static struct kconf_id_strings_t kconf_id_strings_contents =
124 { 124 {
125 "on", 125 "on",
126 "env",
126 "endif", 127 "endif",
127 "option", 128 "option",
128 "endmenu", 129 "endmenu",
@@ -141,7 +142,6 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
141 "string", 142 "string",
142 "if", 143 "if",
143 "int", 144 "int",
144 "enable",
145 "select", 145 "select",
146 "modules", 146 "modules",
147 "tristate", 147 "tristate",
@@ -157,6 +157,9 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
157#define kconf_id_strings ((const char *) &kconf_id_strings_contents) 157#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
158#ifdef __GNUC__ 158#ifdef __GNUC__
159__inline 159__inline
160#ifdef __GNUC_STDC_INLINE__
161__attribute__ ((__gnu_inline__))
162#endif
160#endif 163#endif
161struct kconf_id * 164struct kconf_id *
162kconf_id_lookup (register const char *str, register unsigned int len) 165kconf_id_lookup (register const char *str, register unsigned int len)
@@ -174,7 +177,8 @@ kconf_id_lookup (register const char *str, register unsigned int len)
174 { 177 {
175 {-1}, {-1}, 178 {-1}, {-1},
176 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM}, 179 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM},
177 {-1}, {-1}, 180 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_OPT_ENV, TF_OPTION},
181 {-1},
178 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, 182 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND},
179 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_OPTION, TF_COMMAND}, 183 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_OPTION, TF_COMMAND},
180 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND}, 184 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND},
@@ -194,8 +198,7 @@ kconf_id_lookup (register const char *str, register unsigned int len)
194 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING}, 198 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING},
195 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM}, 199 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM},
196 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT}, 200 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT},
197 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str24, T_SELECT, TF_COMMAND}, 201 {-1}, {-1},
198 {-1},
199 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND}, 202 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND},
200 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, 203 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
201 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE}, 204 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE},
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 187d38ccadd5..4cea5c85cd0a 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -217,6 +217,11 @@ n [A-Za-z0-9_]
217 append_string("\n", 1); 217 append_string("\n", 1);
218 } 218 }
219 [^ \t\n].* { 219 [^ \t\n].* {
220 while (yyleng) {
221 if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t'))
222 break;
223 yyleng--;
224 }
220 append_string(yytext, yyleng); 225 append_string(yytext, yyleng);
221 if (!first_ts) 226 if (!first_ts)
222 first_ts = last_ts; 227 first_ts = last_ts;
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 1d1401807e95..ec54f12f57b0 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -46,21 +46,24 @@ use strict;
46# Note: This only supports 'c'. 46# Note: This only supports 'c'.
47 47
48# usage: 48# usage:
49# kernel-doc [ -docbook | -html | -text | -man ] 49# kernel-doc [ -docbook | -html | -text | -man ] [ -no-doc-sections ]
50# [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile 50# [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile
51# or 51# or
52# [ -nofunction funcname [ -function funcname ...] ] c file(s)s > outputfile 52# [ -nofunction funcname [ -function funcname ...] ] c file(s)s > outputfile
53# 53#
54# Set output format using one of -docbook -html -text or -man. Default is man. 54# Set output format using one of -docbook -html -text or -man. Default is man.
55# 55#
56# -no-doc-sections
57# Do not output DOC: sections
58#
56# -function funcname 59# -function funcname
57# If set, then only generate documentation for the given function(s). All 60# If set, then only generate documentation for the given function(s) or
58# other functions are ignored. 61# DOC: section titles. All other functions and DOC: sections are ignored.
59# 62#
60# -nofunction funcname 63# -nofunction funcname
61# If set, then only generate documentation for the other function(s). 64# If set, then only generate documentation for the other function(s)/DOC:
62# Cannot be used together with -function 65# sections. Cannot be used together with -function (yes, that's a bug --
63# (yes, that's a bug -- perl hackers can fix it 8)) 66# perl hackers can fix it 8))
64# 67#
65# c files - list of 'c' files to process 68# c files - list of 'c' files to process
66# 69#
@@ -182,10 +185,10 @@ my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>"
182my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", 185my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>",
183 $type_constant, "<constant>\$1</constant>", 186 $type_constant, "<constant>\$1</constant>",
184 $type_func, "<function>\$1</function>", 187 $type_func, "<function>\$1</function>",
185 $type_struct, "<structname>\$1</structname>", 188 $type_struct_xml, "<structname>\$1</structname>",
186 $type_env, "<envar>\$1</envar>", 189 $type_env, "<envar>\$1</envar>",
187 $type_param, "<parameter>\$1</parameter>" ); 190 $type_param, "<parameter>\$1</parameter>" );
188my $blankline_xml = "</para><para>\n"; 191my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
189 192
190# gnome, docbook format 193# gnome, docbook format
191my %highlights_gnome = ( $type_constant, "<replaceable class=\"option\">\$1</replaceable>", 194my %highlights_gnome = ( $type_constant, "<replaceable class=\"option\">\$1</replaceable>",
@@ -211,7 +214,7 @@ my $blankline_text = "";
211 214
212 215
213sub usage { 216sub usage {
214 print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man ]\n"; 217 print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man ] [ -no-doc-sections ]\n";
215 print " [ -function funcname [ -function funcname ...] ]\n"; 218 print " [ -function funcname [ -function funcname ...] ]\n";
216 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n"; 219 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n";
217 print " c source file(s) > outputfile\n"; 220 print " c source file(s) > outputfile\n";
@@ -225,6 +228,7 @@ if ($#ARGV==-1) {
225 228
226my $verbose = 0; 229my $verbose = 0;
227my $output_mode = "man"; 230my $output_mode = "man";
231my $no_doc_sections = 0;
228my %highlights = %highlights_man; 232my %highlights = %highlights_man;
229my $blankline = $blankline_man; 233my $blankline = $blankline_man;
230my $modulename = "Kernel API"; 234my $modulename = "Kernel API";
@@ -329,12 +333,14 @@ while ($ARGV[0] =~ m/^-(.*)/) {
329 usage(); 333 usage();
330 } elsif ($cmd eq '-filelist') { 334 } elsif ($cmd eq '-filelist') {
331 $filelist = shift @ARGV; 335 $filelist = shift @ARGV;
336 } elsif ($cmd eq '-no-doc-sections') {
337 $no_doc_sections = 1;
332 } 338 }
333} 339}
334 340
335# get kernel version from env 341# get kernel version from env
336sub get_kernel_version() { 342sub get_kernel_version() {
337 my $version; 343 my $version = 'unknown kernel version';
338 344
339 if (defined($ENV{'KERNELVERSION'})) { 345 if (defined($ENV{'KERNELVERSION'})) {
340 $version = $ENV{'KERNELVERSION'}; 346 $version = $ENV{'KERNELVERSION'};
@@ -374,6 +380,29 @@ sub dump_section {
374} 380}
375 381
376## 382##
383# dump DOC: section after checking that it should go out
384#
385sub dump_doc_section {
386 my $name = shift;
387 my $contents = join "\n", @_;
388
389 if ($no_doc_sections) {
390 return;
391 }
392
393 if (($function_only == 0) ||
394 ( $function_only == 1 && defined($function_table{$name})) ||
395 ( $function_only == 2 && !defined($function_table{$name})))
396 {
397 dump_section $name, $contents;
398 output_blockhead({'sectionlist' => \@sectionlist,
399 'sections' => \%sections,
400 'module' => $modulename,
401 'content-only' => ($function_only != 0), });
402 }
403}
404
405##
377# output function 406# output function
378# 407#
379# parameterdescs, a hash. 408# parameterdescs, a hash.
@@ -394,7 +423,7 @@ sub output_highlight {
394# confess "output_highlight got called with no args?\n"; 423# confess "output_highlight got called with no args?\n";
395# } 424# }
396 425
397 if ($output_mode eq "html") { 426 if ($output_mode eq "html" || $output_mode eq "xml") {
398 $contents = local_unescape($contents); 427 $contents = local_unescape($contents);
399 # convert data read & converted thru xml_escape() into &xyz; format: 428 # convert data read & converted thru xml_escape() into &xyz; format:
400 $contents =~ s/\\\\\\/&/g; 429 $contents =~ s/\\\\\\/&/g;
@@ -564,8 +593,8 @@ sub output_function_html(%) {
564 print "<hr>\n"; 593 print "<hr>\n";
565} 594}
566 595
567# output intro in html 596# output DOC: block header in html
568sub output_intro_html(%) { 597sub output_blockhead_html(%) {
569 my %args = %{$_[0]}; 598 my %args = %{$_[0]};
570 my ($parameter, $section); 599 my ($parameter, $section);
571 my $count; 600 my $count;
@@ -871,7 +900,7 @@ sub output_typedef_xml(%) {
871} 900}
872 901
873# output in XML DocBook 902# output in XML DocBook
874sub output_intro_xml(%) { 903sub output_blockhead_xml(%) {
875 my %args = %{$_[0]}; 904 my %args = %{$_[0]};
876 my ($parameter, $section); 905 my ($parameter, $section);
877 my $count; 906 my $count;
@@ -882,15 +911,23 @@ sub output_intro_xml(%) {
882 # print out each section 911 # print out each section
883 $lineprefix=" "; 912 $lineprefix=" ";
884 foreach $section (@{$args{'sectionlist'}}) { 913 foreach $section (@{$args{'sectionlist'}}) {
885 print "<refsect1>\n <title>$section</title>\n <para>\n"; 914 if (!$args{'content-only'}) {
915 print "<refsect1>\n <title>$section</title>\n";
916 }
886 if ($section =~ m/EXAMPLE/i) { 917 if ($section =~ m/EXAMPLE/i) {
887 print "<example><para>\n"; 918 print "<example><para>\n";
919 } else {
920 print "<para>\n";
888 } 921 }
889 output_highlight($args{'sections'}{$section}); 922 output_highlight($args{'sections'}{$section});
890 if ($section =~ m/EXAMPLE/i) { 923 if ($section =~ m/EXAMPLE/i) {
891 print "</para></example>\n"; 924 print "</para></example>\n";
925 } else {
926 print "</para>";
927 }
928 if (!$args{'content-only'}) {
929 print "\n</refsect1>\n";
892 } 930 }
893 print " </para>\n</refsect1>\n";
894 } 931 }
895 932
896 print "\n\n"; 933 print "\n\n";
@@ -1137,7 +1174,7 @@ sub output_typedef_man(%) {
1137 } 1174 }
1138} 1175}
1139 1176
1140sub output_intro_man(%) { 1177sub output_blockhead_man(%) {
1141 my %args = %{$_[0]}; 1178 my %args = %{$_[0]};
1142 my ($parameter, $section); 1179 my ($parameter, $section);
1143 my $count; 1180 my $count;
@@ -1294,7 +1331,7 @@ sub output_struct_text(%) {
1294 output_section_text(@_); 1331 output_section_text(@_);
1295} 1332}
1296 1333
1297sub output_intro_text(%) { 1334sub output_blockhead_text(%) {
1298 my %args = %{$_[0]}; 1335 my %args = %{$_[0]};
1299 my ($parameter, $section); 1336 my ($parameter, $section);
1300 1337
@@ -1325,9 +1362,9 @@ sub output_declaration {
1325 1362
1326## 1363##
1327# generic output function - calls the right one based on current output mode. 1364# generic output function - calls the right one based on current output mode.
1328sub output_intro { 1365sub output_blockhead {
1329 no strict 'refs'; 1366 no strict 'refs';
1330 my $func = "output_intro_".$output_mode; 1367 my $func = "output_blockhead_".$output_mode;
1331 &$func(@_); 1368 &$func(@_);
1332 $section_counter++; 1369 $section_counter++;
1333} 1370}
@@ -1926,9 +1963,7 @@ sub process_file($) {
1926 } elsif ($state == 4) { 1963 } elsif ($state == 4) {
1927 # Documentation block 1964 # Documentation block
1928 if (/$doc_block/) { 1965 if (/$doc_block/) {
1929 dump_section($section, xml_escape($contents)); 1966 dump_doc_section($section, xml_escape($contents));
1930 output_intro({'sectionlist' => \@sectionlist,
1931 'sections' => \%sections });
1932 $contents = ""; 1967 $contents = "";
1933 $function = ""; 1968 $function = "";
1934 %constants = (); 1969 %constants = ();
@@ -1946,9 +1981,7 @@ sub process_file($) {
1946 } 1981 }
1947 elsif (/$doc_end/) 1982 elsif (/$doc_end/)
1948 { 1983 {
1949 dump_section($section, xml_escape($contents)); 1984 dump_doc_section($section, xml_escape($contents));
1950 output_intro({'sectionlist' => \@sectionlist,
1951 'sections' => \%sections });
1952 $contents = ""; 1985 $contents = "";
1953 $function = ""; 1986 $function = "";
1954 %constants = (); 1987 %constants = ();
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index e0f54b9d8fec..e65d8b33faa4 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -25,8 +25,11 @@ cat << EOF > $2/Makefile
25VERSION = $3 25VERSION = $3
26PATCHLEVEL = $4 26PATCHLEVEL = $4
27 27
28KERNELSRC := $1 28lastword = \$(word \$(words \$(1)),\$(1))
29KERNELOUTPUT := $2 29makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
30
31MAKEARGS := -C $1
32MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
30 33
31MAKEFLAGS += --no-print-directory 34MAKEFLAGS += --no-print-directory
32 35
@@ -35,10 +38,11 @@ MAKEFLAGS += --no-print-directory
35all := \$(filter-out all Makefile,\$(MAKECMDGOALS)) 38all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
36 39
37all: 40all:
38 \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$(all) 41 \$(MAKE) \$(MAKEARGS) \$(all)
39 42
40Makefile:; 43Makefile:;
41 44
42\$(all) %/: all 45\$(all) %/: all
43 @: 46 @:
47
44EOF 48EOF
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 93ac52adb498..f8efc93eb700 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * Copyright 2003 Kai Germaschewski 3 * Copyright 2003 Kai Germaschewski
4 * Copyright 2002-2004 Rusty Russell, IBM Corporation 4 * Copyright 2002-2004 Rusty Russell, IBM Corporation
5 * Copyright 2006 Sam Ravnborg 5 * Copyright 2006-2008 Sam Ravnborg
6 * Based in part on module-init-tools/depmod.c,file2alias 6 * Based in part on module-init-tools/depmod.c,file2alias
7 * 7 *
8 * This software may be used and distributed according to the terms 8 * This software may be used and distributed according to the terms
@@ -28,12 +28,17 @@ static int vmlinux_section_warnings = 1;
28/* Only warn about unresolved symbols */ 28/* Only warn about unresolved symbols */
29static int warn_unresolved = 0; 29static int warn_unresolved = 0;
30/* How a symbol is exported */ 30/* How a symbol is exported */
31static int sec_mismatch_count = 0;
32static int sec_mismatch_verbose = 1;
33
31enum export { 34enum export {
32 export_plain, export_unused, export_gpl, 35 export_plain, export_unused, export_gpl,
33 export_unused_gpl, export_gpl_future, export_unknown 36 export_unused_gpl, export_gpl_future, export_unknown
34}; 37};
35 38
36void fatal(const char *fmt, ...) 39#define PRINTF __attribute__ ((format (printf, 1, 2)))
40
41PRINTF void fatal(const char *fmt, ...)
37{ 42{
38 va_list arglist; 43 va_list arglist;
39 44
@@ -46,7 +51,7 @@ void fatal(const char *fmt, ...)
46 exit(1); 51 exit(1);
47} 52}
48 53
49void warn(const char *fmt, ...) 54PRINTF void warn(const char *fmt, ...)
50{ 55{
51 va_list arglist; 56 va_list arglist;
52 57
@@ -57,7 +62,7 @@ void warn(const char *fmt, ...)
57 va_end(arglist); 62 va_end(arglist);
58} 63}
59 64
60void merror(const char *fmt, ...) 65PRINTF void merror(const char *fmt, ...)
61{ 66{
62 va_list arglist; 67 va_list arglist;
63 68
@@ -72,7 +77,8 @@ static int is_vmlinux(const char *modname)
72{ 77{
73 const char *myname; 78 const char *myname;
74 79
75 if ((myname = strrchr(modname, '/'))) 80 myname = strrchr(modname, '/');
81 if (myname)
76 myname++; 82 myname++;
77 else 83 else
78 myname = modname; 84 myname = modname;
@@ -83,14 +89,13 @@ static int is_vmlinux(const char *modname)
83 89
84void *do_nofail(void *ptr, const char *expr) 90void *do_nofail(void *ptr, const char *expr)
85{ 91{
86 if (!ptr) { 92 if (!ptr)
87 fatal("modpost: Memory allocation failure: %s.\n", expr); 93 fatal("modpost: Memory allocation failure: %s.\n", expr);
88 } 94
89 return ptr; 95 return ptr;
90} 96}
91 97
92/* A list of all modules we processed */ 98/* A list of all modules we processed */
93
94static struct module *modules; 99static struct module *modules;
95 100
96static struct module *find_module(char *modname) 101static struct module *find_module(char *modname)
@@ -113,7 +118,8 @@ static struct module *new_module(char *modname)
113 p = NOFAIL(strdup(modname)); 118 p = NOFAIL(strdup(modname));
114 119
115 /* strip trailing .o */ 120 /* strip trailing .o */
116 if ((s = strrchr(p, '.')) != NULL) 121 s = strrchr(p, '.');
122 if (s != NULL)
117 if (strcmp(s, ".o") == 0) 123 if (strcmp(s, ".o") == 0)
118 *s = '\0'; 124 *s = '\0';
119 125
@@ -154,7 +160,7 @@ static inline unsigned int tdb_hash(const char *name)
154 unsigned i; /* Used to cycle through random values. */ 160 unsigned i; /* Used to cycle through random values. */
155 161
156 /* Set the initial value from the key size. */ 162 /* Set the initial value from the key size. */
157 for (value = 0x238F13AF * strlen(name), i=0; name[i]; i++) 163 for (value = 0x238F13AF * strlen(name), i = 0; name[i]; i++)
158 value = (value + (((unsigned char *)name)[i] << (i*5 % 24))); 164 value = (value + (((unsigned char *)name)[i] << (i*5 % 24)));
159 165
160 return (1103515243 * value + 12345); 166 return (1103515243 * value + 12345);
@@ -198,7 +204,7 @@ static struct symbol *find_symbol(const char *name)
198 if (name[0] == '.') 204 if (name[0] == '.')
199 name++; 205 name++;
200 206
201 for (s = symbolhash[tdb_hash(name) % SYMBOL_HASH_SIZE]; s; s=s->next) { 207 for (s = symbolhash[tdb_hash(name) % SYMBOL_HASH_SIZE]; s; s = s->next) {
202 if (strcmp(s->name, name) == 0) 208 if (strcmp(s->name, name) == 0)
203 return s; 209 return s;
204 } 210 }
@@ -223,9 +229,10 @@ static const char *export_str(enum export ex)
223 return export_list[ex].str; 229 return export_list[ex].str;
224} 230}
225 231
226static enum export export_no(const char * s) 232static enum export export_no(const char *s)
227{ 233{
228 int i; 234 int i;
235
229 if (!s) 236 if (!s)
230 return export_unknown; 237 return export_unknown;
231 for (i = 0; export_list[i].export != export_unknown; i++) { 238 for (i = 0; export_list[i].export != export_unknown; i++) {
@@ -315,7 +322,7 @@ void *grab_file(const char *filename, unsigned long *size)
315 * spaces in the beginning of the line is trimmed away. 322 * spaces in the beginning of the line is trimmed away.
316 * Return a pointer to a static buffer. 323 * Return a pointer to a static buffer.
317 **/ 324 **/
318char* get_next_line(unsigned long *pos, void *file, unsigned long size) 325char *get_next_line(unsigned long *pos, void *file, unsigned long size)
319{ 326{
320 static char line[4096]; 327 static char line[4096];
321 int skip = 1; 328 int skip = 1;
@@ -323,8 +330,7 @@ char* get_next_line(unsigned long *pos, void *file, unsigned long size)
323 signed char *p = (signed char *)file + *pos; 330 signed char *p = (signed char *)file + *pos;
324 char *s = line; 331 char *s = line;
325 332
326 for (; *pos < size ; (*pos)++) 333 for (; *pos < size ; (*pos)++) {
327 {
328 if (skip && isspace(*p)) { 334 if (skip && isspace(*p)) {
329 p++; 335 p++;
330 continue; 336 continue;
@@ -386,7 +392,9 @@ static int parse_elf(struct elf_info *info, const char *filename)
386 392
387 /* Check if file offset is correct */ 393 /* Check if file offset is correct */
388 if (hdr->e_shoff > info->size) { 394 if (hdr->e_shoff > info->size) {
389 fatal("section header offset=%u in file '%s' is bigger then filesize=%lu\n", hdr->e_shoff, filename, info->size); 395 fatal("section header offset=%lu in file '%s' is bigger than "
396 "filesize=%lu\n", (unsigned long)hdr->e_shoff,
397 filename, info->size);
390 return 0; 398 return 0;
391 } 399 }
392 400
@@ -407,7 +415,10 @@ static int parse_elf(struct elf_info *info, const char *filename)
407 const char *secname; 415 const char *secname;
408 416
409 if (sechdrs[i].sh_offset > info->size) { 417 if (sechdrs[i].sh_offset > info->size) {
410 fatal("%s is truncated. sechdrs[i].sh_offset=%u > sizeof(*hrd)=%ul\n", filename, (unsigned int)sechdrs[i].sh_offset, sizeof(*hdr)); 418 fatal("%s is truncated. sechdrs[i].sh_offset=%lu > "
419 "sizeof(*hrd)=%zu\n", filename,
420 (unsigned long)sechdrs[i].sh_offset,
421 sizeof(*hdr));
411 return 0; 422 return 0;
412 } 423 }
413 secname = secstrings + sechdrs[i].sh_name; 424 secname = secstrings + sechdrs[i].sh_name;
@@ -434,9 +445,9 @@ static int parse_elf(struct elf_info *info, const char *filename)
434 info->strtab = (void *)hdr + 445 info->strtab = (void *)hdr +
435 sechdrs[sechdrs[i].sh_link].sh_offset; 446 sechdrs[sechdrs[i].sh_link].sh_offset;
436 } 447 }
437 if (!info->symtab_start) { 448 if (!info->symtab_start)
438 fatal("%s has no symtab?\n", filename); 449 fatal("%s has no symtab?\n", filename);
439 } 450
440 /* Fix endianness in symbols */ 451 /* Fix endianness in symbols */
441 for (sym = info->symtab_start; sym < info->symtab_stop; sym++) { 452 for (sym = info->symtab_start; sym < info->symtab_stop; sym++) {
442 sym->st_shndx = TO_NATIVE(sym->st_shndx); 453 sym->st_shndx = TO_NATIVE(sym->st_shndx);
@@ -505,11 +516,13 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
505#endif 516#endif
506 517
507 if (memcmp(symname, MODULE_SYMBOL_PREFIX, 518 if (memcmp(symname, MODULE_SYMBOL_PREFIX,
508 strlen(MODULE_SYMBOL_PREFIX)) == 0) 519 strlen(MODULE_SYMBOL_PREFIX)) == 0) {
509 mod->unres = alloc_symbol(symname + 520 mod->unres =
510 strlen(MODULE_SYMBOL_PREFIX), 521 alloc_symbol(symname +
511 ELF_ST_BIND(sym->st_info) == STB_WEAK, 522 strlen(MODULE_SYMBOL_PREFIX),
512 mod->unres); 523 ELF_ST_BIND(sym->st_info) == STB_WEAK,
524 mod->unres);
525 }
513 break; 526 break;
514 default: 527 default:
515 /* All exported symbols */ 528 /* All exported symbols */
@@ -578,69 +591,303 @@ static char *get_modinfo(void *modinfo, unsigned long modinfo_len,
578 **/ 591 **/
579static int strrcmp(const char *s, const char *sub) 592static int strrcmp(const char *s, const char *sub)
580{ 593{
581 int slen, sublen; 594 int slen, sublen;
582 595
583 if (!s || !sub) 596 if (!s || !sub)
584 return 1; 597 return 1;
585 598
586 slen = strlen(s); 599 slen = strlen(s);
587 sublen = strlen(sub); 600 sublen = strlen(sub);
588 601
589 if ((slen == 0) || (sublen == 0)) 602 if ((slen == 0) || (sublen == 0))
590 return 1; 603 return 1;
591 604
592 if (sublen > slen) 605 if (sublen > slen)
593 return 1; 606 return 1;
594 607
595 return memcmp(s + slen - sublen, sub, sublen); 608 return memcmp(s + slen - sublen, sub, sublen);
596} 609}
597 610
598/* 611static const char *sym_name(struct elf_info *elf, Elf_Sym *sym)
599 * Functions used only during module init is marked __init and is stored in 612{
600 * a .init.text section. Likewise data is marked __initdata and stored in 613 if (sym)
601 * a .init.data section. 614 return elf->strtab + sym->st_name;
602 * If this section is one of these sections return 1 615 else
603 * See include/linux/init.h for the details 616 return "";
617}
618
619static const char *sec_name(struct elf_info *elf, int shndx)
620{
621 Elf_Shdr *sechdrs = elf->sechdrs;
622 return (void *)elf->hdr +
623 elf->sechdrs[elf->hdr->e_shstrndx].sh_offset +
624 sechdrs[shndx].sh_name;
625}
626
627static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr)
628{
629 return (void *)elf->hdr +
630 elf->sechdrs[elf->hdr->e_shstrndx].sh_offset +
631 sechdr->sh_name;
632}
633
634/* if sym is empty or point to a string
635 * like ".[0-9]+" then return 1.
636 * This is the optional prefix added by ld to some sections
604 */ 637 */
605static int init_section(const char *name) 638static int number_prefix(const char *sym)
606{ 639{
607 if (strcmp(name, ".init") == 0) 640 if (*sym++ == '\0')
608 return 1;
609 if (strncmp(name, ".init.", strlen(".init.")) == 0)
610 return 1; 641 return 1;
642 if (*sym != '.')
643 return 0;
644 do {
645 char c = *sym++;
646 if (c < '0' || c > '9')
647 return 0;
648 } while (*sym);
649 return 1;
650}
651
652/* The pattern is an array of simple patterns.
653 * "foo" will match an exact string equal to "foo"
654 * "*foo" will match a string that ends with "foo"
655 * "foo*" will match a string that begins with "foo"
656 * "foo$" will match a string equal to "foo" or "foo.1"
657 * where the '1' can be any number including several digits.
658 * The $ syntax is for sections where ld append a dot number
659 * to make section name unique.
660 */
661int match(const char *sym, const char * const pat[])
662{
663 const char *p;
664 while (*pat) {
665 p = *pat++;
666 const char *endp = p + strlen(p) - 1;
667
668 /* "*foo" */
669 if (*p == '*') {
670 if (strrcmp(sym, p + 1) == 0)
671 return 1;
672 }
673 /* "foo*" */
674 else if (*endp == '*') {
675 if (strncmp(sym, p, strlen(p) - 1) == 0)
676 return 1;
677 }
678 /* "foo$" */
679 else if (*endp == '$') {
680 if (strncmp(sym, p, strlen(p) - 1) == 0) {
681 if (number_prefix(sym + strlen(p) - 1))
682 return 1;
683 }
684 }
685 /* no wildcards */
686 else {
687 if (strcmp(p, sym) == 0)
688 return 1;
689 }
690 }
691 /* no match */
611 return 0; 692 return 0;
612} 693}
613 694
695/* sections that we do not want to do full section mismatch check on */
696static const char *section_white_list[] =
697 { ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
698
614/* 699/*
615 * Functions used only during module exit is marked __exit and is stored in 700 * Is this section one we do not want to check?
616 * a .exit.text section. Likewise data is marked __exitdata and stored in 701 * This is often debug sections.
617 * a .exit.data section. 702 * If we are going to check this section then
618 * If this section is one of these sections return 1 703 * test if section name ends with a dot and a number.
619 * See include/linux/init.h for the details 704 * This is used to find sections where the linker have
620 **/ 705 * appended a dot-number to make the name unique.
621static int exit_section(const char *name) 706 * The cause of this is often a section specified in assembler
707 * without "ax" / "aw" and the same section used in .c
708 * code where gcc add these.
709 */
710static int check_section(const char *modname, const char *sec)
622{ 711{
623 if (strcmp(name, ".exit.text") == 0) 712 const char *e = sec + strlen(sec) - 1;
624 return 1; 713 if (match(sec, section_white_list))
625 if (strcmp(name, ".exit.data") == 0)
626 return 1; 714 return 1;
627 return 0;
628 715
716 if (*e && isdigit(*e)) {
717 /* consume all digits */
718 while (*e && e != sec && isdigit(*e))
719 e--;
720 if (*e == '.') {
721 warn("%s (%s): unexpected section name.\n"
722 "The (.[number]+) following section name are "
723 "ld generated and not expected.\n"
724 "Did you forget to use \"ax\"/\"aw\" "
725 "in a .S file?\n"
726 "Note that for example <linux/init.h> contains\n"
727 "section definitions for use in .S files.\n\n",
728 modname, sec);
729 }
730 }
731 return 0;
629} 732}
630 733
631/* 734
632 * Data sections are named like this: 735
633 * .data | .data.rel | .data.rel.* 736#define ALL_INIT_DATA_SECTIONS \
634 * Return 1 if the specified section is a data section 737 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
738#define ALL_EXIT_DATA_SECTIONS \
739 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"
740
741#define ALL_INIT_TEXT_SECTIONS \
742 ".init.text$", ".devinit.text$", ".cpuinit.text$", ".meminit.text$"
743#define ALL_EXIT_TEXT_SECTIONS \
744 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
745
746#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS
747#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS
748
749#define DATA_SECTIONS ".data$", ".data.rel$"
750#define TEXT_SECTIONS ".text$"
751
752#define INIT_SECTIONS ".init.data$", ".init.text$"
753#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$"
754#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$"
755#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$"
756
757#define EXIT_SECTIONS ".exit.data$", ".exit.text$"
758#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$"
759#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$"
760#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$"
761
762/* init data sections */
763static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL };
764
765/* all init sections */
766static const char *init_sections[] = { ALL_INIT_SECTIONS, NULL };
767
768/* All init and exit sections (code + data) */
769static const char *init_exit_sections[] =
770 {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL };
771
772/* data section */
773static const char *data_sections[] = { DATA_SECTIONS, NULL };
774
775/* sections that may refer to an init/exit section with no warning */
776static const char *initref_sections[] =
777{
778 ".text.init.refok*",
779 ".exit.text.refok*",
780 ".data.init.refok*",
781 NULL
782};
783
784
785/* symbols in .data that may refer to init/exit sections */
786static const char *symbol_white_list[] =
787{
788 "*driver",
789 "*_template", /* scsi uses *_template a lot */
790 "*_timer", /* arm uses ops structures named _timer a lot */
791 "*_sht", /* scsi also used *_sht to some extent */
792 "*_ops",
793 "*_probe",
794 "*_probe_one",
795 "*_console",
796 NULL
797};
798
799static const char *head_sections[] = { ".head.text*", NULL };
800static const char *linker_symbols[] =
801 { "__init_begin", "_sinittext", "_einittext", NULL };
802
803enum mismatch {
804 NO_MISMATCH,
805 TEXT_TO_INIT,
806 DATA_TO_INIT,
807 TEXT_TO_EXIT,
808 DATA_TO_EXIT,
809 XXXINIT_TO_INIT,
810 XXXEXIT_TO_EXIT,
811 INIT_TO_EXIT,
812 EXIT_TO_INIT,
813 EXPORT_TO_INIT_EXIT,
814};
815
816struct sectioncheck {
817 const char *fromsec[20];
818 const char *tosec[20];
819 enum mismatch mismatch;
820};
821
822const struct sectioncheck sectioncheck[] = {
823/* Do not reference init/exit code/data from
824 * normal code and data
635 */ 825 */
636static int data_section(const char *name)
637{ 826{
638 if ((strcmp(name, ".data") == 0) || 827 .fromsec = { TEXT_SECTIONS, NULL },
639 (strcmp(name, ".data.rel") == 0) || 828 .tosec = { ALL_INIT_SECTIONS, NULL },
640 (strncmp(name, ".data.rel.", strlen(".data.rel.")) == 0)) 829 .mismatch = TEXT_TO_INIT,
641 return 1; 830},
642 else 831{
643 return 0; 832 .fromsec = { DATA_SECTIONS, NULL },
833 .tosec = { ALL_INIT_SECTIONS, NULL },
834 .mismatch = DATA_TO_INIT,
835},
836{
837 .fromsec = { TEXT_SECTIONS, NULL },
838 .tosec = { ALL_EXIT_SECTIONS, NULL },
839 .mismatch = TEXT_TO_EXIT,
840},
841{
842 .fromsec = { DATA_SECTIONS, NULL },
843 .tosec = { ALL_EXIT_SECTIONS, NULL },
844 .mismatch = DATA_TO_EXIT,
845},
846/* Do not reference init code/data from devinit/cpuinit/meminit code/data */
847{
848 .fromsec = { DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, MEM_INIT_SECTIONS, NULL },
849 .tosec = { INIT_SECTIONS, NULL },
850 .mismatch = XXXINIT_TO_INIT,
851},
852/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
853{
854 .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
855 .tosec = { EXIT_SECTIONS, NULL },
856 .mismatch = XXXEXIT_TO_EXIT,
857},
858/* Do not use exit code/data from init code */
859{
860 .fromsec = { ALL_INIT_SECTIONS, NULL },
861 .tosec = { ALL_EXIT_SECTIONS, NULL },
862 .mismatch = INIT_TO_EXIT,
863},
864/* Do not use init code/data from exit code */
865{
866 .fromsec = { ALL_EXIT_SECTIONS, NULL },
867 .tosec = { ALL_INIT_SECTIONS, NULL },
868 .mismatch = EXIT_TO_INIT,
869},
870/* Do not export init/exit functions or data */
871{
872 .fromsec = { "__ksymtab*", NULL },
873 .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL },
874 .mismatch = EXPORT_TO_INIT_EXIT
875}
876};
877
878static int section_mismatch(const char *fromsec, const char *tosec)
879{
880 int i;
881 int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck);
882 const struct sectioncheck *check = &sectioncheck[0];
883
884 for (i = 0; i < elems; i++) {
885 if (match(fromsec, check->fromsec) &&
886 match(tosec, check->tosec))
887 return check->mismatch;
888 check++;
889 }
890 return NO_MISMATCH;
644} 891}
645 892
646/** 893/**
@@ -669,7 +916,8 @@ static int data_section(const char *name)
669 * the pattern is identified by: 916 * the pattern is identified by:
670 * tosec = init or exit section 917 * tosec = init or exit section
671 * fromsec = data section 918 * fromsec = data section
672 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer 919 * atsym = *driver, *_template, *_sht, *_ops, *_probe,
920 * *probe_one, *_console, *_timer
673 * 921 *
674 * Pattern 3: 922 * Pattern 3:
675 * Whitelist all refereces from .text.head to .init.data 923 * Whitelist all refereces from .text.head to .init.data
@@ -684,77 +932,36 @@ static int data_section(const char *name)
684 * This pattern is identified by 932 * This pattern is identified by
685 * refsymname = __init_begin, _sinittext, _einittext 933 * refsymname = __init_begin, _sinittext, _einittext
686 * 934 *
687 * Pattern 5:
688 * Xtensa uses literal sections for constants that are accessed PC-relative.
689 * Literal sections may safely reference their text sections.
690 * (Note that the name for the literal section omits any trailing '.text')
691 * tosec = <section>[.text]
692 * fromsec = <section>.literal
693 **/ 935 **/
694static int secref_whitelist(const char *modname, const char *tosec, 936static int secref_whitelist(const char *fromsec, const char *fromsym,
695 const char *fromsec, const char *atsym, 937 const char *tosec, const char *tosym)
696 const char *refsymname)
697{ 938{
698 int len;
699 const char **s;
700 const char *pat2sym[] = {
701 "driver",
702 "_template", /* scsi uses *_template a lot */
703 "_timer", /* arm uses ops structures named _timer a lot */
704 "_sht", /* scsi also used *_sht to some extent */
705 "_ops",
706 "_probe",
707 "_probe_one",
708 "_console",
709 NULL
710 };
711
712 const char *pat3refsym[] = {
713 "__init_begin",
714 "_sinittext",
715 "_einittext",
716 NULL
717 };
718
719 /* Check for pattern 0 */ 939 /* Check for pattern 0 */
720 if ((strncmp(fromsec, ".text.init.refok", strlen(".text.init.refok")) == 0) || 940 if (match(fromsec, initref_sections))
721 (strncmp(fromsec, ".exit.text.refok", strlen(".exit.text.refok")) == 0) || 941 return 0;
722 (strncmp(fromsec, ".data.init.refok", strlen(".data.init.refok")) == 0))
723 return 1;
724 942
725 /* Check for pattern 1 */ 943 /* Check for pattern 1 */
726 if ((strcmp(tosec, ".init.data") == 0) && 944 if (match(tosec, init_data_sections) &&
727 (strncmp(fromsec, ".data", strlen(".data")) == 0) && 945 match(fromsec, data_sections) &&
728 (strncmp(atsym, "__param", strlen("__param")) == 0)) 946 (strncmp(fromsym, "__param", strlen("__param")) == 0))
729 return 1; 947 return 0;
730 948
731 /* Check for pattern 2 */ 949 /* Check for pattern 2 */
732 if ((init_section(tosec) || exit_section(tosec)) && data_section(fromsec)) 950 if (match(tosec, init_exit_sections) &&
733 for (s = pat2sym; *s; s++) 951 match(fromsec, data_sections) &&
734 if (strrcmp(atsym, *s) == 0) 952 match(fromsym, symbol_white_list))
735 return 1; 953 return 0;
736 954
737 /* Check for pattern 3 */ 955 /* Check for pattern 3 */
738 if ((strcmp(fromsec, ".text.head") == 0) && 956 if (match(fromsec, head_sections) &&
739 ((strcmp(tosec, ".init.data") == 0) || 957 match(tosec, init_sections))
740 (strcmp(tosec, ".init.text") == 0))) 958 return 0;
741 return 1;
742 959
743 /* Check for pattern 4 */ 960 /* Check for pattern 4 */
744 for (s = pat3refsym; *s; s++) 961 if (match(tosym, linker_symbols))
745 if (strcmp(refsymname, *s) == 0) 962 return 0;
746 return 1;
747
748 /* Check for pattern 5 */
749 if (strrcmp(tosec, ".text") == 0)
750 len = strlen(tosec) - strlen(".text");
751 else
752 len = strlen(tosec);
753 if ((strncmp(tosec, fromsec, len) == 0) && (strlen(fromsec) > len) &&
754 (strcmp(fromsec + len, ".literal") == 0))
755 return 1;
756 963
757 return 0; 964 return 1;
758} 965}
759 966
760/** 967/**
@@ -764,10 +971,13 @@ static int secref_whitelist(const char *modname, const char *tosec,
764 * In other cases the symbol needs to be looked up in the symbol table 971 * In other cases the symbol needs to be looked up in the symbol table
765 * based on section and address. 972 * based on section and address.
766 * **/ 973 * **/
767static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr, 974static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr,
768 Elf_Sym *relsym) 975 Elf_Sym *relsym)
769{ 976{
770 Elf_Sym *sym; 977 Elf_Sym *sym;
978 Elf_Sym *near = NULL;
979 Elf64_Sword distance = 20;
980 Elf64_Sword d;
771 981
772 if (relsym->st_name != 0) 982 if (relsym->st_name != 0)
773 return relsym; 983 return relsym;
@@ -778,8 +988,20 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
778 continue; 988 continue;
779 if (sym->st_value == addr) 989 if (sym->st_value == addr)
780 return sym; 990 return sym;
991 /* Find a symbol nearby - addr are maybe negative */
992 d = sym->st_value - addr;
993 if (d < 0)
994 d = addr - sym->st_value;
995 if (d < distance) {
996 distance = d;
997 near = sym;
998 }
781 } 999 }
782 return NULL; 1000 /* We need a close match */
1001 if (distance < 20)
1002 return near;
1003 else
1004 return NULL;
783} 1005}
784 1006
785static inline int is_arm_mapping_symbol(const char *str) 1007static inline int is_arm_mapping_symbol(const char *str)
@@ -812,121 +1034,245 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
812 * The ELF format may have a better way to detect what type of symbol 1034 * The ELF format may have a better way to detect what type of symbol
813 * it is, but this works for now. 1035 * it is, but this works for now.
814 **/ 1036 **/
815static void find_symbols_between(struct elf_info *elf, Elf_Addr addr, 1037static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
816 const char *sec, 1038 const char *sec)
817 Elf_Sym **before, Elf_Sym **after)
818{ 1039{
819 Elf_Sym *sym; 1040 Elf_Sym *sym;
820 Elf_Ehdr *hdr = elf->hdr; 1041 Elf_Sym *near = NULL;
821 Elf_Addr beforediff = ~0; 1042 Elf_Addr distance = ~0;
822 Elf_Addr afterdiff = ~0;
823 const char *secstrings = (void *)hdr +
824 elf->sechdrs[hdr->e_shstrndx].sh_offset;
825
826 *before = NULL;
827 *after = NULL;
828 1043
829 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { 1044 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
830 const char *symsec; 1045 const char *symsec;
831 1046
832 if (sym->st_shndx >= SHN_LORESERVE) 1047 if (sym->st_shndx >= SHN_LORESERVE)
833 continue; 1048 continue;
834 symsec = secstrings + elf->sechdrs[sym->st_shndx].sh_name; 1049 symsec = sec_name(elf, sym->st_shndx);
835 if (strcmp(symsec, sec) != 0) 1050 if (strcmp(symsec, sec) != 0)
836 continue; 1051 continue;
837 if (!is_valid_name(elf, sym)) 1052 if (!is_valid_name(elf, sym))
838 continue; 1053 continue;
839 if (sym->st_value <= addr) { 1054 if (sym->st_value <= addr) {
840 if ((addr - sym->st_value) < beforediff) { 1055 if ((addr - sym->st_value) < distance) {
841 beforediff = addr - sym->st_value; 1056 distance = addr - sym->st_value;
842 *before = sym; 1057 near = sym;
843 } 1058 } else if ((addr - sym->st_value) == distance) {
844 else if ((addr - sym->st_value) == beforediff) { 1059 near = sym;
845 *before = sym;
846 } 1060 }
847 } 1061 }
1062 }
1063 return near;
1064}
1065
1066/*
1067 * Convert a section name to the function/data attribute
1068 * .init.text => __init
1069 * .cpuinit.data => __cpudata
1070 * .memexitconst => __memconst
1071 * etc.
1072*/
1073static char *sec2annotation(const char *s)
1074{
1075 if (match(s, init_exit_sections)) {
1076 char *p = malloc(20);
1077 char *r = p;
1078
1079 *p++ = '_';
1080 *p++ = '_';
1081 if (*s == '.')
1082 s++;
1083 while (*s && *s != '.')
1084 *p++ = *s++;
1085 *p = '\0';
1086 if (*s == '.')
1087 s++;
1088 if (strstr(s, "rodata") != NULL)
1089 strcat(p, "const ");
1090 else if (strstr(s, "data") != NULL)
1091 strcat(p, "data ");
848 else 1092 else
849 { 1093 strcat(p, " ");
850 if ((sym->st_value - addr) < afterdiff) { 1094 return r; /* we leak her but we do not care */
851 afterdiff = sym->st_value - addr; 1095 } else {
852 *after = sym; 1096 return "";
853 }
854 else if ((sym->st_value - addr) == afterdiff) {
855 *after = sym;
856 }
857 }
858 } 1097 }
859} 1098}
860 1099
861/** 1100static int is_function(Elf_Sym *sym)
1101{
1102 if (sym)
1103 return ELF_ST_TYPE(sym->st_info) == STT_FUNC;
1104 else
1105 return 0;
1106}
1107
1108/*
862 * Print a warning about a section mismatch. 1109 * Print a warning about a section mismatch.
863 * Try to find symbols near it so user can find it. 1110 * Try to find symbols near it so user can find it.
864 * Check whitelist before warning - it may be a false positive. 1111 * Check whitelist before warning - it may be a false positive.
865 **/ 1112 */
866static void warn_sec_mismatch(const char *modname, const char *fromsec, 1113static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
867 struct elf_info *elf, Elf_Sym *sym, Elf_Rela r) 1114 const char *fromsec,
1115 unsigned long long fromaddr,
1116 const char *fromsym,
1117 int from_is_func,
1118 const char *tosec, const char *tosym,
1119 int to_is_func)
868{ 1120{
869 const char *refsymname = ""; 1121 const char *from, *from_p;
870 Elf_Sym *before, *after; 1122 const char *to, *to_p;
871 Elf_Sym *refsym; 1123 from = from_is_func ? "function" : "variable";
872 Elf_Ehdr *hdr = elf->hdr; 1124 from_p = from_is_func ? "()" : "";
873 Elf_Shdr *sechdrs = elf->sechdrs; 1125 to = to_is_func ? "function" : "variable";
874 const char *secstrings = (void *)hdr + 1126 to_p = to_is_func ? "()" : "";
875 sechdrs[hdr->e_shstrndx].sh_offset; 1127
876 const char *secname = secstrings + sechdrs[sym->st_shndx].sh_name; 1128 fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in"
877 1129 " reference from the %s %s%s to the %s %s:%s%s\n",
878 find_symbols_between(elf, r.r_offset, fromsec, &before, &after); 1130 modname, fromsec, fromaddr, from, fromsym, from_p,
879 1131 to, tosec, tosym, to_p);
880 refsym = find_elf_symbol(elf, r.r_addend, sym); 1132
881 if (refsym && strlen(elf->strtab + refsym->st_name)) 1133 sec_mismatch_count++;
882 refsymname = elf->strtab + refsym->st_name; 1134 if (!sec_mismatch_verbose)
883
884 /* check whitelist - we may ignore it */
885 if (secref_whitelist(modname, secname, fromsec,
886 before ? elf->strtab + before->st_name : "",
887 refsymname))
888 return; 1135 return;
889 1136
890 if (before && after) { 1137 switch (mismatch) {
891 warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s " 1138 case TEXT_TO_INIT:
892 "(between '%s' and '%s')\n", 1139 fprintf(stderr,
893 modname, fromsec, (unsigned long long)r.r_offset, 1140 "The function %s %s() references\n"
894 secname, refsymname, 1141 "the %s %s%s%s.\n"
895 elf->strtab + before->st_name, 1142 "This is often because %s lacks a %s\n"
896 elf->strtab + after->st_name); 1143 "annotation or the annotation of %s is wrong.\n",
897 } else if (before) { 1144 sec2annotation(fromsec), fromsym,
898 warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s " 1145 to, sec2annotation(tosec), tosym, to_p,
899 "(after '%s')\n", 1146 fromsym, sec2annotation(tosec), tosym);
900 modname, fromsec, (unsigned long long)r.r_offset, 1147 break;
901 secname, refsymname, 1148 case DATA_TO_INIT: {
902 elf->strtab + before->st_name); 1149 const char **s = symbol_white_list;
903 } else if (after) { 1150 fprintf(stderr,
904 warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s " 1151 "The variable %s references\n"
905 "before '%s' (at offset -0x%llx)\n", 1152 "the %s %s%s%s\n"
906 modname, fromsec, (unsigned long long)r.r_offset, 1153 "If the reference is valid then annotate the\n"
907 secname, refsymname, 1154 "variable with __init* (see linux/init.h) "
908 elf->strtab + after->st_name); 1155 "or name the variable:\n",
909 } else { 1156 fromsym, to, sec2annotation(tosec), tosym, to_p);
910 warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n", 1157 while (*s)
911 modname, fromsec, (unsigned long long)r.r_offset, 1158 fprintf(stderr, "%s, ", *s++);
912 secname, refsymname); 1159 fprintf(stderr, "\n");
1160 break;
1161 }
1162 case TEXT_TO_EXIT:
1163 fprintf(stderr,
1164 "The function %s() references a %s in an exit section.\n"
1165 "Often the %s %s%s has valid usage outside the exit section\n"
1166 "and the fix is to remove the %sannotation of %s.\n",
1167 fromsym, to, to, tosym, to_p, sec2annotation(tosec), tosym);
1168 break;
1169 case DATA_TO_EXIT: {
1170 const char **s = symbol_white_list;
1171 fprintf(stderr,
1172 "The variable %s references\n"
1173 "the %s %s%s%s\n"
1174 "If the reference is valid then annotate the\n"
1175 "variable with __exit* (see linux/init.h) or "
1176 "name the variable:\n",
1177 fromsym, to, sec2annotation(tosec), tosym, to_p);
1178 while (*s)
1179 fprintf(stderr, "%s, ", *s++);
1180 fprintf(stderr, "\n");
1181 break;
1182 }
1183 case XXXINIT_TO_INIT:
1184 case XXXEXIT_TO_EXIT:
1185 fprintf(stderr,
1186 "The %s %s%s%s references\n"
1187 "a %s %s%s%s.\n"
1188 "If %s is only used by %s then\n"
1189 "annotate %s with a matching annotation.\n",
1190 from, sec2annotation(fromsec), fromsym, from_p,
1191 to, sec2annotation(tosec), tosym, to_p,
1192 fromsym, tosym, fromsym);
1193 break;
1194 case INIT_TO_EXIT:
1195 fprintf(stderr,
1196 "The %s %s%s%s references\n"
1197 "a %s %s%s%s.\n"
1198 "This is often seen when error handling "
1199 "in the init function\n"
1200 "uses functionality in the exit path.\n"
1201 "The fix is often to remove the %sannotation of\n"
1202 "%s%s so it may be used outside an exit section.\n",
1203 from, sec2annotation(fromsec), fromsym, from_p,
1204 to, sec2annotation(tosec), tosym, to_p,
1205 sec2annotation(tosec), tosym, to_p);
1206 break;
1207 case EXIT_TO_INIT:
1208 fprintf(stderr,
1209 "The %s %s%s%s references\n"
1210 "a %s %s%s%s.\n"
1211 "This is often seen when error handling "
1212 "in the exit function\n"
1213 "uses functionality in the init path.\n"
1214 "The fix is often to remove the %sannotation of\n"
1215 "%s%s so it may be used outside an init section.\n",
1216 from, sec2annotation(fromsec), fromsym, from_p,
1217 to, sec2annotation(tosec), tosym, to_p,
1218 sec2annotation(tosec), tosym, to_p);
1219 break;
1220 case EXPORT_TO_INIT_EXIT:
1221 fprintf(stderr,
1222 "The symbol %s is exported and annotated %s\n"
1223 "Fix this by removing the %sannotation of %s "
1224 "or drop the export.\n",
1225 tosym, sec2annotation(tosec), sec2annotation(tosec), tosym);
1226 case NO_MISMATCH:
1227 /* To get warnings on missing members */
1228 break;
1229 }
1230 fprintf(stderr, "\n");
1231}
1232
1233static void check_section_mismatch(const char *modname, struct elf_info *elf,
1234 Elf_Rela *r, Elf_Sym *sym, const char *fromsec)
1235{
1236 const char *tosec;
1237 enum mismatch mismatch;
1238
1239 tosec = sec_name(elf, sym->st_shndx);
1240 mismatch = section_mismatch(fromsec, tosec);
1241 if (mismatch != NO_MISMATCH) {
1242 Elf_Sym *to;
1243 Elf_Sym *from;
1244 const char *tosym;
1245 const char *fromsym;
1246
1247 from = find_elf_symbol2(elf, r->r_offset, fromsec);
1248 fromsym = sym_name(elf, from);
1249 to = find_elf_symbol(elf, r->r_addend, sym);
1250 tosym = sym_name(elf, to);
1251
1252 /* check whitelist - we may ignore it */
1253 if (secref_whitelist(fromsec, fromsym, tosec, tosym)) {
1254 report_sec_mismatch(modname, mismatch,
1255 fromsec, r->r_offset, fromsym,
1256 is_function(from), tosec, tosym,
1257 is_function(to));
1258 }
913 } 1259 }
914} 1260}
915 1261
916static unsigned int *reloc_location(struct elf_info *elf, 1262static unsigned int *reloc_location(struct elf_info *elf,
917 int rsection, Elf_Rela *r) 1263 Elf_Shdr *sechdr, Elf_Rela *r)
918{ 1264{
919 Elf_Shdr *sechdrs = elf->sechdrs; 1265 Elf_Shdr *sechdrs = elf->sechdrs;
920 int section = sechdrs[rsection].sh_info; 1266 int section = sechdr->sh_info;
921 1267
922 return (void *)elf->hdr + sechdrs[section].sh_offset + 1268 return (void *)elf->hdr + sechdrs[section].sh_offset +
923 (r->r_offset - sechdrs[section].sh_addr); 1269 (r->r_offset - sechdrs[section].sh_addr);
924} 1270}
925 1271
926static int addend_386_rel(struct elf_info *elf, int rsection, Elf_Rela *r) 1272static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
927{ 1273{
928 unsigned int r_typ = ELF_R_TYPE(r->r_info); 1274 unsigned int r_typ = ELF_R_TYPE(r->r_info);
929 unsigned int *location = reloc_location(elf, rsection, r); 1275 unsigned int *location = reloc_location(elf, sechdr, r);
930 1276
931 switch (r_typ) { 1277 switch (r_typ) {
932 case R_386_32: 1278 case R_386_32:
@@ -942,19 +1288,21 @@ static int addend_386_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
942 return 0; 1288 return 0;
943} 1289}
944 1290
945static int addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r) 1291static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
946{ 1292{
947 unsigned int r_typ = ELF_R_TYPE(r->r_info); 1293 unsigned int r_typ = ELF_R_TYPE(r->r_info);
948 1294
949 switch (r_typ) { 1295 switch (r_typ) {
950 case R_ARM_ABS32: 1296 case R_ARM_ABS32:
951 /* From ARM ABI: (S + A) | T */ 1297 /* From ARM ABI: (S + A) | T */
952 r->r_addend = (int)(long)(elf->symtab_start + ELF_R_SYM(r->r_info)); 1298 r->r_addend = (int)(long)
1299 (elf->symtab_start + ELF_R_SYM(r->r_info));
953 break; 1300 break;
954 case R_ARM_PC24: 1301 case R_ARM_PC24:
955 /* From ARM ABI: ((S + A) | T) - P */ 1302 /* From ARM ABI: ((S + A) | T) - P */
956 r->r_addend = (int)(long)(elf->hdr + elf->sechdrs[rsection].sh_offset + 1303 r->r_addend = (int)(long)(elf->hdr +
957 (r->r_offset - elf->sechdrs[rsection].sh_addr)); 1304 sechdr->sh_offset +
1305 (r->r_offset - sechdr->sh_addr));
958 break; 1306 break;
959 default: 1307 default:
960 return 1; 1308 return 1;
@@ -962,10 +1310,10 @@ static int addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
962 return 0; 1310 return 0;
963} 1311}
964 1312
965static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r) 1313static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
966{ 1314{
967 unsigned int r_typ = ELF_R_TYPE(r->r_info); 1315 unsigned int r_typ = ELF_R_TYPE(r->r_info);
968 unsigned int *location = reloc_location(elf, rsection, r); 1316 unsigned int *location = reloc_location(elf, sechdr, r);
969 unsigned int inst; 1317 unsigned int inst;
970 1318
971 if (r_typ == R_MIPS_HI16) 1319 if (r_typ == R_MIPS_HI16)
@@ -985,6 +1333,108 @@ static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
985 return 0; 1333 return 0;
986} 1334}
987 1335
1336static void section_rela(const char *modname, struct elf_info *elf,
1337 Elf_Shdr *sechdr)
1338{
1339 Elf_Sym *sym;
1340 Elf_Rela *rela;
1341 Elf_Rela r;
1342 unsigned int r_sym;
1343 const char *fromsec;
1344
1345 Elf_Rela *start = (void *)elf->hdr + sechdr->sh_offset;
1346 Elf_Rela *stop = (void *)start + sechdr->sh_size;
1347
1348 fromsec = sech_name(elf, sechdr);
1349 fromsec += strlen(".rela");
1350 /* if from section (name) is know good then skip it */
1351 if (check_section(modname, fromsec))
1352 return;
1353
1354 for (rela = start; rela < stop; rela++) {
1355 r.r_offset = TO_NATIVE(rela->r_offset);
1356#if KERNEL_ELFCLASS == ELFCLASS64
1357 if (elf->hdr->e_machine == EM_MIPS) {
1358 unsigned int r_typ;
1359 r_sym = ELF64_MIPS_R_SYM(rela->r_info);
1360 r_sym = TO_NATIVE(r_sym);
1361 r_typ = ELF64_MIPS_R_TYPE(rela->r_info);
1362 r.r_info = ELF64_R_INFO(r_sym, r_typ);
1363 } else {
1364 r.r_info = TO_NATIVE(rela->r_info);
1365 r_sym = ELF_R_SYM(r.r_info);
1366 }
1367#else
1368 r.r_info = TO_NATIVE(rela->r_info);
1369 r_sym = ELF_R_SYM(r.r_info);
1370#endif
1371 r.r_addend = TO_NATIVE(rela->r_addend);
1372 sym = elf->symtab_start + r_sym;
1373 /* Skip special sections */
1374 if (sym->st_shndx >= SHN_LORESERVE)
1375 continue;
1376 check_section_mismatch(modname, elf, &r, sym, fromsec);
1377 }
1378}
1379
1380static void section_rel(const char *modname, struct elf_info *elf,
1381 Elf_Shdr *sechdr)
1382{
1383 Elf_Sym *sym;
1384 Elf_Rel *rel;
1385 Elf_Rela r;
1386 unsigned int r_sym;
1387 const char *fromsec;
1388
1389 Elf_Rel *start = (void *)elf->hdr + sechdr->sh_offset;
1390 Elf_Rel *stop = (void *)start + sechdr->sh_size;
1391
1392 fromsec = sech_name(elf, sechdr);
1393 fromsec += strlen(".rel");
1394 /* if from section (name) is know good then skip it */
1395 if (check_section(modname, fromsec))
1396 return;
1397
1398 for (rel = start; rel < stop; rel++) {
1399 r.r_offset = TO_NATIVE(rel->r_offset);
1400#if KERNEL_ELFCLASS == ELFCLASS64
1401 if (elf->hdr->e_machine == EM_MIPS) {
1402 unsigned int r_typ;
1403 r_sym = ELF64_MIPS_R_SYM(rel->r_info);
1404 r_sym = TO_NATIVE(r_sym);
1405 r_typ = ELF64_MIPS_R_TYPE(rel->r_info);
1406 r.r_info = ELF64_R_INFO(r_sym, r_typ);
1407 } else {
1408 r.r_info = TO_NATIVE(rel->r_info);
1409 r_sym = ELF_R_SYM(r.r_info);
1410 }
1411#else
1412 r.r_info = TO_NATIVE(rel->r_info);
1413 r_sym = ELF_R_SYM(r.r_info);
1414#endif
1415 r.r_addend = 0;
1416 switch (elf->hdr->e_machine) {
1417 case EM_386:
1418 if (addend_386_rel(elf, sechdr, &r))
1419 continue;
1420 break;
1421 case EM_ARM:
1422 if (addend_arm_rel(elf, sechdr, &r))
1423 continue;
1424 break;
1425 case EM_MIPS:
1426 if (addend_mips_rel(elf, sechdr, &r))
1427 continue;
1428 break;
1429 }
1430 sym = elf->symtab_start + r_sym;
1431 /* Skip special sections */
1432 if (sym->st_shndx >= SHN_LORESERVE)
1433 continue;
1434 check_section_mismatch(modname, elf, &r, sym, fromsec);
1435 }
1436}
1437
988/** 1438/**
989 * A module includes a number of sections that are discarded 1439 * A module includes a number of sections that are discarded
990 * either when loaded or when used as built-in. 1440 * either when loaded or when used as built-in.
@@ -998,257 +1448,21 @@ static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
998 * be discarded and warns about it. 1448 * be discarded and warns about it.
999 **/ 1449 **/
1000static void check_sec_ref(struct module *mod, const char *modname, 1450static void check_sec_ref(struct module *mod, const char *modname,
1001 struct elf_info *elf, 1451 struct elf_info *elf)
1002 int section(const char*),
1003 int section_ref_ok(const char *))
1004{ 1452{
1005 int i; 1453 int i;
1006 Elf_Sym *sym;
1007 Elf_Ehdr *hdr = elf->hdr;
1008 Elf_Shdr *sechdrs = elf->sechdrs; 1454 Elf_Shdr *sechdrs = elf->sechdrs;
1009 const char *secstrings = (void *)hdr +
1010 sechdrs[hdr->e_shstrndx].sh_offset;
1011 1455
1012 /* Walk through all sections */ 1456 /* Walk through all sections */
1013 for (i = 0; i < hdr->e_shnum; i++) { 1457 for (i = 0; i < elf->hdr->e_shnum; i++) {
1014 const char *name = secstrings + sechdrs[i].sh_name;
1015 const char *secname;
1016 Elf_Rela r;
1017 unsigned int r_sym;
1018 /* We want to process only relocation sections and not .init */ 1458 /* We want to process only relocation sections and not .init */
1019 if (sechdrs[i].sh_type == SHT_RELA) { 1459 if (sechdrs[i].sh_type == SHT_RELA)
1020 Elf_Rela *rela; 1460 section_rela(modname, elf, &elf->sechdrs[i]);
1021 Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset; 1461 else if (sechdrs[i].sh_type == SHT_REL)
1022 Elf_Rela *stop = (void*)start + sechdrs[i].sh_size; 1462 section_rel(modname, elf, &elf->sechdrs[i]);
1023 name += strlen(".rela");
1024 if (section_ref_ok(name))
1025 continue;
1026
1027 for (rela = start; rela < stop; rela++) {
1028 r.r_offset = TO_NATIVE(rela->r_offset);
1029#if KERNEL_ELFCLASS == ELFCLASS64
1030 if (hdr->e_machine == EM_MIPS) {
1031 unsigned int r_typ;
1032 r_sym = ELF64_MIPS_R_SYM(rela->r_info);
1033 r_sym = TO_NATIVE(r_sym);
1034 r_typ = ELF64_MIPS_R_TYPE(rela->r_info);
1035 r.r_info = ELF64_R_INFO(r_sym, r_typ);
1036 } else {
1037 r.r_info = TO_NATIVE(rela->r_info);
1038 r_sym = ELF_R_SYM(r.r_info);
1039 }
1040#else
1041 r.r_info = TO_NATIVE(rela->r_info);
1042 r_sym = ELF_R_SYM(r.r_info);
1043#endif
1044 r.r_addend = TO_NATIVE(rela->r_addend);
1045 sym = elf->symtab_start + r_sym;
1046 /* Skip special sections */
1047 if (sym->st_shndx >= SHN_LORESERVE)
1048 continue;
1049
1050 secname = secstrings +
1051 sechdrs[sym->st_shndx].sh_name;
1052 if (section(secname))
1053 warn_sec_mismatch(modname, name,
1054 elf, sym, r);
1055 }
1056 } else if (sechdrs[i].sh_type == SHT_REL) {
1057 Elf_Rel *rel;
1058 Elf_Rel *start = (void *)hdr + sechdrs[i].sh_offset;
1059 Elf_Rel *stop = (void*)start + sechdrs[i].sh_size;
1060 name += strlen(".rel");
1061 if (section_ref_ok(name))
1062 continue;
1063
1064 for (rel = start; rel < stop; rel++) {
1065 r.r_offset = TO_NATIVE(rel->r_offset);
1066#if KERNEL_ELFCLASS == ELFCLASS64
1067 if (hdr->e_machine == EM_MIPS) {
1068 unsigned int r_typ;
1069 r_sym = ELF64_MIPS_R_SYM(rel->r_info);
1070 r_sym = TO_NATIVE(r_sym);
1071 r_typ = ELF64_MIPS_R_TYPE(rel->r_info);
1072 r.r_info = ELF64_R_INFO(r_sym, r_typ);
1073 } else {
1074 r.r_info = TO_NATIVE(rel->r_info);
1075 r_sym = ELF_R_SYM(r.r_info);
1076 }
1077#else
1078 r.r_info = TO_NATIVE(rel->r_info);
1079 r_sym = ELF_R_SYM(r.r_info);
1080#endif
1081 r.r_addend = 0;
1082 switch (hdr->e_machine) {
1083 case EM_386:
1084 if (addend_386_rel(elf, i, &r))
1085 continue;
1086 break;
1087 case EM_ARM:
1088 if(addend_arm_rel(elf, i, &r))
1089 continue;
1090 break;
1091 case EM_MIPS:
1092 if (addend_mips_rel(elf, i, &r))
1093 continue;
1094 break;
1095 }
1096 sym = elf->symtab_start + r_sym;
1097 /* Skip special sections */
1098 if (sym->st_shndx >= SHN_LORESERVE)
1099 continue;
1100
1101 secname = secstrings +
1102 sechdrs[sym->st_shndx].sh_name;
1103 if (section(secname))
1104 warn_sec_mismatch(modname, name,
1105 elf, sym, r);
1106 }
1107 }
1108 } 1463 }
1109} 1464}
1110 1465
1111/*
1112 * Identify sections from which references to either a
1113 * .init or a .exit section is OK.
1114 *
1115 * [OPD] Keith Ownes <kaos@sgi.com> commented:
1116 * For our future {in}sanity, add a comment that this is the ppc .opd
1117 * section, not the ia64 .opd section.
1118 * ia64 .opd should not point to discarded sections.
1119 * [.rodata] like for .init.text we ignore .rodata references -same reason
1120 */
1121static int initexit_section_ref_ok(const char *name)
1122{
1123 const char **s;
1124 /* Absolute section names */
1125 const char *namelist1[] = {
1126 "__bug_table", /* used by powerpc for BUG() */
1127 "__ex_table",
1128 ".altinstructions",
1129 ".cranges", /* used by sh64 */
1130 ".fixup",
1131 ".machvec", /* ia64 + powerpc uses these */
1132 ".machine.desc",
1133 ".opd", /* See comment [OPD] */
1134 "__dbe_table",
1135 ".parainstructions",
1136 ".pdr",
1137 ".plt", /* seen on ARCH=um build on x86_64. Harmless */
1138 ".smp_locks",
1139 ".stab",
1140 ".m68k_fixup",
1141 ".xt.prop", /* xtensa informational section */
1142 ".xt.lit", /* xtensa informational section */
1143 NULL
1144 };
1145 /* Start of section names */
1146 const char *namelist2[] = {
1147 ".debug",
1148 ".eh_frame",
1149 ".note", /* ignore ELF notes - may contain anything */
1150 ".got", /* powerpc - global offset table */
1151 ".toc", /* powerpc - table of contents */
1152 NULL
1153 };
1154 /* part of section name */
1155 const char *namelist3 [] = {
1156 ".unwind", /* Sample: IA_64.unwind.exit.text */
1157 NULL
1158 };
1159
1160 for (s = namelist1; *s; s++)
1161 if (strcmp(*s, name) == 0)
1162 return 1;
1163 for (s = namelist2; *s; s++)
1164 if (strncmp(*s, name, strlen(*s)) == 0)
1165 return 1;
1166 for (s = namelist3; *s; s++)
1167 if (strstr(name, *s) != NULL)
1168 return 1;
1169 return 0;
1170}
1171
1172
1173/*
1174 * Identify sections from which references to a .init section is OK.
1175 *
1176 * Unfortunately references to read only data that referenced .init
1177 * sections had to be excluded. Almost all of these are false
1178 * positives, they are created by gcc. The downside of excluding rodata
1179 * is that there really are some user references from rodata to
1180 * init code, e.g. drivers/video/vgacon.c:
1181 *
1182 * const struct consw vga_con = {
1183 * con_startup: vgacon_startup,
1184 *
1185 * where vgacon_startup is __init. If you want to wade through the false
1186 * positives, take out the check for rodata.
1187 */
1188static int init_section_ref_ok(const char *name)
1189{
1190 const char **s;
1191 /* Absolute section names */
1192 const char *namelist1[] = {
1193 "__dbe_table", /* MIPS generate these */
1194 "__ftr_fixup", /* powerpc cpu feature fixup */
1195 "__fw_ftr_fixup", /* powerpc firmware feature fixup */
1196 "__param",
1197 ".data.rel.ro", /* used by parisc64 */
1198 ".init",
1199 ".text.lock",
1200 NULL
1201 };
1202 /* Start of section names */
1203 const char *namelist2[] = {
1204 ".init.",
1205 ".pci_fixup",
1206 ".rodata",
1207 NULL
1208 };
1209
1210 if (initexit_section_ref_ok(name))
1211 return 1;
1212
1213 for (s = namelist1; *s; s++)
1214 if (strcmp(*s, name) == 0)
1215 return 1;
1216 for (s = namelist2; *s; s++)
1217 if (strncmp(*s, name, strlen(*s)) == 0)
1218 return 1;
1219
1220 /* If section name ends with ".init" we allow references
1221 * as is the case with .initcallN.init, .early_param.init, .taglist.init etc
1222 */
1223 if (strrcmp(name, ".init") == 0)
1224 return 1;
1225 return 0;
1226}
1227
1228/*
1229 * Identify sections from which references to a .exit section is OK.
1230 */
1231static int exit_section_ref_ok(const char *name)
1232{
1233 const char **s;
1234 /* Absolute section names */
1235 const char *namelist1[] = {
1236 ".exit.data",
1237 ".exit.text",
1238 ".exitcall.exit",
1239 ".rodata",
1240 NULL
1241 };
1242
1243 if (initexit_section_ref_ok(name))
1244 return 1;
1245
1246 for (s = namelist1; *s; s++)
1247 if (strcmp(*s, name) == 0)
1248 return 1;
1249 return 0;
1250}
1251
1252static void read_symbols(char *modname) 1466static void read_symbols(char *modname)
1253{ 1467{
1254 const char *symname; 1468 const char *symname;
@@ -1288,10 +1502,9 @@ static void read_symbols(char *modname)
1288 handle_modversions(mod, &info, sym, symname); 1502 handle_modversions(mod, &info, sym, symname);
1289 handle_moddevtable(mod, &info, sym, symname); 1503 handle_moddevtable(mod, &info, sym, symname);
1290 } 1504 }
1291 if (is_vmlinux(modname) && vmlinux_section_warnings) { 1505 if (!is_vmlinux(modname) ||
1292 check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok); 1506 (is_vmlinux(modname) && vmlinux_section_warnings))
1293 check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok); 1507 check_sec_ref(mod, modname, &info);
1294 }
1295 1508
1296 version = get_modinfo(info.modinfo, info.modinfo_len, "version"); 1509 version = get_modinfo(info.modinfo, info.modinfo_len, "version");
1297 if (version) 1510 if (version)
@@ -1365,7 +1578,7 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s)
1365 } 1578 }
1366} 1579}
1367 1580
1368static void check_for_unused(enum export exp, const char* m, const char* s) 1581static void check_for_unused(enum export exp, const char *m, const char *s)
1369{ 1582{
1370 const char *e = is_vmlinux(m) ?"":".ko"; 1583 const char *e = is_vmlinux(m) ?"":".ko";
1371 1584
@@ -1398,7 +1611,7 @@ static void check_exports(struct module *mod)
1398 if (!mod->gpl_compatible) 1611 if (!mod->gpl_compatible)
1399 check_for_gpl_usage(exp->export, basename, exp->name); 1612 check_for_gpl_usage(exp->export, basename, exp->name);
1400 check_for_unused(exp->export, basename, exp->name); 1613 check_for_unused(exp->export, basename, exp->name);
1401 } 1614 }
1402} 1615}
1403 1616
1404/** 1617/**
@@ -1458,13 +1671,12 @@ static int add_versions(struct buffer *b, struct module *mod)
1458 1671
1459 buf_printf(b, "\n"); 1672 buf_printf(b, "\n");
1460 buf_printf(b, "static const struct modversion_info ____versions[]\n"); 1673 buf_printf(b, "static const struct modversion_info ____versions[]\n");
1461 buf_printf(b, "__attribute_used__\n"); 1674 buf_printf(b, "__used\n");
1462 buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n"); 1675 buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n");
1463 1676
1464 for (s = mod->unres; s; s = s->next) { 1677 for (s = mod->unres; s; s = s->next) {
1465 if (!s->module) { 1678 if (!s->module)
1466 continue; 1679 continue;
1467 }
1468 if (!s->crc_valid) { 1680 if (!s->crc_valid) {
1469 warn("\"%s\" [%s.ko] has no CRC!\n", 1681 warn("\"%s\" [%s.ko] has no CRC!\n",
1470 s->name, mod->name); 1682 s->name, mod->name);
@@ -1485,13 +1697,12 @@ static void add_depends(struct buffer *b, struct module *mod,
1485 struct module *m; 1697 struct module *m;
1486 int first = 1; 1698 int first = 1;
1487 1699
1488 for (m = modules; m; m = m->next) { 1700 for (m = modules; m; m = m->next)
1489 m->seen = is_vmlinux(m->name); 1701 m->seen = is_vmlinux(m->name);
1490 }
1491 1702
1492 buf_printf(b, "\n"); 1703 buf_printf(b, "\n");
1493 buf_printf(b, "static const char __module_depends[]\n"); 1704 buf_printf(b, "static const char __module_depends[]\n");
1494 buf_printf(b, "__attribute_used__\n"); 1705 buf_printf(b, "__used\n");
1495 buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n"); 1706 buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
1496 buf_printf(b, "\"depends="); 1707 buf_printf(b, "\"depends=");
1497 for (s = mod->unres; s; s = s->next) { 1708 for (s = mod->unres; s; s = s->next) {
@@ -1503,7 +1714,8 @@ static void add_depends(struct buffer *b, struct module *mod,
1503 continue; 1714 continue;
1504 1715
1505 s->module->seen = 1; 1716 s->module->seen = 1;
1506 if ((p = strrchr(s->module->name, '/')) != NULL) 1717 p = strrchr(s->module->name, '/');
1718 if (p)
1507 p++; 1719 p++;
1508 else 1720 else
1509 p = s->module->name; 1721 p = s->module->name;
@@ -1575,7 +1787,7 @@ static void read_dump(const char *fname, unsigned int kernel)
1575 void *file = grab_file(fname, &size); 1787 void *file = grab_file(fname, &size);
1576 char *line; 1788 char *line;
1577 1789
1578 if (!file) 1790 if (!file)
1579 /* No symbol versions, silently ignore */ 1791 /* No symbol versions, silently ignore */
1580 return; 1792 return;
1581 1793
@@ -1598,11 +1810,10 @@ static void read_dump(const char *fname, unsigned int kernel)
1598 crc = strtoul(line, &d, 16); 1810 crc = strtoul(line, &d, 16);
1599 if (*symname == '\0' || *modname == '\0' || *d != '\0') 1811 if (*symname == '\0' || *modname == '\0' || *d != '\0')
1600 goto fail; 1812 goto fail;
1601 1813 mod = find_module(modname);
1602 if (!(mod = find_module(modname))) { 1814 if (!mod) {
1603 if (is_vmlinux(modname)) { 1815 if (is_vmlinux(modname))
1604 have_vmlinux = 1; 1816 have_vmlinux = 1;
1605 }
1606 mod = new_module(NOFAIL(strdup(modname))); 1817 mod = new_module(NOFAIL(strdup(modname)));
1607 mod->skip = 1; 1818 mod->skip = 1;
1608 } 1819 }
@@ -1653,38 +1864,40 @@ int main(int argc, char **argv)
1653{ 1864{
1654 struct module *mod; 1865 struct module *mod;
1655 struct buffer buf = { }; 1866 struct buffer buf = { };
1656 char fname[SZ];
1657 char *kernel_read = NULL, *module_read = NULL; 1867 char *kernel_read = NULL, *module_read = NULL;
1658 char *dump_write = NULL; 1868 char *dump_write = NULL;
1659 int opt; 1869 int opt;
1660 int err; 1870 int err;
1661 1871
1662 while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) { 1872 while ((opt = getopt(argc, argv, "i:I:msSo:aw")) != -1) {
1663 switch(opt) { 1873 switch (opt) {
1664 case 'i': 1874 case 'i':
1665 kernel_read = optarg; 1875 kernel_read = optarg;
1666 break; 1876 break;
1667 case 'I': 1877 case 'I':
1668 module_read = optarg; 1878 module_read = optarg;
1669 external_module = 1; 1879 external_module = 1;
1670 break; 1880 break;
1671 case 'm': 1881 case 'm':
1672 modversions = 1; 1882 modversions = 1;
1673 break; 1883 break;
1674 case 'o': 1884 case 'o':
1675 dump_write = optarg; 1885 dump_write = optarg;
1676 break; 1886 break;
1677 case 'a': 1887 case 'a':
1678 all_versions = 1; 1888 all_versions = 1;
1679 break; 1889 break;
1680 case 's': 1890 case 's':
1681 vmlinux_section_warnings = 0; 1891 vmlinux_section_warnings = 0;
1682 break; 1892 break;
1683 case 'w': 1893 case 'S':
1684 warn_unresolved = 1; 1894 sec_mismatch_verbose = 0;
1685 break; 1895 break;
1686 default: 1896 case 'w':
1687 exit(1); 1897 warn_unresolved = 1;
1898 break;
1899 default:
1900 exit(1);
1688 } 1901 }
1689 } 1902 }
1690 1903
@@ -1693,9 +1906,8 @@ int main(int argc, char **argv)
1693 if (module_read) 1906 if (module_read)
1694 read_dump(module_read, 0); 1907 read_dump(module_read, 0);
1695 1908
1696 while (optind < argc) { 1909 while (optind < argc)
1697 read_symbols(argv[optind++]); 1910 read_symbols(argv[optind++]);
1698 }
1699 1911
1700 for (mod = modules; mod; mod = mod->next) { 1912 for (mod = modules; mod; mod = mod->next) {
1701 if (mod->skip) 1913 if (mod->skip)
@@ -1706,6 +1918,8 @@ int main(int argc, char **argv)
1706 err = 0; 1918 err = 0;
1707 1919
1708 for (mod = modules; mod; mod = mod->next) { 1920 for (mod = modules; mod; mod = mod->next) {
1921 char fname[strlen(mod->name) + 10];
1922
1709 if (mod->skip) 1923 if (mod->skip)
1710 continue; 1924 continue;
1711 1925
@@ -1723,6 +1937,12 @@ int main(int argc, char **argv)
1723 1937
1724 if (dump_write) 1938 if (dump_write)
1725 write_dump(dump_write); 1939 write_dump(dump_write);
1940 if (sec_mismatch_count && !sec_mismatch_verbose)
1941 fprintf(stderr, "modpost: Found %d section mismatch(es).\n"
1942 "To see additional details select \"Enable full "
1943 "Section mismatch analysis\"\n"
1944 "in the Kernel Hacking menu "
1945 "(CONFIG_SECTION_MISMATCH).\n", sec_mismatch_count);
1726 1946
1727 return err; 1947 return err;
1728} 1948}
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 0ffed17ec20c..999f15e0e008 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -17,6 +17,7 @@
17#define Elf_Shdr Elf32_Shdr 17#define Elf_Shdr Elf32_Shdr
18#define Elf_Sym Elf32_Sym 18#define Elf_Sym Elf32_Sym
19#define Elf_Addr Elf32_Addr 19#define Elf_Addr Elf32_Addr
20#define Elf_Sword Elf64_Sword
20#define Elf_Section Elf32_Half 21#define Elf_Section Elf32_Half
21#define ELF_ST_BIND ELF32_ST_BIND 22#define ELF_ST_BIND ELF32_ST_BIND
22#define ELF_ST_TYPE ELF32_ST_TYPE 23#define ELF_ST_TYPE ELF32_ST_TYPE
@@ -31,6 +32,7 @@
31#define Elf_Shdr Elf64_Shdr 32#define Elf_Shdr Elf64_Shdr
32#define Elf_Sym Elf64_Sym 33#define Elf_Sym Elf64_Sym
33#define Elf_Addr Elf64_Addr 34#define Elf_Addr Elf64_Addr
35#define Elf_Sword Elf64_Sxword
34#define Elf_Section Elf64_Half 36#define Elf_Section Elf64_Half
35#define ELF_ST_BIND ELF64_ST_BIND 37#define ELF_ST_BIND ELF64_ST_BIND
36#define ELF_ST_TYPE ELF64_ST_TYPE 38#define ELF_ST_TYPE ELF64_ST_TYPE
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 7c434e037e7f..5e326078a4a2 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -89,9 +89,8 @@ clean-dirs += $(objtree)/tar-install/
89# Help text displayed when executing 'make help' 89# Help text displayed when executing 'make help'
90# --------------------------------------------------------------------------- 90# ---------------------------------------------------------------------------
91help: FORCE 91help: FORCE
92 @echo ' rpm-pkg - Build the kernel as an RPM package' 92 @echo ' rpm-pkg - Build both source and binary RPM kernel packages'
93 @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel' 93 @echo ' binrpm-pkg - Build only the binary kernel package'
94 @echo ' and modules'
95 @echo ' deb-pkg - Build the kernel as an deb package' 94 @echo ' deb-pkg - Build the kernel as an deb package'
96 @echo ' tar-pkg - Build the kernel as an uncompressed tarball' 95 @echo ' tar-pkg - Build the kernel as an uncompressed tarball'
97 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' 96 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index aa0ccdbd1f47..28574ae55170 100644
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -69,8 +69,8 @@ cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
69# Install arch-specific kernel image(s) 69# Install arch-specific kernel image(s)
70# 70#
71case "${ARCH}" in 71case "${ARCH}" in
72 i386|x86_64) 72 x86|i386|x86_64)
73 [ -f "${objtree}/arch/$ARCH/boot/bzImage" ] && cp -v -- "${objtree}/arch/$ARCH/boot/bzImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 73 [ -f "${objtree}/arch/x86/boot/bzImage" ] && cp -v -- "${objtree}/arch/x86/boot/bzImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
74 ;; 74 ;;
75 alpha) 75 alpha)
76 [ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 76 [ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
diff --git a/scripts/patch-kernel b/scripts/patch-kernel
index 67e4b1868e50..ece46ef0ba54 100755
--- a/scripts/patch-kernel
+++ b/scripts/patch-kernel
@@ -65,7 +65,7 @@ sourcedir=${1-/usr/src/linux}
65patchdir=${2-.} 65patchdir=${2-.}
66stopvers=${3-default} 66stopvers=${3-default}
67 67
68if [ "$1" == -h -o "$1" == --help -o ! -r "$sourcedir/Makefile" ]; then 68if [ "$1" = -h -o "$1" = --help -o ! -r "$sourcedir/Makefile" ]; then
69cat << USAGE 69cat << USAGE
70usage: $PNAME [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ] 70usage: $PNAME [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
71 source directory defaults to /usr/src/linux, 71 source directory defaults to /usr/src/linux,
@@ -182,10 +182,12 @@ reversePatch () {
182} 182}
183 183
184# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION 184# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
185TMPFILE=`mktemp .tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; } 185# force $TMPFILEs below to be in local directory: a slash character prevents
186# the dot command from using the search path.
187TMPFILE=`mktemp ./.tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
186grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE 188grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
187tr -d [:blank:] < $TMPFILE > $TMPFILE.1 189tr -d [:blank:] < $TMPFILE > $TMPFILE.1
188source $TMPFILE.1 190. $TMPFILE.1
189rm -f $TMPFILE* 191rm -f $TMPFILE*
190if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ] 192if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
191then 193then
@@ -202,11 +204,7 @@ echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($
202EXTRAVER= 204EXTRAVER=
203if [ x$EXTRAVERSION != "x" ] 205if [ x$EXTRAVERSION != "x" ]
204then 206then
205 if [ ${EXTRAVERSION:0:1} == "." ]; then 207 EXTRAVER=${EXTRAVERSION#.}
206 EXTRAVER=${EXTRAVERSION:1}
207 else
208 EXTRAVER=$EXTRAVERSION
209 fi
210 EXTRAVER=${EXTRAVER%%[[:punct:]]*} 208 EXTRAVER=${EXTRAVER%%[[:punct:]]*}
211 #echo "$PNAME: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER" 209 #echo "$PNAME: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER"
212fi 210fi
@@ -251,16 +249,16 @@ while : # incrementing SUBLEVEL (s in v.p.s)
251do 249do
252 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" 250 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
253 EXTRAVER= 251 EXTRAVER=
254 if [ $stopvers == $CURRENTFULLVERSION ]; then 252 if [ $stopvers = $CURRENTFULLVERSION ]; then
255 echo "Stopping at $CURRENTFULLVERSION base as requested." 253 echo "Stopping at $CURRENTFULLVERSION base as requested."
256 break 254 break
257 fi 255 fi
258 256
259 SUBLEVEL=$((SUBLEVEL + 1)) 257 SUBLEVEL=$(($SUBLEVEL + 1))
260 FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" 258 FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
261 #echo "#___ trying $FULLVERSION ___" 259 #echo "#___ trying $FULLVERSION ___"
262 260
263 if [ $((SUBLEVEL)) -gt $((STOPSUBLEVEL)) ]; then 261 if [ $(($SUBLEVEL)) -gt $(($STOPSUBLEVEL)) ]; then
264 echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)" 262 echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)"
265 exit 1 263 exit 1
266 fi 264 fi
@@ -297,7 +295,7 @@ fi
297if [ x$gotac != x ]; then 295if [ x$gotac != x ]; then
298 # Out great user wants the -ac patches 296 # Out great user wants the -ac patches
299 # They could have done -ac (get latest) or -acxx where xx=version they want 297 # They could have done -ac (get latest) or -acxx where xx=version they want
300 if [ $gotac == "-ac" ]; then 298 if [ $gotac = "-ac" ]; then
301 # They want the latest version 299 # They want the latest version
302 HIGHESTPATCH=0 300 HIGHESTPATCH=0
303 for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.* 301 for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 82e4993f0a73..52f032e409a3 100644
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -12,11 +12,36 @@ cd "${1:-.}" || usage
12if head=`git rev-parse --verify HEAD 2>/dev/null`; then 12if head=`git rev-parse --verify HEAD 2>/dev/null`; then
13 # Do we have an untagged version? 13 # Do we have an untagged version?
14 if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then 14 if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
15 printf '%s%s' -g `echo "$head" | cut -c1-8` 15 git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
16 fi 16 fi
17 17
18 # Are there uncommitted changes? 18 # Are there uncommitted changes?
19 if git diff-index HEAD | read dummy; then 19 git update-index --refresh --unmerged > /dev/null
20 if git diff-index --name-only HEAD | grep -v "^scripts/package" \
21 | read dummy; then
20 printf '%s' -dirty 22 printf '%s' -dirty
21 fi 23 fi
24
25 # All done with git
26 exit
27fi
28
29# Check for mercurial and a mercurial repo.
30if hgid=`hg id 2>/dev/null`; then
31 tag=`printf '%s' "$hgid" | cut -d' ' -f2`
32
33 # Do we have an untagged version?
34 if [ -z "$tag" -o "$tag" = tip ]; then
35 id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
36 printf '%s%s' -hg "$id"
37 fi
38
39 # Are there uncommitted changes?
40 # These are represented by + after the changeset id.
41 case "$hgid" in
42 *+|*+\ *) printf '%s' -dirty ;;
43 esac
44
45 # All done with mercurial
46 exit
22fi 47fi