diff options
| -rw-r--r-- | Documentation/kbuild/makefiles.txt | 14 | ||||
| -rw-r--r-- | Kbuild | 1 | ||||
| -rw-r--r-- | Makefile | 26 | ||||
| -rw-r--r-- | arch/cris/arch-v10/vmlinux.lds.S | 2 | ||||
| -rw-r--r-- | arch/cris/arch-v32/vmlinux.lds.S | 2 | ||||
| -rw-r--r-- | arch/i386/mach-generic/es7000.c | 2 | ||||
| -rw-r--r-- | arch/powerpc/Makefile | 8 | ||||
| -rw-r--r-- | arch/powerpc/kernel/vmlinux.lds.S | 4 | ||||
| -rw-r--r-- | arch/xtensa/kernel/vmlinux.lds.S | 3 | ||||
| -rw-r--r-- | drivers/video/logo/logo.c | 7 | ||||
| -rw-r--r-- | scripts/Kbuild.include | 7 | ||||
| -rw-r--r-- | scripts/Makefile.build | 16 | ||||
| -rw-r--r-- | scripts/Makefile.headersinst | 14 | ||||
| -rw-r--r-- | scripts/Makefile.modpost | 4 | ||||
| -rwxr-xr-x | scripts/cleanfile | 54 | ||||
| -rwxr-xr-x | scripts/cleanpatch | 58 | ||||
| -rw-r--r-- | scripts/gcc-version.sh | 15 | ||||
| -rw-r--r-- | scripts/gen_initramfs_list.sh | 12 | ||||
| -rw-r--r-- | scripts/kallsyms.c | 17 | ||||
| -rw-r--r-- | scripts/kconfig/Makefile | 35 | ||||
| -rw-r--r-- | scripts/kconfig/confdata.c | 37 | ||||
| -rw-r--r-- | scripts/kconfig/kxgettext.c | 4 | ||||
| -rw-r--r-- | scripts/kconfig/lxdialog/check-lxdialog.sh | 2 | ||||
| -rw-r--r-- | scripts/kconfig/mconf.c | 11 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 312 | ||||
| -rw-r--r-- | scripts/mod/modpost.h | 3 | ||||
| -rw-r--r-- | usr/gen_init_cpio.c | 4 |
27 files changed, 474 insertions, 200 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index bb5306e9a5c3..e08ef8759a07 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
| @@ -501,6 +501,20 @@ more details, with real examples. | |||
| 501 | The third parameter may be a text as in this example, but it may also | 501 | The third parameter may be a text as in this example, but it may also |
| 502 | be an expanded variable or a macro. | 502 | be an expanded variable or a macro. |
| 503 | 503 | ||
| 504 | cc-fullversion | ||
| 505 | cc-fullversion is useful when the exact version of gcc is needed. | ||
| 506 | One typical use-case is when a specific GCC version is broken. | ||
| 507 | cc-fullversion points out a more specific version than cc-version does. | ||
| 508 | |||
| 509 | Example: | ||
| 510 | #arch/powerpc/Makefile | ||
| 511 | $(Q)if test "$(call cc-fullversion)" = "040200" ; then \ | ||
| 512 | echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \ | ||
| 513 | false ; \ | ||
| 514 | fi | ||
| 515 | |||
| 516 | In this example for a specific GCC version the build will error out explaining | ||
| 517 | to the user why it stops. | ||
| 504 | 518 | ||
| 505 | === 4 Host Program support | 519 | === 4 Host Program support |
| 506 | 520 | ||
| @@ -13,6 +13,7 @@ offsets-file := include/asm-$(ARCH)/asm-offsets.h | |||
| 13 | always := $(offsets-file) | 13 | always := $(offsets-file) |
| 14 | targets := $(offsets-file) | 14 | targets := $(offsets-file) |
| 15 | targets += arch/$(ARCH)/kernel/asm-offsets.s | 15 | targets += arch/$(ARCH)/kernel/asm-offsets.s |
| 16 | clean-files := $(addprefix $(objtree)/,$(targets)) | ||
| 16 | 17 | ||
| 17 | # Default sed regexp - multiline due to syntax constraints | 18 | # Default sed regexp - multiline due to syntax constraints |
| 18 | define sed-y | 19 | define sed-y |
| @@ -492,7 +492,7 @@ endif | |||
| 492 | include $(srctree)/arch/$(ARCH)/Makefile | 492 | include $(srctree)/arch/$(ARCH)/Makefile |
| 493 | 493 | ||
| 494 | ifdef CONFIG_FRAME_POINTER | 494 | ifdef CONFIG_FRAME_POINTER |
| 495 | CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) | 495 | CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls |
| 496 | else | 496 | else |
| 497 | CFLAGS += -fomit-frame-pointer | 497 | CFLAGS += -fomit-frame-pointer |
| 498 | endif | 498 | endif |
| @@ -618,7 +618,7 @@ quiet_cmd_vmlinux__ ?= LD $@ | |||
| 618 | cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \ | 618 | cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \ |
| 619 | -T $(vmlinux-lds) $(vmlinux-init) \ | 619 | -T $(vmlinux-lds) $(vmlinux-init) \ |
| 620 | --start-group $(vmlinux-main) --end-group \ | 620 | --start-group $(vmlinux-main) --end-group \ |
| 621 | $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^) | 621 | $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^) |
| 622 | 622 | ||
| 623 | # Generate new vmlinux version | 623 | # Generate new vmlinux version |
| 624 | quiet_cmd_vmlinux_version = GEN .version | 624 | quiet_cmd_vmlinux_version = GEN .version |
| @@ -742,15 +742,31 @@ debug_kallsyms: .tmp_map$(last_kallsyms) | |||
| 742 | 742 | ||
| 743 | endif # ifdef CONFIG_KALLSYMS | 743 | endif # ifdef CONFIG_KALLSYMS |
| 744 | 744 | ||
| 745 | # Do modpost on a prelinked vmlinux. The finally linked vmlinux has | ||
| 746 | # relevant sections renamed as per the linker script. | ||
| 747 | quiet_cmd_vmlinux-modpost = LD $@ | ||
| 748 | cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \ | ||
| 749 | $(vmlinux-init) --start-group $(vmlinux-main) --end-group \ | ||
| 750 | $(filter-out $(vmlinux-init) $(vmlinux-main) $(vmlinux-lds) FORCE ,$^) | ||
| 751 | define rule_vmlinux-modpost | ||
| 752 | : | ||
| 753 | +$(call cmd,vmlinux-modpost) | ||
| 754 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@ | ||
| 755 | $(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd | ||
| 756 | endef | ||
| 757 | |||
| 745 | # vmlinux image - including updated kernel symbols | 758 | # vmlinux image - including updated kernel symbols |
| 746 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE | 759 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE |
| 747 | ifdef CONFIG_HEADERS_CHECK | 760 | ifdef CONFIG_HEADERS_CHECK |
| 748 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check | 761 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check |
| 749 | endif | 762 | endif |
| 763 | $(call vmlinux-modpost) | ||
| 750 | $(call if_changed_rule,vmlinux__) | 764 | $(call if_changed_rule,vmlinux__) |
| 751 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@ | ||
| 752 | $(Q)rm -f .old_version | 765 | $(Q)rm -f .old_version |
| 753 | 766 | ||
| 767 | vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE | ||
| 768 | $(call if_changed_rule,vmlinux-modpost) | ||
| 769 | |||
| 754 | # The actual objects are generated when descending, | 770 | # The actual objects are generated when descending, |
| 755 | # make sure no implicit rule kicks in | 771 | # make sure no implicit rule kicks in |
| 756 | $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; | 772 | $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; |
| @@ -1323,7 +1339,7 @@ define xtags | |||
| 1323 | -I __initdata,__exitdata,__acquires,__releases \ | 1339 | -I __initdata,__exitdata,__acquires,__releases \ |
| 1324 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 1340 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
| 1325 | --extra=+f --c-kinds=+px \ | 1341 | --extra=+f --c-kinds=+px \ |
| 1326 | --regex-asm='/ENTRY\(([^)]*)\).*/\1/'; \ | 1342 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \ |
| 1327 | $(all-kconfigs) | xargs $1 -a \ | 1343 | $(all-kconfigs) | xargs $1 -a \ |
| 1328 | --langdef=kconfig \ | 1344 | --langdef=kconfig \ |
| 1329 | --language-force=kconfig \ | 1345 | --language-force=kconfig \ |
diff --git a/arch/cris/arch-v10/vmlinux.lds.S b/arch/cris/arch-v10/vmlinux.lds.S index 4b348b38cf33..9859d49d088b 100644 --- a/arch/cris/arch-v10/vmlinux.lds.S +++ b/arch/cris/arch-v10/vmlinux.lds.S | |||
| @@ -44,7 +44,7 @@ SECTIONS | |||
| 44 | ___data_start = . ; | 44 | ___data_start = . ; |
| 45 | __Sdata = . ; | 45 | __Sdata = . ; |
| 46 | .data : { /* Data */ | 46 | .data : { /* Data */ |
| 47 | *(.data) | 47 | DATA_DATA |
| 48 | } | 48 | } |
| 49 | __edata = . ; /* End of data section */ | 49 | __edata = . ; /* End of data section */ |
| 50 | _edata = . ; | 50 | _edata = . ; |
diff --git a/arch/cris/arch-v32/vmlinux.lds.S b/arch/cris/arch-v32/vmlinux.lds.S index 651a77f2ccc4..b076c134c0bb 100644 --- a/arch/cris/arch-v32/vmlinux.lds.S +++ b/arch/cris/arch-v32/vmlinux.lds.S | |||
| @@ -49,7 +49,7 @@ SECTIONS | |||
| 49 | ___data_start = . ; | 49 | ___data_start = . ; |
| 50 | __Sdata = . ; | 50 | __Sdata = . ; |
| 51 | .data : { /* Data */ | 51 | .data : { /* Data */ |
| 52 | *(.data) | 52 | DATA_DATA |
| 53 | } | 53 | } |
| 54 | __edata = . ; /* End of data section. */ | 54 | __edata = . ; /* End of data section. */ |
| 55 | _edata = . ; | 55 | _edata = . ; |
diff --git a/arch/i386/mach-generic/es7000.c b/arch/i386/mach-generic/es7000.c index b47f951c0ec2..4742626f08c4 100644 --- a/arch/i386/mach-generic/es7000.c +++ b/arch/i386/mach-generic/es7000.c | |||
| @@ -66,4 +66,4 @@ static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | |||
| 66 | } | 66 | } |
| 67 | #endif | 67 | #endif |
| 68 | 68 | ||
| 69 | struct genapic apic_es7000 = APIC_INIT("es7000", probe_es7000); | 69 | struct genapic __initdata_refok apic_es7000 = APIC_INIT("es7000", probe_es7000); |
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 187a39af3e1c..6c1e36c33faa 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile | |||
| @@ -201,6 +201,14 @@ checkbin: | |||
| 201 | false; \ | 201 | false; \ |
| 202 | fi ; \ | 202 | fi ; \ |
| 203 | fi | 203 | fi |
| 204 | @if test "$(call cc-fullversion)" = "040200" \ | ||
| 205 | && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \ | ||
| 206 | echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \ | ||
| 207 | echo 'kernel with modules enabled.' ; \ | ||
| 208 | echo -n '*** Please use a different GCC version or ' ; \ | ||
| 209 | echo 'disable kernel modules' ; \ | ||
| 210 | false ; \ | ||
| 211 | fi | ||
| 204 | @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \ | 212 | @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \ |
| 205 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \ | 213 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \ |
| 206 | echo 'correctly with old versions of binutils.' ; \ | 214 | echo 'correctly with old versions of binutils.' ; \ |
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 7a1f5a0964de..0c458556399f 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S | |||
| @@ -177,7 +177,9 @@ SECTIONS | |||
| 177 | } | 177 | } |
| 178 | #else | 178 | #else |
| 179 | .data : { | 179 | .data : { |
| 180 | *(.data .data.rel* .toc1) | 180 | DATA_DATA |
| 181 | *(.data.rel*) | ||
| 182 | *(.toc1) | ||
| 181 | *(.branch_lt) | 183 | *(.branch_lt) |
| 182 | } | 184 | } |
| 183 | 185 | ||
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S index 3e31512109f9..ac4ed52034db 100644 --- a/arch/xtensa/kernel/vmlinux.lds.S +++ b/arch/xtensa/kernel/vmlinux.lds.S | |||
| @@ -118,7 +118,8 @@ SECTIONS | |||
| 118 | _fdata = .; | 118 | _fdata = .; |
| 119 | .data : | 119 | .data : |
| 120 | { | 120 | { |
| 121 | *(.data) CONSTRUCTORS | 121 | DATA_DATA |
| 122 | CONSTRUCTORS | ||
| 122 | . = ALIGN(XCHAL_ICACHE_LINESIZE); | 123 | . = ALIGN(XCHAL_ICACHE_LINESIZE); |
| 123 | *(.data.cacheline_aligned) | 124 | *(.data.cacheline_aligned) |
| 124 | } | 125 | } |
diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c index 80c03618eb53..2b0f799aa8da 100644 --- a/drivers/video/logo/logo.c +++ b/drivers/video/logo/logo.c | |||
| @@ -34,8 +34,11 @@ extern const struct linux_logo logo_superh_vga16; | |||
| 34 | extern const struct linux_logo logo_superh_clut224; | 34 | extern const struct linux_logo logo_superh_clut224; |
| 35 | extern const struct linux_logo logo_m32r_clut224; | 35 | extern const struct linux_logo logo_m32r_clut224; |
| 36 | 36 | ||
| 37 | 37 | /* logo's are marked __initdata. Use __init_refok to tell | |
| 38 | const struct linux_logo *fb_find_logo(int depth) | 38 | * modpost that it is intended that this function uses data |
| 39 | * marked __initdata. | ||
| 40 | */ | ||
| 41 | const struct linux_logo * __init_refok fb_find_logo(int depth) | ||
| 39 | { | 42 | { |
| 40 | const struct linux_logo *logo = NULL; | 43 | const struct linux_logo *logo = NULL; |
| 41 | 44 | ||
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 06c1a377c4c5..677bc6c175cb 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -100,9 +100,14 @@ cc-option-align = $(subst -functions=0,,\ | |||
| 100 | $(call cc-option,-falign-functions=0,-malign-functions=0)) | 100 | $(call cc-option,-falign-functions=0,-malign-functions=0)) |
| 101 | 101 | ||
| 102 | # cc-version | 102 | # cc-version |
| 103 | # Usage gcc-ver := $(call cc-version,$(CC)) | 103 | # Usage gcc-ver := $(call cc-version) |
| 104 | cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) | 104 | cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) |
| 105 | 105 | ||
| 106 | # cc-fullversion | ||
| 107 | # Usage gcc-ver := $(call cc-fullversion) | ||
| 108 | cc-fullversion = $(shell $(CONFIG_SHELL) \ | ||
| 109 | $(srctree)/scripts/gcc-version.sh -p $(CC)) | ||
| 110 | |||
| 106 | # cc-ifversion | 111 | # cc-ifversion |
| 107 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | 112 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) |
| 108 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) | 113 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index a525112847fd..3f7b451f3955 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -7,6 +7,22 @@ src := $(obj) | |||
| 7 | PHONY := __build | 7 | PHONY := __build |
| 8 | __build: | 8 | __build: |
| 9 | 9 | ||
| 10 | # Init all relevant variables used in kbuild files so | ||
| 11 | # 1) they have correct type | ||
| 12 | # 2) they do not inherit any value from the environment | ||
| 13 | obj-y := | ||
| 14 | obj-m := | ||
| 15 | lib-y := | ||
| 16 | lib-m := | ||
| 17 | always := | ||
| 18 | targets := | ||
| 19 | subdir-y := | ||
| 20 | subdir-m := | ||
| 21 | EXTRA_AFLAGS := | ||
| 22 | EXTRA_CFLAGS := | ||
| 23 | EXTRA_CPPFLAGS := | ||
| 24 | EXTRA_LDFLAGS := | ||
| 25 | |||
| 10 | # Read .config if it exist, otherwise ignore | 26 | # Read .config if it exist, otherwise ignore |
| 11 | -include include/config/auto.conf | 27 | -include include/config/auto.conf |
| 12 | 28 | ||
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index f98d772aac80..53dae3eb3d1f 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
| @@ -11,13 +11,13 @@ UNIFDEF := scripts/unifdef -U__KERNEL__ | |||
| 11 | 11 | ||
| 12 | # Eliminate the contents of (and inclusions of) compiler.h | 12 | # Eliminate the contents of (and inclusions of) compiler.h |
| 13 | HDRSED := sed -e "s/ inline / __inline__ /g" \ | 13 | HDRSED := sed -e "s/ inline / __inline__ /g" \ |
| 14 | -e "s/[[:space:]]__user[[:space:]]\+/ /g" \ | 14 | -e "s/[[:space:]]__user[[:space:]]\{1,\}/ /g" \ |
| 15 | -e "s/(__user[[:space:]]\+/ (/g" \ | 15 | -e "s/(__user[[:space:]]\{1,\}/ (/g" \ |
| 16 | -e "s/[[:space:]]__force[[:space:]]\+/ /g" \ | 16 | -e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \ |
| 17 | -e "s/(__force[[:space:]]\+/ (/g" \ | 17 | -e "s/(__force[[:space:]]\{1,\}/ (/g" \ |
| 18 | -e "s/[[:space:]]__iomem[[:space:]]\+/ /g" \ | 18 | -e "s/[[:space:]]__iomem[[:space:]]\{1,\}/ /g" \ |
| 19 | -e "s/(__iomem[[:space:]]\+/ (/g" \ | 19 | -e "s/(__iomem[[:space:]]\{1,\}/ (/g" \ |
| 20 | -e "s/[[:space:]]__attribute_const__[[:space:]]\+/\ /g" \ | 20 | -e "s/[[:space:]]__attribute_const__[[:space:]]\{1,\}/\ /g" \ |
| 21 | -e "s/[[:space:]]__attribute_const__$$//" \ | 21 | -e "s/[[:space:]]__attribute_const__$$//" \ |
| 22 | -e "/^\#include <linux\/compiler.h>/d" | 22 | -e "/^\#include <linux\/compiler.h>/d" |
| 23 | 23 | ||
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index d5bbbcce31ef..c6fcc597b3be 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
| @@ -70,10 +70,10 @@ __modpost: $(modules:.ko=.o) FORCE | |||
| 70 | $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^) | 70 | $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^) |
| 71 | 71 | ||
| 72 | quiet_cmd_kernel-mod = MODPOST $@ | 72 | quiet_cmd_kernel-mod = MODPOST $@ |
| 73 | cmd_kernel-mod = $(cmd_modpost) $(KBUILD_VMLINUX_OBJS) | 73 | cmd_kernel-mod = $(cmd_modpost) $@ |
| 74 | 74 | ||
| 75 | PHONY += vmlinux | 75 | PHONY += vmlinux |
| 76 | vmlinux: FORCE | 76 | vmlinux.o: FORCE |
| 77 | $(call cmd,kernel-mod) | 77 | $(call cmd,kernel-mod) |
| 78 | 78 | ||
| 79 | # Declare generated files as targets for modpost | 79 | # Declare generated files as targets for modpost |
diff --git a/scripts/cleanfile b/scripts/cleanfile index f1ba8aa58a40..cefd29e52298 100755 --- a/scripts/cleanfile +++ b/scripts/cleanfile | |||
| @@ -7,7 +7,9 @@ | |||
| 7 | use bytes; | 7 | use bytes; |
| 8 | use File::Basename; | 8 | use File::Basename; |
| 9 | 9 | ||
| 10 | # | 10 | # Default options |
| 11 | $max_width = 79; | ||
| 12 | |||
| 11 | # Clean up space-tab sequences, either by removing spaces or | 13 | # Clean up space-tab sequences, either by removing spaces or |
| 12 | # replacing them with tabs. | 14 | # replacing them with tabs. |
| 13 | sub clean_space_tabs($) | 15 | sub clean_space_tabs($) |
| @@ -48,9 +50,49 @@ sub clean_space_tabs($) | |||
| 48 | return $lo; | 50 | return $lo; |
| 49 | } | 51 | } |
| 50 | 52 | ||
| 53 | # Compute the visual width of a string | ||
| 54 | sub strwidth($) { | ||
| 55 | no bytes; # Tab alignment depends on characters | ||
| 56 | |||
| 57 | my($li) = @_; | ||
| 58 | my($c, $i); | ||
| 59 | my $pos = 0; | ||
| 60 | my $mlen = 0; | ||
| 61 | |||
| 62 | for ($i = 0; $i < length($li); $i++) { | ||
| 63 | $c = substr($li,$i,1); | ||
| 64 | if ($c eq "\t") { | ||
| 65 | $pos = ($pos+8) & ~7; | ||
| 66 | } elsif ($c eq "\n") { | ||
| 67 | $mlen = $pos if ($pos > $mlen); | ||
| 68 | $pos = 0; | ||
| 69 | } else { | ||
| 70 | $pos++; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | $mlen = $pos if ($pos > $mlen); | ||
| 75 | return $mlen; | ||
| 76 | } | ||
| 77 | |||
| 51 | $name = basename($0); | 78 | $name = basename($0); |
| 52 | 79 | ||
| 53 | foreach $f ( @ARGV ) { | 80 | @files = (); |
| 81 | |||
| 82 | while (defined($a = shift(@ARGV))) { | ||
| 83 | if ($a =~ /^-/) { | ||
| 84 | if ($a eq '-width' || $a eq '-w') { | ||
| 85 | $max_width = shift(@ARGV)+0; | ||
| 86 | } else { | ||
| 87 | print STDERR "Usage: $name [-width #] files...\n"; | ||
| 88 | exit 1; | ||
| 89 | } | ||
| 90 | } else { | ||
| 91 | push(@files, $a); | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | foreach $f ( @files ) { | ||
| 54 | print STDERR "$name: $f\n"; | 96 | print STDERR "$name: $f\n"; |
| 55 | 97 | ||
| 56 | if (! -f $f) { | 98 | if (! -f $f) { |
| @@ -90,8 +132,10 @@ foreach $f ( @ARGV ) { | |||
| 90 | 132 | ||
| 91 | @blanks = (); | 133 | @blanks = (); |
| 92 | @lines = (); | 134 | @lines = (); |
| 135 | $lineno = 0; | ||
| 93 | 136 | ||
| 94 | while ( defined($line = <FILE>) ) { | 137 | while ( defined($line = <FILE>) ) { |
| 138 | $lineno++; | ||
| 95 | $in_bytes += length($line); | 139 | $in_bytes += length($line); |
| 96 | $line =~ s/[ \t\r]*$//; # Remove trailing spaces | 140 | $line =~ s/[ \t\r]*$//; # Remove trailing spaces |
| 97 | $line = clean_space_tabs($line); | 141 | $line = clean_space_tabs($line); |
| @@ -107,6 +151,12 @@ foreach $f ( @ARGV ) { | |||
| 107 | @blanks = (); | 151 | @blanks = (); |
| 108 | $blank_bytes = 0; | 152 | $blank_bytes = 0; |
| 109 | } | 153 | } |
| 154 | |||
| 155 | $l_width = strwidth($line); | ||
| 156 | if ($max_width && $l_width > $max_width) { | ||
| 157 | print STDERR | ||
| 158 | "$f:$lineno: line exceeds $max_width characters ($l_width)\n"; | ||
| 159 | } | ||
| 110 | } | 160 | } |
| 111 | 161 | ||
| 112 | # Any blanks at the end of the file are discarded | 162 | # Any blanks at the end of the file are discarded |
diff --git a/scripts/cleanpatch b/scripts/cleanpatch index a53f987708f5..9680d03ad2b8 100755 --- a/scripts/cleanpatch +++ b/scripts/cleanpatch | |||
| @@ -7,7 +7,9 @@ | |||
| 7 | use bytes; | 7 | use bytes; |
| 8 | use File::Basename; | 8 | use File::Basename; |
| 9 | 9 | ||
| 10 | # | 10 | # Default options |
| 11 | $max_width = 79; | ||
| 12 | |||
| 11 | # Clean up space-tab sequences, either by removing spaces or | 13 | # Clean up space-tab sequences, either by removing spaces or |
| 12 | # replacing them with tabs. | 14 | # replacing them with tabs. |
| 13 | sub clean_space_tabs($) | 15 | sub clean_space_tabs($) |
| @@ -48,9 +50,49 @@ sub clean_space_tabs($) | |||
| 48 | return $lo; | 50 | return $lo; |
| 49 | } | 51 | } |
| 50 | 52 | ||
| 53 | # Compute the visual width of a string | ||
| 54 | sub strwidth($) { | ||
| 55 | no bytes; # Tab alignment depends on characters | ||
| 56 | |||
| 57 | my($li) = @_; | ||
| 58 | my($c, $i); | ||
| 59 | my $pos = 0; | ||
| 60 | my $mlen = 0; | ||
| 61 | |||
| 62 | for ($i = 0; $i < length($li); $i++) { | ||
| 63 | $c = substr($li,$i,1); | ||
| 64 | if ($c eq "\t") { | ||
| 65 | $pos = ($pos+8) & ~7; | ||
| 66 | } elsif ($c eq "\n") { | ||
| 67 | $mlen = $pos if ($pos > $mlen); | ||
| 68 | $pos = 0; | ||
| 69 | } else { | ||
| 70 | $pos++; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | $mlen = $pos if ($pos > $mlen); | ||
| 75 | return $mlen; | ||
| 76 | } | ||
| 77 | |||
| 51 | $name = basename($0); | 78 | $name = basename($0); |
| 52 | 79 | ||
| 53 | foreach $f ( @ARGV ) { | 80 | @files = (); |
| 81 | |||
| 82 | while (defined($a = shift(@ARGV))) { | ||
| 83 | if ($a =~ /^-/) { | ||
| 84 | if ($a eq '-width' || $a eq '-w') { | ||
| 85 | $max_width = shift(@ARGV)+0; | ||
| 86 | } else { | ||
| 87 | print STDERR "Usage: $name [-width #] files...\n"; | ||
| 88 | exit 1; | ||
| 89 | } | ||
| 90 | } else { | ||
| 91 | push(@files, $a); | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | foreach $f ( @files ) { | ||
| 54 | print STDERR "$name: $f\n"; | 96 | print STDERR "$name: $f\n"; |
| 55 | 97 | ||
| 56 | if (! -f $f) { | 98 | if (! -f $f) { |
| @@ -86,6 +128,7 @@ foreach $f ( @ARGV ) { | |||
| 86 | 128 | ||
| 87 | $in_bytes = 0; | 129 | $in_bytes = 0; |
| 88 | $out_bytes = 0; | 130 | $out_bytes = 0; |
| 131 | $lineno = 0; | ||
| 89 | 132 | ||
| 90 | @lines = (); | 133 | @lines = (); |
| 91 | 134 | ||
| @@ -93,10 +136,12 @@ foreach $f ( @ARGV ) { | |||
| 93 | $err = 0; | 136 | $err = 0; |
| 94 | 137 | ||
| 95 | while ( defined($line = <FILE>) ) { | 138 | while ( defined($line = <FILE>) ) { |
| 139 | $lineno++; | ||
| 96 | $in_bytes += length($line); | 140 | $in_bytes += length($line); |
| 97 | 141 | ||
| 98 | if (!$in_hunk) { | 142 | if (!$in_hunk) { |
| 99 | if ($line =~ /^\@\@\s+\-([0-9]+),([0-9]+)\s+\+([0-9]+),([0-9]+)\s\@\@/) { | 143 | if ($line =~ |
| 144 | /^\@\@\s+\-([0-9]+),([0-9]+)\s+\+([0-9]+),([0-9]+)\s\@\@/) { | ||
| 100 | $minus_lines = $2; | 145 | $minus_lines = $2; |
| 101 | $plus_lines = $4; | 146 | $plus_lines = $4; |
| 102 | if ($minus_lines || $plus_lines) { | 147 | if ($minus_lines || $plus_lines) { |
| @@ -117,6 +162,13 @@ foreach $f ( @ARGV ) { | |||
| 117 | $text =~ s/[ \t\r]*$//; # Remove trailing spaces | 162 | $text =~ s/[ \t\r]*$//; # Remove trailing spaces |
| 118 | $text = clean_space_tabs($text); | 163 | $text = clean_space_tabs($text); |
| 119 | 164 | ||
| 165 | $l_width = strwidth($text); | ||
| 166 | if ($max_width && $l_width > $max_width) { | ||
| 167 | print STDERR | ||
| 168 | "$f:$lineno: adds line exceeds $max_width ", | ||
| 169 | "characters ($l_width)\n"; | ||
| 170 | } | ||
| 171 | |||
| 120 | push(@hunk_lines, '+'.$text); | 172 | push(@hunk_lines, '+'.$text); |
| 121 | } elsif ($line =~ /^\-/) { | 173 | } elsif ($line =~ /^\-/) { |
| 122 | $minus_lines--; | 174 | $minus_lines--; |
diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh index bb4fbeab8320..8a1d1879c7ad 100644 --- a/scripts/gcc-version.sh +++ b/scripts/gcc-version.sh | |||
| @@ -1,14 +1,23 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # | 2 | # |
| 3 | # gcc-version gcc-command | 3 | # gcc-version [-p] gcc-command |
| 4 | # | 4 | # |
| 5 | # Prints the gcc version of `gcc-command' in a canonical 4-digit form | 5 | # Prints the gcc version of `gcc-command' in a canonical 4-digit form |
| 6 | # such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc. | 6 | # such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc. |
| 7 | # | 7 | # |
| 8 | # With the -p option, prints the patchlevel as well, for example `029503' for | ||
| 9 | # gcc-2.95.3, `030301' for gcc-3.3.1, etc. | ||
| 10 | # | ||
| 11 | |||
| 12 | if [ $1 = "-p" ] ; then with_patchlevel=1; shift; fi | ||
| 8 | 13 | ||
| 9 | compiler="$*" | 14 | compiler="$*" |
| 10 | 15 | ||
| 11 | MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1) | 16 | MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1) |
| 12 | MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) | 17 | MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) |
| 13 | printf "%02d%02d\\n" $MAJOR $MINOR | 18 | if [ "x$with_patchlevel" != "x" ] ; then |
| 14 | 19 | PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1) | |
| 20 | printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL | ||
| 21 | else | ||
| 22 | printf "%02d%02d\\n" $MAJOR $MINOR | ||
| 23 | fi | ||
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 683eb12babbb..684fb9cdc055 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh | |||
| @@ -19,11 +19,11 @@ $0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... | |||
| 19 | -o <file> Create gzipped initramfs file named <file> using | 19 | -o <file> Create gzipped initramfs file named <file> using |
| 20 | gen_init_cpio and gzip | 20 | gen_init_cpio and gzip |
| 21 | -u <uid> User ID to map to user ID 0 (root). | 21 | -u <uid> User ID to map to user ID 0 (root). |
| 22 | <uid> is only meaningful if <cpio_source> | 22 | <uid> is only meaningful if <cpio_source> is a |
| 23 | is a directory. | 23 | directory. "squash" forces all files to uid 0. |
| 24 | -g <gid> Group ID to map to group ID 0 (root). | 24 | -g <gid> Group ID to map to group ID 0 (root). |
| 25 | <gid> is only meaningful if <cpio_source> | 25 | <gid> is only meaningful if <cpio_source> is a |
| 26 | is a directory. | 26 | directory. "squash" forces all files to gid 0. |
| 27 | <cpio_source> File list or directory for cpio archive. | 27 | <cpio_source> File list or directory for cpio archive. |
| 28 | If <cpio_source> is a .cpio file it will be used | 28 | If <cpio_source> is a .cpio file it will be used |
| 29 | as direct input to initramfs. | 29 | as direct input to initramfs. |
| @@ -113,8 +113,8 @@ parse() { | |||
| 113 | local gid="$4" | 113 | local gid="$4" |
| 114 | local ftype=$(filetype "${location}") | 114 | local ftype=$(filetype "${location}") |
| 115 | # remap uid/gid to 0 if necessary | 115 | # remap uid/gid to 0 if necessary |
| 116 | [ "$uid" -eq "$root_uid" ] && uid=0 | 116 | [ "$root_uid" = "squash" ] && uid=0 || [ "$uid" -eq "$root_uid" ] && uid=0 |
| 117 | [ "$gid" -eq "$root_gid" ] && gid=0 | 117 | [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0 |
| 118 | local str="${mode} ${uid} ${gid}" | 118 | local str="${mode} ${uid} ${gid}" |
| 119 | 119 | ||
| 120 | [ "${ftype}" == "invalid" ] && return 0 | 120 | [ "${ftype}" == "invalid" ] && return 0 |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 10b006694e5d..1f11d848532a 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
| @@ -24,8 +24,6 @@ | |||
| 24 | * | 24 | * |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #define _GNU_SOURCE | ||
| 28 | |||
| 29 | #include <stdio.h> | 27 | #include <stdio.h> |
| 30 | #include <stdlib.h> | 28 | #include <stdlib.h> |
| 31 | #include <string.h> | 29 | #include <string.h> |
| @@ -378,6 +376,17 @@ static void build_initial_tok_table(void) | |||
| 378 | table_cnt = pos; | 376 | table_cnt = pos; |
| 379 | } | 377 | } |
| 380 | 378 | ||
| 379 | static void *find_token(unsigned char *str, int len, unsigned char *token) | ||
| 380 | { | ||
| 381 | int i; | ||
| 382 | |||
| 383 | for (i = 0; i < len - 1; i++) { | ||
| 384 | if (str[i] == token[0] && str[i+1] == token[1]) | ||
| 385 | return &str[i]; | ||
| 386 | } | ||
| 387 | return NULL; | ||
| 388 | } | ||
| 389 | |||
| 381 | /* replace a given token in all the valid symbols. Use the sampled symbols | 390 | /* replace a given token in all the valid symbols. Use the sampled symbols |
| 382 | * to update the counts */ | 391 | * to update the counts */ |
| 383 | static void compress_symbols(unsigned char *str, int idx) | 392 | static void compress_symbols(unsigned char *str, int idx) |
| @@ -391,7 +400,7 @@ static void compress_symbols(unsigned char *str, int idx) | |||
| 391 | p1 = table[i].sym; | 400 | p1 = table[i].sym; |
| 392 | 401 | ||
| 393 | /* find the token on the symbol */ | 402 | /* find the token on the symbol */ |
| 394 | p2 = memmem(p1, len, str, 2); | 403 | p2 = find_token(p1, len, str); |
| 395 | if (!p2) continue; | 404 | if (!p2) continue; |
| 396 | 405 | ||
| 397 | /* decrease the counts for this symbol's tokens */ | 406 | /* decrease the counts for this symbol's tokens */ |
| @@ -410,7 +419,7 @@ static void compress_symbols(unsigned char *str, int idx) | |||
| 410 | if (size < 2) break; | 419 | if (size < 2) break; |
| 411 | 420 | ||
| 412 | /* find the token on the symbol */ | 421 | /* find the token on the symbol */ |
| 413 | p2 = memmem(p1, size, str, 2); | 422 | p2 = find_token(p1, size, str); |
| 414 | 423 | ||
| 415 | } while (p2); | 424 | } while (p2); |
| 416 | 425 | ||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index fb2bb3099dd9..8986a48c8c49 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -22,24 +22,25 @@ oldconfig: $(obj)/conf | |||
| 22 | silentoldconfig: $(obj)/conf | 22 | silentoldconfig: $(obj)/conf |
| 23 | $< -s arch/$(ARCH)/Kconfig | 23 | $< -s arch/$(ARCH)/Kconfig |
| 24 | 24 | ||
| 25 | # Create new linux.po file | ||
| 26 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files | ||
| 27 | # The symlink is used to repair a deficiency in arch/um | ||
| 25 | update-po-config: $(obj)/kxgettext | 28 | update-po-config: $(obj)/kxgettext |
| 26 | xgettext --default-domain=linux \ | 29 | xgettext --default-domain=linux \ |
| 27 | --add-comments --keyword=_ --keyword=N_ \ | 30 | --add-comments --keyword=_ --keyword=N_ \ |
| 28 | --files-from=scripts/kconfig/POTFILES.in \ | 31 | --from-code=UTF-8 \ |
| 29 | --output scripts/kconfig/config.pot | 32 | --files-from=scripts/kconfig/POTFILES.in \ |
| 30 | $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch | 33 | --output $(obj)/config.pot |
| 31 | $(Q)for i in `ls arch/`; \ | 34 | $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot |
| 32 | do \ | 35 | $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch |
| 33 | scripts/kconfig/kxgettext arch/$$i/Kconfig \ | 36 | (for i in `ls arch/`; \ |
| 34 | | msguniq -o scripts/kconfig/linux_$${i}.pot; \ | 37 | do \ |
| 35 | done | 38 | $(obj)/kxgettext arch/$$i/Kconfig; \ |
| 36 | $(Q)msgcat scripts/kconfig/config.pot \ | 39 | done ) >> $(obj)/config.pot |
| 37 | `find scripts/kconfig/ -type f -name linux_*.pot` \ | 40 | msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ |
| 38 | --output scripts/kconfig/linux_raw.pot | 41 | --output $(obj)/linux.pot |
| 39 | $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \ | 42 | $(Q)rm -f arch/um/Kconfig.arch |
| 40 | --output scripts/kconfig/linux.pot | 43 | $(Q)rm -f $(obj)/config.pot |
| 41 | $(Q)rm -f arch/um/Kconfig_arch | ||
| 42 | $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot | ||
| 43 | 44 | ||
| 44 | PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig | 45 | PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig |
| 45 | 46 | ||
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 664fe29dacef..b2913e9da495 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
| @@ -341,27 +341,42 @@ int conf_read(const char *name) | |||
| 341 | conf_unsaved++; | 341 | conf_unsaved++; |
| 342 | /* maybe print value in verbose mode... */ | 342 | /* maybe print value in verbose mode... */ |
| 343 | sym_ok: | 343 | sym_ok: |
| 344 | if (!sym_is_choice(sym)) | ||
| 345 | continue; | ||
| 346 | /* The choice symbol only has a set value (and thus is not new) | ||
| 347 | * if all its visible childs have values. | ||
| 348 | */ | ||
| 349 | prop = sym_get_choice_prop(sym); | ||
| 350 | flags = sym->flags; | ||
| 351 | for (e = prop->expr; e; e = e->left.expr) | ||
| 352 | if (e->right.sym->visible != no) | ||
| 353 | flags &= e->right.sym->flags; | ||
| 354 | sym->flags &= flags | ~SYMBOL_DEF_USER; | ||
| 355 | } | ||
| 356 | |||
| 357 | for_all_symbols(i, sym) { | ||
| 344 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { | 358 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { |
| 345 | if (sym->visible == no) | 359 | /* Reset values of generates values, so they'll appear |
| 360 | * as new, if they should become visible, but that | ||
| 361 | * doesn't quite work if the Kconfig and the saved | ||
| 362 | * configuration disagree. | ||
| 363 | */ | ||
| 364 | if (sym->visible == no && !conf_unsaved) | ||
| 346 | sym->flags &= ~SYMBOL_DEF_USER; | 365 | sym->flags &= ~SYMBOL_DEF_USER; |
| 347 | switch (sym->type) { | 366 | switch (sym->type) { |
| 348 | case S_STRING: | 367 | case S_STRING: |
| 349 | case S_INT: | 368 | case S_INT: |
| 350 | case S_HEX: | 369 | case S_HEX: |
| 351 | if (!sym_string_within_range(sym, sym->def[S_DEF_USER].val)) | 370 | /* Reset a string value if it's out of range */ |
| 352 | sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER); | 371 | if (sym_string_within_range(sym, sym->def[S_DEF_USER].val)) |
| 372 | break; | ||
| 373 | sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER); | ||
| 374 | conf_unsaved++; | ||
| 375 | break; | ||
| 353 | default: | 376 | default: |
| 354 | break; | 377 | break; |
| 355 | } | 378 | } |
| 356 | } | 379 | } |
| 357 | if (!sym_is_choice(sym)) | ||
| 358 | continue; | ||
| 359 | prop = sym_get_choice_prop(sym); | ||
| 360 | flags = sym->flags; | ||
| 361 | for (e = prop->expr; e; e = e->left.expr) | ||
| 362 | if (e->right.sym->visible != no) | ||
| 363 | flags &= e->right.sym->flags; | ||
| 364 | sym->flags &= flags | ~SYMBOL_DEF_USER; | ||
| 365 | } | 380 | } |
| 366 | 381 | ||
| 367 | sym_add_change_count(conf_warnings || conf_unsaved); | 382 | sym_add_change_count(conf_warnings || conf_unsaved); |
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index abee55ca6174..11f7dab94715 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c | |||
| @@ -212,7 +212,9 @@ void menu__xgettext(void) | |||
| 212 | struct message *m = message__list; | 212 | struct message *m = message__list; |
| 213 | 213 | ||
| 214 | while (m != NULL) { | 214 | while (m != NULL) { |
| 215 | message__print_gettext_msgid_msgstr(m); | 215 | /* skip empty lines ("") */ |
| 216 | if (strlen(m->msg) > sizeof("\"\"")) | ||
| 217 | message__print_gettext_msgid_msgstr(m); | ||
| 216 | m = m->next; | 218 | m = m->next; |
| 217 | } | 219 | } |
| 218 | } | 220 | } |
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index cdca7388e0f1..9681476b96e7 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
| @@ -51,7 +51,7 @@ usage() { | |||
| 51 | printf "Usage: $0 [-check compiler options|-header|-library]\n" | 51 | printf "Usage: $0 [-check compiler options|-header|-library]\n" |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | if [ $# == 0 ]; then | 54 | if [ $# -eq 0 ]; then |
| 55 | usage | 55 | usage |
| 56 | exit 1 | 56 | exit 1 |
| 57 | fi | 57 | fi |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index d0e4fa594fc7..d2c2a429887b 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
| @@ -419,11 +419,13 @@ static void search_conf(void) | |||
| 419 | { | 419 | { |
| 420 | struct symbol **sym_arr; | 420 | struct symbol **sym_arr; |
| 421 | struct gstr res; | 421 | struct gstr res; |
| 422 | char *dialog_input; | ||
| 422 | int dres; | 423 | int dres; |
| 423 | again: | 424 | again: |
| 424 | dialog_clear(); | 425 | dialog_clear(); |
| 425 | dres = dialog_inputbox(_("Search Configuration Parameter"), | 426 | dres = dialog_inputbox(_("Search Configuration Parameter"), |
| 426 | _("Enter CONFIG_ (sub)string to search for (omit CONFIG_)"), | 427 | _("Enter CONFIG_ (sub)string to search for " |
| 428 | "(with or without \"CONFIG\")"), | ||
| 427 | 10, 75, ""); | 429 | 10, 75, ""); |
| 428 | switch (dres) { | 430 | switch (dres) { |
| 429 | case 0: | 431 | case 0: |
| @@ -435,7 +437,12 @@ again: | |||
| 435 | return; | 437 | return; |
| 436 | } | 438 | } |
| 437 | 439 | ||
| 438 | sym_arr = sym_re_search(dialog_input_result); | 440 | /* strip CONFIG_ if necessary */ |
| 441 | dialog_input = dialog_input_result; | ||
| 442 | if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) | ||
| 443 | dialog_input += 7; | ||
| 444 | |||
| 445 | sym_arr = sym_re_search(dialog_input); | ||
| 439 | res = get_relations_str(sym_arr); | 446 | res = get_relations_str(sym_arr); |
| 440 | free(sym_arr); | 447 | free(sym_arr); |
| 441 | show_textbox(_("Search Results"), str_get(&res), 0, 0); | 448 | show_textbox(_("Search Results"), str_get(&res), 0, 0); |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3645e980da71..04579a517900 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -75,7 +75,8 @@ static int is_vmlinux(const char *modname) | |||
| 75 | else | 75 | else |
| 76 | myname = modname; | 76 | myname = modname; |
| 77 | 77 | ||
| 78 | return strcmp(myname, "vmlinux") == 0; | 78 | return (strcmp(myname, "vmlinux") == 0) || |
| 79 | (strcmp(myname, "vmlinux.o") == 0); | ||
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | void *do_nofail(void *ptr, const char *expr) | 82 | void *do_nofail(void *ptr, const char *expr) |
| @@ -374,6 +375,7 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
| 374 | hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx); | 375 | hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx); |
| 375 | hdr->e_shnum = TO_NATIVE(hdr->e_shnum); | 376 | hdr->e_shnum = TO_NATIVE(hdr->e_shnum); |
| 376 | hdr->e_machine = TO_NATIVE(hdr->e_machine); | 377 | hdr->e_machine = TO_NATIVE(hdr->e_machine); |
| 378 | hdr->e_type = TO_NATIVE(hdr->e_type); | ||
| 377 | sechdrs = (void *)hdr + hdr->e_shoff; | 379 | sechdrs = (void *)hdr + hdr->e_shoff; |
| 378 | info->sechdrs = sechdrs; | 380 | info->sechdrs = sechdrs; |
| 379 | 381 | ||
| @@ -384,6 +386,8 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
| 384 | sechdrs[i].sh_size = TO_NATIVE(sechdrs[i].sh_size); | 386 | sechdrs[i].sh_size = TO_NATIVE(sechdrs[i].sh_size); |
| 385 | sechdrs[i].sh_link = TO_NATIVE(sechdrs[i].sh_link); | 387 | sechdrs[i].sh_link = TO_NATIVE(sechdrs[i].sh_link); |
| 386 | sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name); | 388 | sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name); |
| 389 | sechdrs[i].sh_info = TO_NATIVE(sechdrs[i].sh_info); | ||
| 390 | sechdrs[i].sh_addr = TO_NATIVE(sechdrs[i].sh_addr); | ||
| 387 | } | 391 | } |
| 388 | /* Find symbol table. */ | 392 | /* Find symbol table. */ |
| 389 | for (i = 1; i < hdr->e_shnum; i++) { | 393 | for (i = 1; i < hdr->e_shnum; i++) { |
| @@ -605,18 +609,14 @@ static int strrcmp(const char *s, const char *sub) | |||
| 605 | * warn here. | 609 | * warn here. |
| 606 | * the pattern is identified by: | 610 | * the pattern is identified by: |
| 607 | * tosec = .init.text | .exit.text | .init.data | 611 | * tosec = .init.text | .exit.text | .init.data |
| 608 | * fromsec = .data | 612 | * fromsec = .data | .data.rel | .data.rel.* |
| 609 | * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console | 613 | * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer |
| 610 | * | 614 | * |
| 611 | * Pattern 3: | 615 | * Pattern 3: |
| 612 | * Whitelist all references from .pci_fixup* section to .init.text | ||
| 613 | * This is part of the PCI init when built-in | ||
| 614 | * | ||
| 615 | * Pattern 4: | ||
| 616 | * Whitelist all refereces from .text.head to .init.data | 616 | * Whitelist all refereces from .text.head to .init.data |
| 617 | * Whitelist all refereces from .text.head to .init.text | 617 | * Whitelist all refereces from .text.head to .init.text |
| 618 | * | 618 | * |
| 619 | * Pattern 5: | 619 | * Pattern 4: |
| 620 | * Some symbols belong to init section but still it is ok to reference | 620 | * Some symbols belong to init section but still it is ok to reference |
| 621 | * these from non-init sections as these symbols don't have any memory | 621 | * these from non-init sections as these symbols don't have any memory |
| 622 | * allocated for them and symbol address and value are same. So even | 622 | * allocated for them and symbol address and value are same. So even |
| @@ -625,26 +625,6 @@ static int strrcmp(const char *s, const char *sub) | |||
| 625 | * This pattern is identified by | 625 | * This pattern is identified by |
| 626 | * refsymname = __init_begin, _sinittext, _einittext | 626 | * refsymname = __init_begin, _sinittext, _einittext |
| 627 | * | 627 | * |
| 628 | * Pattern 7: | ||
| 629 | * Logos used in drivers/video/logo reside in __initdata but the | ||
| 630 | * funtion that references them are EXPORT_SYMBOL() so cannot be | ||
| 631 | * marker __init. So we whitelist them here. | ||
| 632 | * The pattern is: | ||
| 633 | * tosec = .init.data | ||
| 634 | * fromsec = .text* | ||
| 635 | * refsymname = logo_ | ||
| 636 | * | ||
| 637 | * Pattern 8: | ||
| 638 | * Symbols contained in .paravirtprobe may safely reference .init.text. | ||
| 639 | * The pattern is: | ||
| 640 | * tosec = .init.text | ||
| 641 | * fromsec = .paravirtprobe | ||
| 642 | * | ||
| 643 | * Pattern 10: | ||
| 644 | * ia64 has machvec table for each platform and | ||
| 645 | * powerpc has a machine desc table for each platform. | ||
| 646 | * It is mixture of function pointers of .init.text and .text. | ||
| 647 | * fromsec = .machvec | .machine.desc | ||
| 648 | **/ | 628 | **/ |
| 649 | static int secref_whitelist(const char *modname, const char *tosec, | 629 | static int secref_whitelist(const char *modname, const char *tosec, |
| 650 | const char *fromsec, const char *atsym, | 630 | const char *fromsec, const char *atsym, |
| @@ -655,12 +635,12 @@ static int secref_whitelist(const char *modname, const char *tosec, | |||
| 655 | const char *pat2sym[] = { | 635 | const char *pat2sym[] = { |
| 656 | "driver", | 636 | "driver", |
| 657 | "_template", /* scsi uses *_template a lot */ | 637 | "_template", /* scsi uses *_template a lot */ |
| 638 | "_timer", /* arm uses ops structures named _timer a lot */ | ||
| 658 | "_sht", /* scsi also used *_sht to some extent */ | 639 | "_sht", /* scsi also used *_sht to some extent */ |
| 659 | "_ops", | 640 | "_ops", |
| 660 | "_probe", | 641 | "_probe", |
| 661 | "_probe_one", | 642 | "_probe_one", |
| 662 | "_console", | 643 | "_console", |
| 663 | "apic_es7000", | ||
| 664 | NULL | 644 | NULL |
| 665 | }; | 645 | }; |
| 666 | 646 | ||
| @@ -692,7 +672,9 @@ static int secref_whitelist(const char *modname, const char *tosec, | |||
| 692 | (strcmp(tosec, ".exit.text") != 0) && | 672 | (strcmp(tosec, ".exit.text") != 0) && |
| 693 | (strcmp(tosec, ".init.data") != 0)) | 673 | (strcmp(tosec, ".init.data") != 0)) |
| 694 | f2 = 0; | 674 | f2 = 0; |
| 695 | if (strcmp(fromsec, ".data") != 0) | 675 | if ((strcmp(fromsec, ".data") != 0) && |
| 676 | (strcmp(fromsec, ".data.rel") != 0) && | ||
| 677 | (strncmp(fromsec, ".data.rel.", strlen(".data.rel.")) != 0)) | ||
| 696 | f2 = 0; | 678 | f2 = 0; |
| 697 | 679 | ||
| 698 | for (s = pat2sym; *s; s++) | 680 | for (s = pat2sym; *s; s++) |
| @@ -702,37 +684,16 @@ static int secref_whitelist(const char *modname, const char *tosec, | |||
| 702 | return 1; | 684 | return 1; |
| 703 | 685 | ||
| 704 | /* Check for pattern 3 */ | 686 | /* Check for pattern 3 */ |
| 705 | if ((strncmp(fromsec, ".pci_fixup", strlen(".pci_fixup")) == 0) && | ||
| 706 | (strcmp(tosec, ".init.text") == 0)) | ||
| 707 | return 1; | ||
| 708 | |||
| 709 | /* Check for pattern 4 */ | ||
| 710 | if ((strcmp(fromsec, ".text.head") == 0) && | 687 | if ((strcmp(fromsec, ".text.head") == 0) && |
| 711 | ((strcmp(tosec, ".init.data") == 0) || | 688 | ((strcmp(tosec, ".init.data") == 0) || |
| 712 | (strcmp(tosec, ".init.text") == 0))) | 689 | (strcmp(tosec, ".init.text") == 0))) |
| 713 | return 1; | 690 | return 1; |
| 714 | 691 | ||
| 715 | /* Check for pattern 5 */ | 692 | /* Check for pattern 4 */ |
| 716 | for (s = pat3refsym; *s; s++) | 693 | for (s = pat3refsym; *s; s++) |
| 717 | if (strcmp(refsymname, *s) == 0) | 694 | if (strcmp(refsymname, *s) == 0) |
| 718 | return 1; | 695 | return 1; |
| 719 | 696 | ||
| 720 | /* Check for pattern 7 */ | ||
| 721 | if ((strcmp(tosec, ".init.data") == 0) && | ||
| 722 | (strncmp(fromsec, ".text", strlen(".text")) == 0) && | ||
| 723 | (strncmp(refsymname, "logo_", strlen("logo_")) == 0)) | ||
| 724 | return 1; | ||
| 725 | |||
| 726 | /* Check for pattern 8 */ | ||
| 727 | if ((strcmp(tosec, ".init.text") == 0) && | ||
| 728 | (strcmp(fromsec, ".paravirtprobe") == 0)) | ||
| 729 | return 1; | ||
| 730 | |||
| 731 | /* Check for pattern 10 */ | ||
| 732 | if ((strcmp(fromsec, ".machvec") == 0) || | ||
| 733 | (strcmp(fromsec, ".machine.desc") == 0)) | ||
| 734 | return 1; | ||
| 735 | |||
| 736 | return 0; | 697 | return 0; |
| 737 | } | 698 | } |
| 738 | 699 | ||
| @@ -753,6 +714,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr, | |||
| 753 | for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { | 714 | for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { |
| 754 | if (sym->st_shndx != relsym->st_shndx) | 715 | if (sym->st_shndx != relsym->st_shndx) |
| 755 | continue; | 716 | continue; |
| 717 | if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) | ||
| 718 | continue; | ||
| 756 | if (sym->st_value == addr) | 719 | if (sym->st_value == addr) |
| 757 | return sym; | 720 | return sym; |
| 758 | } | 721 | } |
| @@ -864,11 +827,6 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, | |||
| 864 | elf->strtab + before->st_name, refsymname)) | 827 | elf->strtab + before->st_name, refsymname)) |
| 865 | return; | 828 | return; |
| 866 | 829 | ||
| 867 | /* fromsec whitelist - without a valid 'before' | ||
| 868 | * powerpc has a GOT table in .got2 section */ | ||
| 869 | if (strcmp(fromsec, ".got2") == 0) | ||
| 870 | return; | ||
| 871 | |||
| 872 | if (before && after) { | 830 | if (before && after) { |
| 873 | warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s " | 831 | warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s " |
| 874 | "(between '%s' and '%s')\n", | 832 | "(between '%s' and '%s')\n", |
| @@ -895,6 +853,78 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, | |||
| 895 | } | 853 | } |
| 896 | } | 854 | } |
| 897 | 855 | ||
| 856 | static unsigned int *reloc_location(struct elf_info *elf, | ||
| 857 | int rsection, Elf_Rela *r) | ||
| 858 | { | ||
| 859 | Elf_Shdr *sechdrs = elf->sechdrs; | ||
| 860 | int section = sechdrs[rsection].sh_info; | ||
| 861 | |||
| 862 | return (void *)elf->hdr + sechdrs[section].sh_offset + | ||
| 863 | (r->r_offset - sechdrs[section].sh_addr); | ||
| 864 | } | ||
| 865 | |||
| 866 | static int addend_386_rel(struct elf_info *elf, int rsection, Elf_Rela *r) | ||
| 867 | { | ||
| 868 | unsigned int r_typ = ELF_R_TYPE(r->r_info); | ||
| 869 | unsigned int *location = reloc_location(elf, rsection, r); | ||
| 870 | |||
| 871 | switch (r_typ) { | ||
| 872 | case R_386_32: | ||
| 873 | r->r_addend = TO_NATIVE(*location); | ||
| 874 | break; | ||
| 875 | case R_386_PC32: | ||
| 876 | r->r_addend = TO_NATIVE(*location) + 4; | ||
| 877 | /* For CONFIG_RELOCATABLE=y */ | ||
| 878 | if (elf->hdr->e_type == ET_EXEC) | ||
| 879 | r->r_addend += r->r_offset; | ||
| 880 | break; | ||
| 881 | } | ||
| 882 | return 0; | ||
| 883 | } | ||
| 884 | |||
| 885 | static int addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r) | ||
| 886 | { | ||
| 887 | unsigned int r_typ = ELF_R_TYPE(r->r_info); | ||
| 888 | |||
| 889 | switch (r_typ) { | ||
| 890 | case R_ARM_ABS32: | ||
| 891 | /* From ARM ABI: (S + A) | T */ | ||
| 892 | r->r_addend = (int)(long)(elf->symtab_start + ELF_R_SYM(r->r_info)); | ||
| 893 | break; | ||
| 894 | case R_ARM_PC24: | ||
| 895 | /* From ARM ABI: ((S + A) | T) - P */ | ||
| 896 | r->r_addend = (int)(long)(elf->hdr + elf->sechdrs[rsection].sh_offset + | ||
| 897 | (r->r_offset - elf->sechdrs[rsection].sh_addr)); | ||
| 898 | break; | ||
| 899 | default: | ||
| 900 | return 1; | ||
| 901 | } | ||
| 902 | return 0; | ||
| 903 | } | ||
| 904 | |||
| 905 | static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r) | ||
| 906 | { | ||
| 907 | unsigned int r_typ = ELF_R_TYPE(r->r_info); | ||
| 908 | unsigned int *location = reloc_location(elf, rsection, r); | ||
| 909 | unsigned int inst; | ||
| 910 | |||
| 911 | if (r_typ == R_MIPS_HI16) | ||
| 912 | return 1; /* skip this */ | ||
| 913 | inst = TO_NATIVE(*location); | ||
| 914 | switch (r_typ) { | ||
| 915 | case R_MIPS_LO16: | ||
| 916 | r->r_addend = inst & 0xffff; | ||
| 917 | break; | ||
| 918 | case R_MIPS_26: | ||
| 919 | r->r_addend = (inst & 0x03ffffff) << 2; | ||
| 920 | break; | ||
| 921 | case R_MIPS_32: | ||
| 922 | r->r_addend = inst; | ||
| 923 | break; | ||
| 924 | } | ||
| 925 | return 0; | ||
| 926 | } | ||
| 927 | |||
| 898 | /** | 928 | /** |
| 899 | * A module includes a number of sections that are discarded | 929 | * A module includes a number of sections that are discarded |
| 900 | * either when loaded or when used as built-in. | 930 | * either when loaded or when used as built-in. |
| @@ -938,8 +968,11 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
| 938 | r.r_offset = TO_NATIVE(rela->r_offset); | 968 | r.r_offset = TO_NATIVE(rela->r_offset); |
| 939 | #if KERNEL_ELFCLASS == ELFCLASS64 | 969 | #if KERNEL_ELFCLASS == ELFCLASS64 |
| 940 | if (hdr->e_machine == EM_MIPS) { | 970 | if (hdr->e_machine == EM_MIPS) { |
| 971 | unsigned int r_typ; | ||
| 941 | r_sym = ELF64_MIPS_R_SYM(rela->r_info); | 972 | r_sym = ELF64_MIPS_R_SYM(rela->r_info); |
| 942 | r_sym = TO_NATIVE(r_sym); | 973 | r_sym = TO_NATIVE(r_sym); |
| 974 | r_typ = ELF64_MIPS_R_TYPE(rela->r_info); | ||
| 975 | r.r_info = ELF64_R_INFO(r_sym, r_typ); | ||
| 943 | } else { | 976 | } else { |
| 944 | r.r_info = TO_NATIVE(rela->r_info); | 977 | r.r_info = TO_NATIVE(rela->r_info); |
| 945 | r_sym = ELF_R_SYM(r.r_info); | 978 | r_sym = ELF_R_SYM(r.r_info); |
| @@ -972,8 +1005,11 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
| 972 | r.r_offset = TO_NATIVE(rel->r_offset); | 1005 | r.r_offset = TO_NATIVE(rel->r_offset); |
| 973 | #if KERNEL_ELFCLASS == ELFCLASS64 | 1006 | #if KERNEL_ELFCLASS == ELFCLASS64 |
| 974 | if (hdr->e_machine == EM_MIPS) { | 1007 | if (hdr->e_machine == EM_MIPS) { |
| 1008 | unsigned int r_typ; | ||
| 975 | r_sym = ELF64_MIPS_R_SYM(rel->r_info); | 1009 | r_sym = ELF64_MIPS_R_SYM(rel->r_info); |
| 976 | r_sym = TO_NATIVE(r_sym); | 1010 | r_sym = TO_NATIVE(r_sym); |
| 1011 | r_typ = ELF64_MIPS_R_TYPE(rel->r_info); | ||
| 1012 | r.r_info = ELF64_R_INFO(r_sym, r_typ); | ||
| 977 | } else { | 1013 | } else { |
| 978 | r.r_info = TO_NATIVE(rel->r_info); | 1014 | r.r_info = TO_NATIVE(rel->r_info); |
| 979 | r_sym = ELF_R_SYM(r.r_info); | 1015 | r_sym = ELF_R_SYM(r.r_info); |
| @@ -983,6 +1019,20 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
| 983 | r_sym = ELF_R_SYM(r.r_info); | 1019 | r_sym = ELF_R_SYM(r.r_info); |
| 984 | #endif | 1020 | #endif |
| 985 | r.r_addend = 0; | 1021 | r.r_addend = 0; |
| 1022 | switch (hdr->e_machine) { | ||
| 1023 | case EM_386: | ||
| 1024 | if (addend_386_rel(elf, i, &r)) | ||
| 1025 | continue; | ||
| 1026 | break; | ||
| 1027 | case EM_ARM: | ||
| 1028 | if(addend_arm_rel(elf, i, &r)) | ||
| 1029 | continue; | ||
| 1030 | break; | ||
| 1031 | case EM_MIPS: | ||
| 1032 | if (addend_mips_rel(elf, i, &r)) | ||
| 1033 | continue; | ||
| 1034 | break; | ||
| 1035 | } | ||
| 986 | sym = elf->symtab_start + r_sym; | 1036 | sym = elf->symtab_start + r_sym; |
| 987 | /* Skip special sections */ | 1037 | /* Skip special sections */ |
| 988 | if (sym->st_shndx >= SHN_LORESERVE) | 1038 | if (sym->st_shndx >= SHN_LORESERVE) |
| @@ -998,6 +1048,63 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
| 998 | } | 1048 | } |
| 999 | } | 1049 | } |
| 1000 | 1050 | ||
| 1051 | /* | ||
| 1052 | * Identify sections from which references to either a | ||
| 1053 | * .init or a .exit section is OK. | ||
| 1054 | * | ||
| 1055 | * [OPD] Keith Ownes <kaos@sgi.com> commented: | ||
| 1056 | * For our future {in}sanity, add a comment that this is the ppc .opd | ||
| 1057 | * section, not the ia64 .opd section. | ||
| 1058 | * ia64 .opd should not point to discarded sections. | ||
| 1059 | * [.rodata] like for .init.text we ignore .rodata references -same reason | ||
| 1060 | */ | ||
| 1061 | static int initexit_section_ref_ok(const char *name) | ||
| 1062 | { | ||
| 1063 | const char **s; | ||
| 1064 | /* Absolute section names */ | ||
| 1065 | const char *namelist1[] = { | ||
| 1066 | "__bug_table", /* used by powerpc for BUG() */ | ||
| 1067 | "__ex_table", | ||
| 1068 | ".altinstructions", | ||
| 1069 | ".cranges", /* used by sh64 */ | ||
| 1070 | ".fixup", | ||
| 1071 | ".machvec", /* ia64 + powerpc uses these */ | ||
| 1072 | ".machine.desc", | ||
| 1073 | ".opd", /* See comment [OPD] */ | ||
| 1074 | ".parainstructions", | ||
| 1075 | ".pdr", | ||
| 1076 | ".plt", /* seen on ARCH=um build on x86_64. Harmless */ | ||
| 1077 | ".smp_locks", | ||
| 1078 | ".stab", | ||
| 1079 | NULL | ||
| 1080 | }; | ||
| 1081 | /* Start of section names */ | ||
| 1082 | const char *namelist2[] = { | ||
| 1083 | ".debug", | ||
| 1084 | ".eh_frame", | ||
| 1085 | ".note", /* ignore ELF notes - may contain anything */ | ||
| 1086 | ".got", /* powerpc - global offset table */ | ||
| 1087 | ".toc", /* powerpc - table of contents */ | ||
| 1088 | NULL | ||
| 1089 | }; | ||
| 1090 | /* part of section name */ | ||
| 1091 | const char *namelist3 [] = { | ||
| 1092 | ".unwind", /* Sample: IA_64.unwind.exit.text */ | ||
| 1093 | NULL | ||
| 1094 | }; | ||
| 1095 | |||
| 1096 | for (s = namelist1; *s; s++) | ||
| 1097 | if (strcmp(*s, name) == 0) | ||
| 1098 | return 1; | ||
| 1099 | for (s = namelist2; *s; s++) | ||
| 1100 | if (strncmp(*s, name, strlen(*s)) == 0) | ||
| 1101 | return 1; | ||
| 1102 | for (s = namelist3; *s; s++) | ||
| 1103 | if (strstr(name, *s) != NULL) | ||
| 1104 | return 1; | ||
| 1105 | return 0; | ||
| 1106 | } | ||
| 1107 | |||
| 1001 | /** | 1108 | /** |
| 1002 | * Functions used only during module init is marked __init and is stored in | 1109 | * Functions used only during module init is marked __init and is stored in |
| 1003 | * a .init.text section. Likewise data is marked __initdata and stored in | 1110 | * a .init.text section. Likewise data is marked __initdata and stored in |
| @@ -1014,7 +1121,7 @@ static int init_section(const char *name) | |||
| 1014 | return 0; | 1121 | return 0; |
| 1015 | } | 1122 | } |
| 1016 | 1123 | ||
| 1017 | /** | 1124 | /* |
| 1018 | * Identify sections from which references to a .init section is OK. | 1125 | * Identify sections from which references to a .init section is OK. |
| 1019 | * | 1126 | * |
| 1020 | * Unfortunately references to read only data that referenced .init | 1127 | * Unfortunately references to read only data that referenced .init |
| @@ -1028,48 +1135,31 @@ static int init_section(const char *name) | |||
| 1028 | * | 1135 | * |
| 1029 | * where vgacon_startup is __init. If you want to wade through the false | 1136 | * where vgacon_startup is __init. If you want to wade through the false |
| 1030 | * positives, take out the check for rodata. | 1137 | * positives, take out the check for rodata. |
| 1031 | **/ | 1138 | */ |
| 1032 | static int init_section_ref_ok(const char *name) | 1139 | static int init_section_ref_ok(const char *name) |
| 1033 | { | 1140 | { |
| 1034 | const char **s; | 1141 | const char **s; |
| 1035 | /* Absolute section names */ | 1142 | /* Absolute section names */ |
| 1036 | const char *namelist1[] = { | 1143 | const char *namelist1[] = { |
| 1037 | ".init", | 1144 | "__dbe_table", /* MIPS generate these */ |
| 1038 | ".opd", /* see comment [OPD] at exit_section_ref_ok() */ | ||
| 1039 | ".toc1", /* used by ppc64 */ | ||
| 1040 | ".stab", | ||
| 1041 | ".data.rel.ro", /* used by parisc64 */ | ||
| 1042 | ".parainstructions", | ||
| 1043 | ".text.lock", | ||
| 1044 | "__bug_table", /* used by powerpc for BUG() */ | ||
| 1045 | ".pci_fixup_header", | ||
| 1046 | ".pci_fixup_final", | ||
| 1047 | ".pdr", | ||
| 1048 | "__param", | ||
| 1049 | "__ex_table", | ||
| 1050 | ".fixup", | ||
| 1051 | ".smp_locks", | ||
| 1052 | ".plt", /* seen on ARCH=um build on x86_64. Harmless */ | ||
| 1053 | "__ftr_fixup", /* powerpc cpu feature fixup */ | 1145 | "__ftr_fixup", /* powerpc cpu feature fixup */ |
| 1054 | "__fw_ftr_fixup", /* powerpc firmware feature fixup */ | 1146 | "__fw_ftr_fixup", /* powerpc firmware feature fixup */ |
| 1055 | ".cranges", /* used by sh64 */ | 1147 | "__param", |
| 1148 | ".data.rel.ro", /* used by parisc64 */ | ||
| 1149 | ".init", | ||
| 1150 | ".text.lock", | ||
| 1056 | NULL | 1151 | NULL |
| 1057 | }; | 1152 | }; |
| 1058 | /* Start of section names */ | 1153 | /* Start of section names */ |
| 1059 | const char *namelist2[] = { | 1154 | const char *namelist2[] = { |
| 1060 | ".init.", | 1155 | ".init.", |
| 1061 | ".altinstructions", | 1156 | ".pci_fixup", |
| 1062 | ".eh_frame", | ||
| 1063 | ".debug", | ||
| 1064 | ".parainstructions", | ||
| 1065 | ".rodata", | 1157 | ".rodata", |
| 1066 | NULL | 1158 | NULL |
| 1067 | }; | 1159 | }; |
| 1068 | /* part of section name */ | 1160 | |
| 1069 | const char *namelist3 [] = { | 1161 | if (initexit_section_ref_ok(name)) |
| 1070 | ".unwind", /* sample: IA_64.unwind.init.text */ | 1162 | return 1; |
| 1071 | NULL | ||
| 1072 | }; | ||
| 1073 | 1163 | ||
| 1074 | for (s = namelist1; *s; s++) | 1164 | for (s = namelist1; *s; s++) |
| 1075 | if (strcmp(*s, name) == 0) | 1165 | if (strcmp(*s, name) == 0) |
| @@ -1077,9 +1167,10 @@ static int init_section_ref_ok(const char *name) | |||
| 1077 | for (s = namelist2; *s; s++) | 1167 | for (s = namelist2; *s; s++) |
| 1078 | if (strncmp(*s, name, strlen(*s)) == 0) | 1168 | if (strncmp(*s, name, strlen(*s)) == 0) |
| 1079 | return 1; | 1169 | return 1; |
| 1080 | for (s = namelist3; *s; s++) | 1170 | |
| 1081 | if (strstr(name, *s) != NULL) | 1171 | /* If section name ends with ".init" we allow references |
| 1082 | return 1; | 1172 | * as is the case with .initcallN.init, .early_param.init, .taglist.init etc |
| 1173 | */ | ||
| 1083 | if (strrcmp(name, ".init") == 0) | 1174 | if (strrcmp(name, ".init") == 0) |
| 1084 | return 1; | 1175 | return 1; |
| 1085 | return 0; | 1176 | return 0; |
| @@ -1104,58 +1195,25 @@ static int exit_section(const char *name) | |||
| 1104 | 1195 | ||
| 1105 | /* | 1196 | /* |
| 1106 | * Identify sections from which references to a .exit section is OK. | 1197 | * Identify sections from which references to a .exit section is OK. |
| 1107 | * | 1198 | */ |
| 1108 | * [OPD] Keith Ownes <kaos@sgi.com> commented: | ||
| 1109 | * For our future {in}sanity, add a comment that this is the ppc .opd | ||
| 1110 | * section, not the ia64 .opd section. | ||
| 1111 | * ia64 .opd should not point to discarded sections. | ||
| 1112 | * [.rodata] like for .init.text we ignore .rodata references -same reason | ||
| 1113 | **/ | ||
| 1114 | static int exit_section_ref_ok(const char *name) | 1199 | static int exit_section_ref_ok(const char *name) |
| 1115 | { | 1200 | { |
| 1116 | const char **s; | 1201 | const char **s; |
| 1117 | /* Absolute section names */ | 1202 | /* Absolute section names */ |
| 1118 | const char *namelist1[] = { | 1203 | const char *namelist1[] = { |
| 1119 | ".exit.text", | ||
| 1120 | ".exit.data", | 1204 | ".exit.data", |
| 1121 | ".init.text", | 1205 | ".exit.text", |
| 1122 | ".rodata", | ||
| 1123 | ".opd", /* See comment [OPD] */ | ||
| 1124 | ".toc1", /* used by ppc64 */ | ||
| 1125 | ".altinstructions", | ||
| 1126 | ".pdr", | ||
| 1127 | "__bug_table", /* used by powerpc for BUG() */ | ||
| 1128 | ".exitcall.exit", | 1206 | ".exitcall.exit", |
| 1129 | ".eh_frame", | 1207 | ".rodata", |
| 1130 | ".parainstructions", | ||
| 1131 | ".stab", | ||
| 1132 | "__ex_table", | ||
| 1133 | ".fixup", | ||
| 1134 | ".smp_locks", | ||
| 1135 | ".plt", /* seen on ARCH=um build on x86_64. Harmless */ | ||
| 1136 | ".cranges", /* used by sh64 */ | ||
| 1137 | NULL | ||
| 1138 | }; | ||
| 1139 | /* Start of section names */ | ||
| 1140 | const char *namelist2[] = { | ||
| 1141 | ".debug", | ||
| 1142 | NULL | ||
| 1143 | }; | ||
| 1144 | /* part of section name */ | ||
| 1145 | const char *namelist3 [] = { | ||
| 1146 | ".unwind", /* Sample: IA_64.unwind.exit.text */ | ||
| 1147 | NULL | 1208 | NULL |
| 1148 | }; | 1209 | }; |
| 1149 | 1210 | ||
| 1211 | if (initexit_section_ref_ok(name)) | ||
| 1212 | return 1; | ||
| 1213 | |||
| 1150 | for (s = namelist1; *s; s++) | 1214 | for (s = namelist1; *s; s++) |
| 1151 | if (strcmp(*s, name) == 0) | 1215 | if (strcmp(*s, name) == 0) |
| 1152 | return 1; | 1216 | return 1; |
| 1153 | for (s = namelist2; *s; s++) | ||
| 1154 | if (strncmp(*s, name, strlen(*s)) == 0) | ||
| 1155 | return 1; | ||
| 1156 | for (s = namelist3; *s; s++) | ||
| 1157 | if (strstr(name, *s) != NULL) | ||
| 1158 | return 1; | ||
| 1159 | return 0; | 1217 | return 0; |
| 1160 | } | 1218 | } |
| 1161 | 1219 | ||
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 0858caa9c03f..4156dd34c5de 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h | |||
| @@ -60,6 +60,9 @@ typedef union | |||
| 60 | #define ELF64_MIPS_R_SYM(i) \ | 60 | #define ELF64_MIPS_R_SYM(i) \ |
| 61 | ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym) | 61 | ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym) |
| 62 | 62 | ||
| 63 | #define ELF64_MIPS_R_TYPE(i) \ | ||
| 64 | ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1) | ||
| 65 | |||
| 63 | #if KERNEL_ELFDATA != HOST_ELFDATA | 66 | #if KERNEL_ELFDATA != HOST_ELFDATA |
| 64 | 67 | ||
| 65 | static inline void __endian(const void *src, void *dest, unsigned int size) | 68 | static inline void __endian(const void *src, void *dest, unsigned int size) |
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index 8365db6cfe06..7abc07f0fcd2 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c | |||
| @@ -498,7 +498,9 @@ int main (int argc, char *argv[]) | |||
| 498 | exit(1); | 498 | exit(1); |
| 499 | } | 499 | } |
| 500 | 500 | ||
| 501 | if (! (cpio_list = fopen(argv[1], "r"))) { | 501 | if (!strcmp(argv[1], "-")) |
| 502 | cpio_list = stdin; | ||
| 503 | else if (! (cpio_list = fopen(argv[1], "r"))) { | ||
| 502 | fprintf(stderr, "ERROR: unable to open '%s': %s\n\n", | 504 | fprintf(stderr, "ERROR: unable to open '%s': %s\n\n", |
| 503 | argv[1], strerror(errno)); | 505 | argv[1], strerror(errno)); |
| 504 | usage(argv[0]); | 506 | usage(argv[0]); |
