Kbuild updates for v5.20
- Remove the support for -O3 (CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3) - Fix error of rpm-pkg cross-builds - Support riscv for checkstack tool - Re-enable -Wformwat warnings for Clang - Clean up modpost, Makefiles, and misc scripts -----BEGIN PGP SIGNATURE----- iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmLykZUVHG1hc2FoaXJv eUBrZXJuZWwub3JnAAoJED2LAQed4NsG4QoP/3Ooac5+kmcm9nT+fwtuQkFMPDhW /5ipDgE8W6kwbGSZX7/KD/3otiUhyhhlUjh1tUHpl+WEoy9Q1orUzbyOzTQW0QYH zdGazuDBsTPa35Vmow3vGUyX1FdRNKsHuDXC1M2BBLZK05OEjyNMxgi6NowE/XnK nFVAdZgu6HYfym/L5FDuXEmM1EYiAcPZL37+rBAd5mVCEyDk3rW2TxDa05Gs/8dr 7QJ9rOKPS7+Hs/gc7w56z91eBzvWOhLjTcKFsqOuL3Yd1oFIwExAhaxo3TRUkp8i VBYKfty+9tXPxNNzKHBq4U9gONkuwQEQu3wOQbSKJQblkS5Sq2wfXH4kQoyCAZIB 5+lsI4idHnD1ZBpOjYxxDrIY6qD+eb/xbxa+AxILoFOK8P1uEn7IHAtwLAg9BzT0 NXdTd8W63D/5F6hVOJNqK8TPupINcWdXcvFvgz6q+Q6l8EDoVnsmSUP3F1qlJ0DI WhtKhX1CI1PC2T/8ruKJWfPTi6foHhzu4euYWuqUzMmlkhLbp9yHYDDxDN9Li2bh eT/Qy2oWHraLfXvmfhuE9SS0FrQgNtwtmPCVIn7JZTcji9JCt4ax7Erq3ufhG1BR oT1X4M1iangjILbZXJlrrS1qz3DeV84pjjR0TF/56ifqskRJPOPrfHnrQ0m3aMnh TDSweoE1ah1BcAlz =9kds -----END PGP SIGNATURE----- Merge tag 'kbuild-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild updates from Masahiro Yamada: - Remove the support for -O3 (CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3) - Fix error of rpm-pkg cross-builds - Support riscv for checkstack tool - Re-enable -Wformwat warnings for Clang - Clean up modpost, Makefiles, and misc scripts * tag 'kbuild-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (30 commits) modpost: remove .symbol_white_list field entirely modpost: remove unneeded .symbol_white_list initializers modpost: add PATTERNS() helper macro modpost: shorten warning messages in report_sec_mismatch() Revert "Kbuild, lto, workaround: Don't warn for initcall_reference in modpost" modpost: use more reliable way to get fromsec in section_rel(a)() modpost: add array range check to sec_name() modpost: refactor get_secindex() kbuild: set EXIT trap before creating temporary directory modpost: remove unused Elf_Sword macro Makefile.extrawarn: re-enable -Wformat for clang kbuild: add dtbs_prepare target kconfig: Qt5: tell the user which packages are required modpost: use sym_get_data() to get module device_table data modpost: drop executable ELF support checkstack: add riscv support for scripts/checkstack.pl kconfig: shorten the temporary directory name for cc-option scripts: headers_install.sh: Update config leak ignore entries kbuild: error out if $(INSTALL_MOD_PATH) contains % or : kbuild: error out if $(KBUILD_EXTMOD) contains % or : ...
This commit is contained in:
commit
0af5cb349a
|
@ -672,7 +672,7 @@ Future kconfig work
|
||||||
Work on kconfig is welcomed on both areas of clarifying semantics and on
|
Work on kconfig is welcomed on both areas of clarifying semantics and on
|
||||||
evaluating the use of a full SAT solver for it. A full SAT solver can be
|
evaluating the use of a full SAT solver for it. A full SAT solver can be
|
||||||
desirable to enable more complex dependency mappings and / or queries,
|
desirable to enable more complex dependency mappings and / or queries,
|
||||||
for instance on possible use case for a SAT solver could be that of handling
|
for instance one possible use case for a SAT solver could be that of handling
|
||||||
the current known recursive dependency issues. It is not known if this would
|
the current known recursive dependency issues. It is not known if this would
|
||||||
address such issues but such evaluation is desirable. If support for a full SAT
|
address such issues but such evaluation is desirable. If support for a full SAT
|
||||||
solver proves too complex or that it cannot address recursive dependency issues
|
solver proves too complex or that it cannot address recursive dependency issues
|
||||||
|
|
|
@ -4783,7 +4783,6 @@ L: keyrings@vger.kernel.org
|
||||||
S: Maintained
|
S: Maintained
|
||||||
F: Documentation/admin-guide/module-signing.rst
|
F: Documentation/admin-guide/module-signing.rst
|
||||||
F: certs/
|
F: certs/
|
||||||
F: scripts/check-blacklist-hashes.awk
|
|
||||||
F: scripts/sign-file.c
|
F: scripts/sign-file.c
|
||||||
F: tools/certs/
|
F: tools/certs/
|
||||||
|
|
||||||
|
|
18
Makefile
18
Makefile
|
@ -129,6 +129,9 @@ endif
|
||||||
$(if $(word 2, $(KBUILD_EXTMOD)), \
|
$(if $(word 2, $(KBUILD_EXTMOD)), \
|
||||||
$(error building multiple external modules is not supported))
|
$(error building multiple external modules is not supported))
|
||||||
|
|
||||||
|
$(foreach x, % :, $(if $(findstring $x, $(KBUILD_EXTMOD)), \
|
||||||
|
$(error module directory path cannot contain '$x')))
|
||||||
|
|
||||||
# Remove trailing slashes
|
# Remove trailing slashes
|
||||||
ifneq ($(filter %/, $(KBUILD_EXTMOD)),)
|
ifneq ($(filter %/, $(KBUILD_EXTMOD)),)
|
||||||
KBUILD_EXTMOD := $(shell dirname $(KBUILD_EXTMOD).)
|
KBUILD_EXTMOD := $(shell dirname $(KBUILD_EXTMOD).)
|
||||||
|
@ -755,8 +758,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
|
||||||
|
|
||||||
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
|
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
|
||||||
KBUILD_CFLAGS += -O2
|
KBUILD_CFLAGS += -O2
|
||||||
else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
|
|
||||||
KBUILD_CFLAGS += -O3
|
|
||||||
else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
||||||
KBUILD_CFLAGS += -Os
|
KBUILD_CFLAGS += -Os
|
||||||
endif
|
endif
|
||||||
|
@ -1370,16 +1371,21 @@ endif
|
||||||
|
|
||||||
ifneq ($(dtstree),)
|
ifneq ($(dtstree),)
|
||||||
|
|
||||||
%.dtb: include/config/kernel.release scripts_dtc
|
%.dtb: dtbs_prepare
|
||||||
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
|
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
|
||||||
|
|
||||||
%.dtbo: include/config/kernel.release scripts_dtc
|
%.dtbo: dtbs_prepare
|
||||||
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
|
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
|
||||||
|
|
||||||
PHONY += dtbs dtbs_install dtbs_check
|
PHONY += dtbs dtbs_prepare dtbs_install dtbs_check
|
||||||
dtbs: include/config/kernel.release scripts_dtc
|
dtbs: dtbs_prepare
|
||||||
$(Q)$(MAKE) $(build)=$(dtstree)
|
$(Q)$(MAKE) $(build)=$(dtstree)
|
||||||
|
|
||||||
|
# include/config/kernel.release is actually needed when installing DTBs because
|
||||||
|
# INSTALL_DTBS_PATH contains $(KERNELRELEASE). However, we do not want to make
|
||||||
|
# dtbs_install depend on it as dtbs_install may run as root.
|
||||||
|
dtbs_prepare: include/config/kernel.release scripts_dtc
|
||||||
|
|
||||||
ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
|
ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
|
||||||
export CHECK_DTBS=y
|
export CHECK_DTBS=y
|
||||||
dtbs: dt_binding_check
|
dtbs: dt_binding_check
|
||||||
|
|
|
@ -9,7 +9,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_VM_EVENT_COUNTERS is not set
|
# CONFIG_VM_EVENT_COUNTERS is not set
|
||||||
|
|
|
@ -9,7 +9,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_VM_EVENT_COUNTERS is not set
|
# CONFIG_VM_EVENT_COUNTERS is not set
|
||||||
|
|
|
@ -9,7 +9,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_VM_EVENT_COUNTERS is not set
|
# CONFIG_VM_EVENT_COUNTERS is not set
|
||||||
|
|
|
@ -11,7 +11,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_EXPERT=y
|
CONFIG_EXPERT=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_COMPAT_BRK is not set
|
# CONFIG_COMPAT_BRK is not set
|
||||||
|
|
|
@ -11,7 +11,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_VM_EVENT_COUNTERS is not set
|
# CONFIG_VM_EVENT_COUNTERS is not set
|
||||||
|
|
|
@ -9,7 +9,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_BLK_DEV_RAM=y
|
CONFIG_BLK_DEV_RAM=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_VM_EVENT_COUNTERS is not set
|
# CONFIG_VM_EVENT_COUNTERS is not set
|
||||||
|
|
|
@ -11,7 +11,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_KALLSYMS_ALL=y
|
CONFIG_KALLSYMS_ALL=y
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
|
|
|
@ -10,7 +10,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_KALLSYMS_ALL=y
|
CONFIG_KALLSYMS_ALL=y
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
|
|
|
@ -10,7 +10,6 @@ CONFIG_NAMESPACES=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_KALLSYMS_ALL=y
|
CONFIG_KALLSYMS_ALL=y
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
|
|
|
@ -8,7 +8,6 @@ CONFIG_IKCONFIG_PROC=y
|
||||||
# CONFIG_UTS_NS is not set
|
# CONFIG_UTS_NS is not set
|
||||||
# CONFIG_PID_NS is not set
|
# CONFIG_PID_NS is not set
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_COMPAT_BRK is not set
|
# CONFIG_COMPAT_BRK is not set
|
||||||
CONFIG_KPROBES=y
|
CONFIG_KPROBES=y
|
||||||
|
|
|
@ -14,7 +14,6 @@ CONFIG_INITRAMFS_SOURCE="../tb10x-rootfs.cpio"
|
||||||
CONFIG_INITRAMFS_ROOT_UID=2100
|
CONFIG_INITRAMFS_ROOT_UID=2100
|
||||||
CONFIG_INITRAMFS_ROOT_GID=501
|
CONFIG_INITRAMFS_ROOT_GID=501
|
||||||
# CONFIG_RD_GZIP is not set
|
# CONFIG_RD_GZIP is not set
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_KALLSYMS_ALL=y
|
CONFIG_KALLSYMS_ALL=y
|
||||||
# CONFIG_AIO is not set
|
# CONFIG_AIO is not set
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
|
|
|
@ -4,7 +4,6 @@ CONFIG_HIGH_RES_TIMERS=y
|
||||||
CONFIG_IKCONFIG=y
|
CONFIG_IKCONFIG=y
|
||||||
CONFIG_IKCONFIG_PROC=y
|
CONFIG_IKCONFIG_PROC=y
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_VM_EVENT_COUNTERS is not set
|
# CONFIG_VM_EVENT_COUNTERS is not set
|
||||||
|
|
|
@ -4,7 +4,6 @@ CONFIG_HIGH_RES_TIMERS=y
|
||||||
CONFIG_IKCONFIG=y
|
CONFIG_IKCONFIG=y
|
||||||
CONFIG_IKCONFIG_PROC=y
|
CONFIG_IKCONFIG_PROC=y
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y
|
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
CONFIG_PERF_EVENTS=y
|
CONFIG_PERF_EVENTS=y
|
||||||
# CONFIG_VM_EVENT_COUNTERS is not set
|
# CONFIG_VM_EVENT_COUNTERS is not set
|
||||||
|
|
|
@ -4,24 +4,22 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o
|
obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o
|
||||||
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o
|
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o blacklist_hashes.o
|
||||||
obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o
|
obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o
|
||||||
ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),)
|
|
||||||
|
|
||||||
$(obj)/blacklist_hashes.o: $(obj)/blacklist_hash_list
|
$(obj)/blacklist_hashes.o: $(obj)/blacklist_hash_list
|
||||||
CFLAGS_blacklist_hashes.o := -I $(obj)
|
CFLAGS_blacklist_hashes.o := -I $(obj)
|
||||||
|
|
||||||
quiet_cmd_check_and_copy_blacklist_hash_list = GEN $@
|
quiet_cmd_check_and_copy_blacklist_hash_list = GEN $@
|
||||||
cmd_check_and_copy_blacklist_hash_list = \
|
cmd_check_and_copy_blacklist_hash_list = \
|
||||||
$(AWK) -f $(srctree)/scripts/check-blacklist-hashes.awk $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) >&2; \
|
$(if $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST), \
|
||||||
cat $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) > $@
|
$(AWK) -f $(srctree)/$(src)/check-blacklist-hashes.awk $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) >&2; \
|
||||||
|
{ cat $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST); echo $(comma) NULL; } > $@, \
|
||||||
|
echo NULL > $@)
|
||||||
|
|
||||||
$(obj)/blacklist_hash_list: $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) FORCE
|
$(obj)/blacklist_hash_list: $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) FORCE
|
||||||
$(call if_changed,check_and_copy_blacklist_hash_list)
|
$(call if_changed,check_and_copy_blacklist_hash_list)
|
||||||
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o
|
|
||||||
else
|
|
||||||
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
|
|
||||||
endif
|
|
||||||
targets += blacklist_hash_list
|
targets += blacklist_hash_list
|
||||||
|
|
||||||
quiet_cmd_extract_certs = CERT $@
|
quiet_cmd_extract_certs = CERT $@
|
||||||
|
|
|
@ -3,5 +3,4 @@
|
||||||
|
|
||||||
const char __initconst *const blacklist_hashes[] = {
|
const char __initconst *const blacklist_hashes[] = {
|
||||||
#include "blacklist_hash_list"
|
#include "blacklist_hash_list"
|
||||||
, NULL
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
|
||||||
#include "blacklist.h"
|
|
||||||
|
|
||||||
const char __initconst *const blacklist_hashes[] = {
|
|
||||||
NULL
|
|
||||||
};
|
|
16
init/Kconfig
16
init/Kconfig
|
@ -1411,13 +1411,6 @@ config CC_OPTIMIZE_FOR_PERFORMANCE
|
||||||
with the "-O2" compiler flag for best performance and most
|
with the "-O2" compiler flag for best performance and most
|
||||||
helpful compile-time warnings.
|
helpful compile-time warnings.
|
||||||
|
|
||||||
config CC_OPTIMIZE_FOR_PERFORMANCE_O3
|
|
||||||
bool "Optimize more for performance (-O3)"
|
|
||||||
depends on ARC
|
|
||||||
help
|
|
||||||
Choosing this option will pass "-O3" to your compiler to optimize
|
|
||||||
the kernel yet more for performance.
|
|
||||||
|
|
||||||
config CC_OPTIMIZE_FOR_SIZE
|
config CC_OPTIMIZE_FOR_SIZE
|
||||||
bool "Optimize for size (-Os)"
|
bool "Optimize for size (-Os)"
|
||||||
help
|
help
|
||||||
|
@ -1733,16 +1726,17 @@ config KALLSYMS_ALL
|
||||||
help
|
help
|
||||||
Normally kallsyms only contains the symbols of functions for nicer
|
Normally kallsyms only contains the symbols of functions for nicer
|
||||||
OOPS messages and backtraces (i.e., symbols from the text and inittext
|
OOPS messages and backtraces (i.e., symbols from the text and inittext
|
||||||
sections). This is sufficient for most cases. And only in very rare
|
sections). This is sufficient for most cases. And only if you want to
|
||||||
cases (e.g., when a debugger is used) all symbols are required (e.g.,
|
enable kernel live patching, or other less common use cases (e.g.,
|
||||||
names of variables from the data sections, etc).
|
when a debugger is used) all symbols are required (i.e., names of
|
||||||
|
variables from the data sections, etc).
|
||||||
|
|
||||||
This option makes sure that all symbols are loaded into the kernel
|
This option makes sure that all symbols are loaded into the kernel
|
||||||
image (i.e., symbols from all sections) in cost of increased kernel
|
image (i.e., symbols from all sections) in cost of increased kernel
|
||||||
size (depending on the kernel configuration, it may be 300KiB or
|
size (depending on the kernel configuration, it may be 300KiB or
|
||||||
something like this).
|
something like this).
|
||||||
|
|
||||||
Say N unless you really need all symbols.
|
Say N unless you really need all symbols, or kernel live patching.
|
||||||
|
|
||||||
config KALLSYMS_ABSOLUTE_PERCPU
|
config KALLSYMS_ABSOLUTE_PERCPU
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y)
|
||||||
|
|
||||||
# $(cc-option,<flag>)
|
# $(cc-option,<flag>)
|
||||||
# Return y if the compiler supports <flag>, n otherwise
|
# Return y if the compiler supports <flag>, n otherwise
|
||||||
cc-option = $(success,mkdir .tmp_$$$$; trap "rm -rf .tmp_$$$$" EXIT; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$$$/tmp.o)
|
cc-option = $(success,trap "rm -rf .tmp_$$" EXIT; mkdir .tmp_$$; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$/tmp.o)
|
||||||
|
|
||||||
# $(ld-option,<flag>)
|
# $(ld-option,<flag>)
|
||||||
# Return y if the linker supports <flag>, n otherwise
|
# Return y if the linker supports <flag>, n otherwise
|
||||||
|
|
|
@ -358,9 +358,8 @@ $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
|
||||||
|
|
||||||
quiet_cmd_ar_builtin = AR $@
|
quiet_cmd_ar_builtin = AR $@
|
||||||
cmd_ar_builtin = rm -f $@; \
|
cmd_ar_builtin = rm -f $@; \
|
||||||
echo $(patsubst $(obj)/%,%,$(real-prereqs)) | \
|
$(if $(real-prereqs), printf "$(obj)/%s " $(patsubst $(obj)/%,%,$(real-prereqs)) | xargs) \
|
||||||
sed -E 's:([^ ]+):$(obj)/\1:g' | \
|
$(AR) cDPrST $@
|
||||||
xargs $(AR) cDPrST $@
|
|
||||||
|
|
||||||
$(obj)/built-in.a: $(real-obj-y) FORCE
|
$(obj)/built-in.a: $(real-obj-y) FORCE
|
||||||
$(call if_changed,ar_builtin)
|
$(call if_changed,ar_builtin)
|
||||||
|
|
|
@ -21,8 +21,8 @@ TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
|
||||||
# automatically cleaned up.
|
# automatically cleaned up.
|
||||||
try-run = $(shell set -e; \
|
try-run = $(shell set -e; \
|
||||||
TMP=$(TMPOUT)/tmp; \
|
TMP=$(TMPOUT)/tmp; \
|
||||||
mkdir -p $(TMPOUT); \
|
|
||||||
trap "rm -rf $(TMPOUT)" EXIT; \
|
trap "rm -rf $(TMPOUT)" EXIT; \
|
||||||
|
mkdir -p $(TMPOUT); \
|
||||||
if ($(1)) >/dev/null 2>&1; \
|
if ($(1)) >/dev/null 2>&1; \
|
||||||
then echo "$(2)"; \
|
then echo "$(2)"; \
|
||||||
else echo "$(3)"; \
|
else echo "$(3)"; \
|
||||||
|
|
|
@ -47,7 +47,6 @@ else
|
||||||
|
|
||||||
ifdef CONFIG_CC_IS_CLANG
|
ifdef CONFIG_CC_IS_CLANG
|
||||||
KBUILD_CFLAGS += -Wno-initializer-overrides
|
KBUILD_CFLAGS += -Wno-initializer-overrides
|
||||||
KBUILD_CFLAGS += -Wno-format
|
|
||||||
KBUILD_CFLAGS += -Wno-sign-compare
|
KBUILD_CFLAGS += -Wno-sign-compare
|
||||||
KBUILD_CFLAGS += -Wno-format-zero-length
|
KBUILD_CFLAGS += -Wno-format-zero-length
|
||||||
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
|
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
|
||||||
|
|
|
@ -18,6 +18,9 @@ INSTALL_MOD_DIR ?= extra
|
||||||
dst := $(MODLIB)/$(INSTALL_MOD_DIR)
|
dst := $(MODLIB)/$(INSTALL_MOD_DIR)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(foreach x, % :, $(if $(findstring $x, $(dst)), \
|
||||||
|
$(error module installation path cannot contain '$x')))
|
||||||
|
|
||||||
suffix-y :=
|
suffix-y :=
|
||||||
suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz
|
suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz
|
||||||
suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
|
suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
|
||||||
|
|
|
@ -56,7 +56,7 @@ rpm-pkg:
|
||||||
$(MAKE) clean
|
$(MAKE) clean
|
||||||
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
|
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
|
||||||
$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
|
$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
|
||||||
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz \
|
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \
|
||||||
--define='_smp_mflags %{nil}'
|
--define='_smp_mflags %{nil}'
|
||||||
|
|
||||||
# binrpm-pkg
|
# binrpm-pkg
|
||||||
|
@ -66,7 +66,7 @@ binrpm-pkg:
|
||||||
$(MAKE) -f $(srctree)/Makefile
|
$(MAKE) -f $(srctree)/Makefile
|
||||||
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
|
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
|
||||||
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
|
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
|
||||||
$(UTS_MACHINE) -bb $(objtree)/binkernel.spec
|
$(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec
|
||||||
|
|
||||||
PHONY += deb-pkg
|
PHONY += deb-pkg
|
||||||
deb-pkg:
|
deb-pkg:
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
# AArch64, PARISC ports by Kyle McMartin
|
# AArch64, PARISC ports by Kyle McMartin
|
||||||
# sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk>
|
# sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk>
|
||||||
# ppc64le port by Breno Leitao <leitao@debian.org>
|
# ppc64le port by Breno Leitao <leitao@debian.org>
|
||||||
|
# riscv port by Wadim Mueller <wafgo01@gmail.com>
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# objdump -d vmlinux | scripts/checkstack.pl [arch]
|
# objdump -d vmlinux | scripts/checkstack.pl [arch]
|
||||||
|
@ -108,6 +109,9 @@ my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack);
|
||||||
} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
|
} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
|
||||||
# f0019d10: 9d e3 bf 90 save %sp, -112, %sp
|
# f0019d10: 9d e3 bf 90 save %sp, -112, %sp
|
||||||
$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
|
$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
|
||||||
|
} elsif ($arch =~ /^riscv(64)?$/) {
|
||||||
|
#ffffffff8036e868: c2010113 addi sp,sp,-992
|
||||||
|
$re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
|
||||||
} else {
|
} else {
|
||||||
print("wrong or unknown architecture \"$arch\"\n");
|
print("wrong or unknown architecture \"$arch\"\n");
|
||||||
exit
|
exit
|
||||||
|
|
|
@ -96,12 +96,8 @@ fi
|
||||||
|
|
||||||
# To set GCC_PLUGINS
|
# To set GCC_PLUGINS
|
||||||
if arg_contain -print-file-name=plugin "$@"; then
|
if arg_contain -print-file-name=plugin "$@"; then
|
||||||
plugin_dir=$(mktemp -d)
|
# Use $0 to find the in-tree dummy directory
|
||||||
|
echo "$(dirname "$(readlink -f "$0")")/dummy-plugin-dir"
|
||||||
mkdir -p $plugin_dir/include
|
|
||||||
touch $plugin_dir/include/plugin-version.h
|
|
||||||
|
|
||||||
echo $plugin_dir
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ configs=$(sed -e '
|
||||||
#
|
#
|
||||||
# The format is <file-name>:<CONFIG-option> in each line.
|
# The format is <file-name>:<CONFIG-option> in each line.
|
||||||
config_leak_ignores="
|
config_leak_ignores="
|
||||||
arch/alpha/include/uapi/asm/setup.h:CONFIG_ALPHA_LEGACY_START_ADDRESS
|
|
||||||
arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_16K
|
arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_16K
|
||||||
arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_4K
|
arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_4K
|
||||||
arch/arc/include/uapi/asm/swab.h:CONFIG_ARC_HAS_SWAPE
|
arch/arc/include/uapi/asm/swab.h:CONFIG_ARC_HAS_SWAPE
|
||||||
|
@ -84,7 +83,6 @@ arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_SUPPORT
|
||||||
arch/x86/include/uapi/asm/auxvec.h:CONFIG_IA32_EMULATION
|
arch/x86/include/uapi/asm/auxvec.h:CONFIG_IA32_EMULATION
|
||||||
arch/x86/include/uapi/asm/auxvec.h:CONFIG_X86_64
|
arch/x86/include/uapi/asm/auxvec.h:CONFIG_X86_64
|
||||||
arch/x86/include/uapi/asm/mman.h:CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
|
arch/x86/include/uapi/asm/mman.h:CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
|
||||||
include/uapi/asm-generic/fcntl.h:CONFIG_64BIT
|
|
||||||
include/uapi/linux/atmdev.h:CONFIG_COMPAT
|
include/uapi/linux/atmdev.h:CONFIG_COMPAT
|
||||||
include/uapi/linux/eventpoll.h:CONFIG_PM_SLEEP
|
include/uapi/linux/eventpoll.h:CONFIG_PM_SLEEP
|
||||||
include/uapi/linux/hw_breakpoint.h:CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
|
include/uapi/linux/hw_breakpoint.h:CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
|
||||||
|
|
|
@ -20,5 +20,6 @@ fi
|
||||||
echo >&2 "*"
|
echo >&2 "*"
|
||||||
echo >&2 "* Could not find Qt5 via ${HOSTPKG_CONFIG}."
|
echo >&2 "* Could not find Qt5 via ${HOSTPKG_CONFIG}."
|
||||||
echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH"
|
echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH"
|
||||||
|
echo >&2 "* You need $PKG"
|
||||||
echo >&2 "*"
|
echo >&2 "*"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -1571,9 +1571,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
|
||||||
zeros = calloc(1, sym->st_size);
|
zeros = calloc(1, sym->st_size);
|
||||||
symval = zeros;
|
symval = zeros;
|
||||||
} else {
|
} else {
|
||||||
symval = (void *)info->hdr
|
symval = sym_get_data(info, sym);
|
||||||
+ info->sechdrs[get_secindex(info, sym)].sh_offset
|
|
||||||
+ sym->st_value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First handle the "special" cases */
|
/* First handle the "special" cases */
|
||||||
|
|
|
@ -321,13 +321,10 @@ static void *sym_get_data_by_offset(const struct elf_info *info,
|
||||||
{
|
{
|
||||||
Elf_Shdr *sechdr = &info->sechdrs[secindex];
|
Elf_Shdr *sechdr = &info->sechdrs[secindex];
|
||||||
|
|
||||||
if (info->hdr->e_type != ET_REL)
|
|
||||||
offset -= sechdr->sh_addr;
|
|
||||||
|
|
||||||
return (void *)info->hdr + sechdr->sh_offset + offset;
|
return (void *)info->hdr + sechdr->sh_offset + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
|
void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
|
||||||
{
|
{
|
||||||
return sym_get_data_by_offset(info, get_secindex(info, sym),
|
return sym_get_data_by_offset(info, get_secindex(info, sym),
|
||||||
sym->st_value);
|
sym->st_value);
|
||||||
|
@ -339,8 +336,16 @@ static const char *sech_name(const struct elf_info *info, Elf_Shdr *sechdr)
|
||||||
sechdr->sh_name);
|
sechdr->sh_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *sec_name(const struct elf_info *info, int secindex)
|
static const char *sec_name(const struct elf_info *info, unsigned int secindex)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* If sym->st_shndx is a special section index, there is no
|
||||||
|
* corresponding section header.
|
||||||
|
* Return "" if the index is out of range of info->sechdrs[] array.
|
||||||
|
*/
|
||||||
|
if (secindex >= info->num_sections)
|
||||||
|
return "";
|
||||||
|
|
||||||
return sech_name(info, &info->sechdrs[secindex]);
|
return sech_name(info, &info->sechdrs[secindex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,6 +471,10 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
||||||
sechdrs = (void *)hdr + hdr->e_shoff;
|
sechdrs = (void *)hdr + hdr->e_shoff;
|
||||||
info->sechdrs = sechdrs;
|
info->sechdrs = sechdrs;
|
||||||
|
|
||||||
|
/* modpost only works for relocatable objects */
|
||||||
|
if (hdr->e_type != ET_REL)
|
||||||
|
fatal("%s: not relocatable object.", filename);
|
||||||
|
|
||||||
/* Check if file offset is correct */
|
/* Check if file offset is correct */
|
||||||
if (hdr->e_shoff > info->size) {
|
if (hdr->e_shoff > info->size) {
|
||||||
fatal("section header offset=%lu in file '%s' is bigger than filesize=%zu\n",
|
fatal("section header offset=%lu in file '%s' is bigger than filesize=%zu\n",
|
||||||
|
@ -737,12 +746,18 @@ static bool match(const char *string, const char *const patterns[])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* useful to pass patterns to match() directly */
|
||||||
|
#define PATTERNS(...) \
|
||||||
|
({ \
|
||||||
|
static const char *const patterns[] = {__VA_ARGS__, NULL}; \
|
||||||
|
patterns; \
|
||||||
|
})
|
||||||
|
|
||||||
/* sections that we do not want to do full section mismatch check on */
|
/* sections that we do not want to do full section mismatch check on */
|
||||||
static const char *const section_white_list[] =
|
static const char *const section_white_list[] =
|
||||||
{
|
{
|
||||||
".comment*",
|
".comment*",
|
||||||
".debug*",
|
".debug*",
|
||||||
".cranges", /* sh64 */
|
|
||||||
".zdebug*", /* Compressed debug sections. */
|
".zdebug*", /* Compressed debug sections. */
|
||||||
".GCC.command.line", /* record-gcc-switches */
|
".GCC.command.line", /* record-gcc-switches */
|
||||||
".mdebug*", /* alpha, score, mips etc. */
|
".mdebug*", /* alpha, score, mips etc. */
|
||||||
|
@ -830,28 +845,12 @@ static const char *const init_data_sections[] =
|
||||||
/* all init sections */
|
/* all init sections */
|
||||||
static const char *const init_sections[] = { ALL_INIT_SECTIONS, NULL };
|
static const char *const init_sections[] = { ALL_INIT_SECTIONS, NULL };
|
||||||
|
|
||||||
/* All init and exit sections (code + data) */
|
|
||||||
static const char *const init_exit_sections[] =
|
|
||||||
{ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL };
|
|
||||||
|
|
||||||
/* all text sections */
|
/* all text sections */
|
||||||
static const char *const text_sections[] = { ALL_TEXT_SECTIONS, NULL };
|
static const char *const text_sections[] = { ALL_TEXT_SECTIONS, NULL };
|
||||||
|
|
||||||
/* data section */
|
/* data section */
|
||||||
static const char *const data_sections[] = { DATA_SECTIONS, NULL };
|
static const char *const data_sections[] = { DATA_SECTIONS, NULL };
|
||||||
|
|
||||||
|
|
||||||
/* symbols in .data that may refer to init/exit sections */
|
|
||||||
#define DEFAULT_SYMBOL_WHITE_LIST \
|
|
||||||
"*driver", \
|
|
||||||
"*_template", /* scsi uses *_template a lot */ \
|
|
||||||
"*_timer", /* arm uses ops structures named _timer a lot */ \
|
|
||||||
"*_sht", /* scsi also used *_sht to some extent */ \
|
|
||||||
"*_ops", \
|
|
||||||
"*_probe", \
|
|
||||||
"*_probe_one", \
|
|
||||||
"*_console"
|
|
||||||
|
|
||||||
static const char *const head_sections[] = { ".head.text*", NULL };
|
static const char *const head_sections[] = { ".head.text*", NULL };
|
||||||
static const char *const linker_symbols[] =
|
static const char *const linker_symbols[] =
|
||||||
{ "__init_begin", "_sinittext", "_einittext", NULL };
|
{ "__init_begin", "_sinittext", "_einittext", NULL };
|
||||||
|
@ -883,9 +882,6 @@ enum mismatch {
|
||||||
*
|
*
|
||||||
* @mismatch: Type of mismatch.
|
* @mismatch: Type of mismatch.
|
||||||
*
|
*
|
||||||
* @symbol_white_list: Do not match a relocation to a symbol in this list
|
|
||||||
* even if it is targeting a section in @bad_to_sec.
|
|
||||||
*
|
|
||||||
* @handler: Specific handler to call when a match is found. If NULL,
|
* @handler: Specific handler to call when a match is found. If NULL,
|
||||||
* default_mismatch_handler() will be called.
|
* default_mismatch_handler() will be called.
|
||||||
*
|
*
|
||||||
|
@ -895,7 +891,6 @@ struct sectioncheck {
|
||||||
const char *bad_tosec[20];
|
const char *bad_tosec[20];
|
||||||
const char *good_tosec[20];
|
const char *good_tosec[20];
|
||||||
enum mismatch mismatch;
|
enum mismatch mismatch;
|
||||||
const char *symbol_white_list[20];
|
|
||||||
void (*handler)(const char *modname, struct elf_info *elf,
|
void (*handler)(const char *modname, struct elf_info *elf,
|
||||||
const struct sectioncheck* const mismatch,
|
const struct sectioncheck* const mismatch,
|
||||||
Elf_Rela *r, Elf_Sym *sym, const char *fromsec);
|
Elf_Rela *r, Elf_Sym *sym, const char *fromsec);
|
||||||
|
@ -915,75 +910,61 @@ static const struct sectioncheck sectioncheck[] = {
|
||||||
.fromsec = { TEXT_SECTIONS, NULL },
|
.fromsec = { TEXT_SECTIONS, NULL },
|
||||||
.bad_tosec = { ALL_INIT_SECTIONS, NULL },
|
.bad_tosec = { ALL_INIT_SECTIONS, NULL },
|
||||||
.mismatch = TEXT_TO_ANY_INIT,
|
.mismatch = TEXT_TO_ANY_INIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.fromsec = { DATA_SECTIONS, NULL },
|
.fromsec = { DATA_SECTIONS, NULL },
|
||||||
.bad_tosec = { ALL_XXXINIT_SECTIONS, NULL },
|
.bad_tosec = { ALL_XXXINIT_SECTIONS, NULL },
|
||||||
.mismatch = DATA_TO_ANY_INIT,
|
.mismatch = DATA_TO_ANY_INIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.fromsec = { DATA_SECTIONS, NULL },
|
.fromsec = { DATA_SECTIONS, NULL },
|
||||||
.bad_tosec = { INIT_SECTIONS, NULL },
|
.bad_tosec = { INIT_SECTIONS, NULL },
|
||||||
.mismatch = DATA_TO_ANY_INIT,
|
.mismatch = DATA_TO_ANY_INIT,
|
||||||
.symbol_white_list = {
|
|
||||||
"*_template", "*_timer", "*_sht", "*_ops",
|
|
||||||
"*_probe", "*_probe_one", "*_console", NULL
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.fromsec = { TEXT_SECTIONS, NULL },
|
.fromsec = { TEXT_SECTIONS, NULL },
|
||||||
.bad_tosec = { ALL_EXIT_SECTIONS, NULL },
|
.bad_tosec = { ALL_EXIT_SECTIONS, NULL },
|
||||||
.mismatch = TEXT_TO_ANY_EXIT,
|
.mismatch = TEXT_TO_ANY_EXIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.fromsec = { DATA_SECTIONS, NULL },
|
.fromsec = { DATA_SECTIONS, NULL },
|
||||||
.bad_tosec = { ALL_EXIT_SECTIONS, NULL },
|
.bad_tosec = { ALL_EXIT_SECTIONS, NULL },
|
||||||
.mismatch = DATA_TO_ANY_EXIT,
|
.mismatch = DATA_TO_ANY_EXIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
/* Do not reference init code/data from meminit code/data */
|
/* Do not reference init code/data from meminit code/data */
|
||||||
{
|
{
|
||||||
.fromsec = { ALL_XXXINIT_SECTIONS, NULL },
|
.fromsec = { ALL_XXXINIT_SECTIONS, NULL },
|
||||||
.bad_tosec = { INIT_SECTIONS, NULL },
|
.bad_tosec = { INIT_SECTIONS, NULL },
|
||||||
.mismatch = XXXINIT_TO_SOME_INIT,
|
.mismatch = XXXINIT_TO_SOME_INIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
/* Do not reference exit code/data from memexit code/data */
|
/* Do not reference exit code/data from memexit code/data */
|
||||||
{
|
{
|
||||||
.fromsec = { ALL_XXXEXIT_SECTIONS, NULL },
|
.fromsec = { ALL_XXXEXIT_SECTIONS, NULL },
|
||||||
.bad_tosec = { EXIT_SECTIONS, NULL },
|
.bad_tosec = { EXIT_SECTIONS, NULL },
|
||||||
.mismatch = XXXEXIT_TO_SOME_EXIT,
|
.mismatch = XXXEXIT_TO_SOME_EXIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
/* Do not use exit code/data from init code */
|
/* Do not use exit code/data from init code */
|
||||||
{
|
{
|
||||||
.fromsec = { ALL_INIT_SECTIONS, NULL },
|
.fromsec = { ALL_INIT_SECTIONS, NULL },
|
||||||
.bad_tosec = { ALL_EXIT_SECTIONS, NULL },
|
.bad_tosec = { ALL_EXIT_SECTIONS, NULL },
|
||||||
.mismatch = ANY_INIT_TO_ANY_EXIT,
|
.mismatch = ANY_INIT_TO_ANY_EXIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
/* Do not use init code/data from exit code */
|
/* Do not use init code/data from exit code */
|
||||||
{
|
{
|
||||||
.fromsec = { ALL_EXIT_SECTIONS, NULL },
|
.fromsec = { ALL_EXIT_SECTIONS, NULL },
|
||||||
.bad_tosec = { ALL_INIT_SECTIONS, NULL },
|
.bad_tosec = { ALL_INIT_SECTIONS, NULL },
|
||||||
.mismatch = ANY_EXIT_TO_ANY_INIT,
|
.mismatch = ANY_EXIT_TO_ANY_INIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.fromsec = { ALL_PCI_INIT_SECTIONS, NULL },
|
.fromsec = { ALL_PCI_INIT_SECTIONS, NULL },
|
||||||
.bad_tosec = { INIT_SECTIONS, NULL },
|
.bad_tosec = { INIT_SECTIONS, NULL },
|
||||||
.mismatch = ANY_INIT_TO_ANY_EXIT,
|
.mismatch = ANY_INIT_TO_ANY_EXIT,
|
||||||
.symbol_white_list = { NULL },
|
|
||||||
},
|
},
|
||||||
/* Do not export init/exit functions or data */
|
/* Do not export init/exit functions or data */
|
||||||
{
|
{
|
||||||
.fromsec = { "___ksymtab*", NULL },
|
.fromsec = { "___ksymtab*", NULL },
|
||||||
.bad_tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL },
|
.bad_tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL },
|
||||||
.mismatch = EXPORT_TO_INIT_EXIT,
|
.mismatch = EXPORT_TO_INIT_EXIT,
|
||||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.fromsec = { "__ex_table", NULL },
|
.fromsec = { "__ex_table", NULL },
|
||||||
|
@ -1044,15 +1025,6 @@ static const struct sectioncheck *section_mismatch(
|
||||||
* fromsec = .data*
|
* fromsec = .data*
|
||||||
* atsym = __param_ops_*
|
* atsym = __param_ops_*
|
||||||
*
|
*
|
||||||
* Pattern 2:
|
|
||||||
* Many drivers utilise a *driver container with references to
|
|
||||||
* add, remove, probe functions etc.
|
|
||||||
* the pattern is identified by:
|
|
||||||
* tosec = init or exit section
|
|
||||||
* fromsec = data section
|
|
||||||
* atsym = *driver, *_template, *_sht, *_ops, *_probe,
|
|
||||||
* *probe_one, *_console, *_timer
|
|
||||||
*
|
|
||||||
* Pattern 3:
|
* Pattern 3:
|
||||||
* Whitelist all references from .head.text to any init section
|
* Whitelist all references from .head.text to any init section
|
||||||
*
|
*
|
||||||
|
@ -1101,10 +1073,22 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
|
||||||
strstarts(fromsym, "__param_ops_"))
|
strstarts(fromsym, "__param_ops_"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Check for pattern 2 */
|
/* symbols in data sections that may refer to any init/exit sections */
|
||||||
if (match(tosec, init_exit_sections) &&
|
if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
|
||||||
match(fromsec, data_sections) &&
|
match(tosec, PATTERNS(ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
|
||||||
match(fromsym, mismatch->symbol_white_list))
|
match(fromsym, PATTERNS("*_template", // scsi uses *_template a lot
|
||||||
|
"*_timer", // arm uses ops structures named _timer a lot
|
||||||
|
"*_sht", // scsi also used *_sht to some extent
|
||||||
|
"*_ops",
|
||||||
|
"*_probe",
|
||||||
|
"*_probe_one",
|
||||||
|
"*_console")))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* symbols in data sections that may refer to meminit/exit sections */
|
||||||
|
if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
|
||||||
|
match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
|
||||||
|
match(fromsym, PATTERNS("*driver")))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Check for pattern 3 */
|
/* Check for pattern 3 */
|
||||||
|
@ -1230,42 +1214,6 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
|
||||||
return near;
|
return near;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert a section name to the function/data attribute
|
|
||||||
* .init.text => __init
|
|
||||||
* .memexitconst => __memconst
|
|
||||||
* etc.
|
|
||||||
*
|
|
||||||
* The memory of returned value has been allocated on a heap. The user of this
|
|
||||||
* method should free it after usage.
|
|
||||||
*/
|
|
||||||
static char *sec2annotation(const char *s)
|
|
||||||
{
|
|
||||||
if (match(s, init_exit_sections)) {
|
|
||||||
char *p = NOFAIL(malloc(20));
|
|
||||||
char *r = p;
|
|
||||||
|
|
||||||
*p++ = '_';
|
|
||||||
*p++ = '_';
|
|
||||||
if (*s == '.')
|
|
||||||
s++;
|
|
||||||
while (*s && *s != '.')
|
|
||||||
*p++ = *s++;
|
|
||||||
*p = '\0';
|
|
||||||
if (*s == '.')
|
|
||||||
s++;
|
|
||||||
if (strstr(s, "rodata") != NULL)
|
|
||||||
strcat(p, "const ");
|
|
||||||
else if (strstr(s, "data") != NULL)
|
|
||||||
strcat(p, "data ");
|
|
||||||
else
|
|
||||||
strcat(p, " ");
|
|
||||||
return r;
|
|
||||||
} else {
|
|
||||||
return NOFAIL(strdup(""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int is_function(Elf_Sym *sym)
|
static int is_function(Elf_Sym *sym)
|
||||||
{
|
{
|
||||||
if (sym)
|
if (sym)
|
||||||
|
@ -1274,19 +1222,6 @@ static int is_function(Elf_Sym *sym)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_section_list(const char * const list[20])
|
|
||||||
{
|
|
||||||
const char *const *s = list;
|
|
||||||
|
|
||||||
while (*s) {
|
|
||||||
fprintf(stderr, "%s", *s);
|
|
||||||
s++;
|
|
||||||
if (*s)
|
|
||||||
fprintf(stderr, ", ");
|
|
||||||
}
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void get_pretty_name(int is_func, const char** name, const char** name_p)
|
static inline void get_pretty_name(int is_func, const char** name, const char** name_p)
|
||||||
{
|
{
|
||||||
switch (is_func) {
|
switch (is_func) {
|
||||||
|
@ -1304,141 +1239,31 @@ static inline void get_pretty_name(int is_func, const char** name, const char**
|
||||||
static void report_sec_mismatch(const char *modname,
|
static void report_sec_mismatch(const char *modname,
|
||||||
const struct sectioncheck *mismatch,
|
const struct sectioncheck *mismatch,
|
||||||
const char *fromsec,
|
const char *fromsec,
|
||||||
unsigned long long fromaddr,
|
|
||||||
const char *fromsym,
|
const char *fromsym,
|
||||||
int from_is_func,
|
const char *tosec, const char *tosym)
|
||||||
const char *tosec, const char *tosym,
|
|
||||||
int to_is_func)
|
|
||||||
{
|
{
|
||||||
const char *from, *from_p;
|
|
||||||
const char *to, *to_p;
|
|
||||||
char *prl_from;
|
|
||||||
char *prl_to;
|
|
||||||
|
|
||||||
sec_mismatch_count++;
|
sec_mismatch_count++;
|
||||||
|
|
||||||
get_pretty_name(from_is_func, &from, &from_p);
|
|
||||||
get_pretty_name(to_is_func, &to, &to_p);
|
|
||||||
|
|
||||||
warn("%s(%s+0x%llx): Section mismatch in reference from the %s %s%s "
|
|
||||||
"to the %s %s:%s%s\n",
|
|
||||||
modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec,
|
|
||||||
tosym, to_p);
|
|
||||||
|
|
||||||
switch (mismatch->mismatch) {
|
switch (mismatch->mismatch) {
|
||||||
case TEXT_TO_ANY_INIT:
|
case TEXT_TO_ANY_INIT:
|
||||||
prl_from = sec2annotation(fromsec);
|
case DATA_TO_ANY_INIT:
|
||||||
prl_to = sec2annotation(tosec);
|
|
||||||
fprintf(stderr,
|
|
||||||
"The function %s%s() references\n"
|
|
||||||
"the %s %s%s%s.\n"
|
|
||||||
"This is often because %s lacks a %s\n"
|
|
||||||
"annotation or the annotation of %s is wrong.\n",
|
|
||||||
prl_from, fromsym,
|
|
||||||
to, prl_to, tosym, to_p,
|
|
||||||
fromsym, prl_to, tosym);
|
|
||||||
free(prl_from);
|
|
||||||
free(prl_to);
|
|
||||||
break;
|
|
||||||
case DATA_TO_ANY_INIT: {
|
|
||||||
prl_to = sec2annotation(tosec);
|
|
||||||
fprintf(stderr,
|
|
||||||
"The variable %s references\n"
|
|
||||||
"the %s %s%s%s\n"
|
|
||||||
"If the reference is valid then annotate the\n"
|
|
||||||
"variable with __init* or __refdata (see linux/init.h) "
|
|
||||||
"or name the variable:\n",
|
|
||||||
fromsym, to, prl_to, tosym, to_p);
|
|
||||||
print_section_list(mismatch->symbol_white_list);
|
|
||||||
free(prl_to);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TEXT_TO_ANY_EXIT:
|
case TEXT_TO_ANY_EXIT:
|
||||||
prl_to = sec2annotation(tosec);
|
case DATA_TO_ANY_EXIT:
|
||||||
fprintf(stderr,
|
|
||||||
"The function %s() references a %s in an exit section.\n"
|
|
||||||
"Often the %s %s%s has valid usage outside the exit section\n"
|
|
||||||
"and the fix is to remove the %sannotation of %s.\n",
|
|
||||||
fromsym, to, to, tosym, to_p, prl_to, tosym);
|
|
||||||
free(prl_to);
|
|
||||||
break;
|
|
||||||
case DATA_TO_ANY_EXIT: {
|
|
||||||
prl_to = sec2annotation(tosec);
|
|
||||||
fprintf(stderr,
|
|
||||||
"The variable %s references\n"
|
|
||||||
"the %s %s%s%s\n"
|
|
||||||
"If the reference is valid then annotate the\n"
|
|
||||||
"variable with __exit* (see linux/init.h) or "
|
|
||||||
"name the variable:\n",
|
|
||||||
fromsym, to, prl_to, tosym, to_p);
|
|
||||||
print_section_list(mismatch->symbol_white_list);
|
|
||||||
free(prl_to);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XXXINIT_TO_SOME_INIT:
|
case XXXINIT_TO_SOME_INIT:
|
||||||
case XXXEXIT_TO_SOME_EXIT:
|
case XXXEXIT_TO_SOME_EXIT:
|
||||||
prl_from = sec2annotation(fromsec);
|
|
||||||
prl_to = sec2annotation(tosec);
|
|
||||||
fprintf(stderr,
|
|
||||||
"The %s %s%s%s references\n"
|
|
||||||
"a %s %s%s%s.\n"
|
|
||||||
"If %s is only used by %s then\n"
|
|
||||||
"annotate %s with a matching annotation.\n",
|
|
||||||
from, prl_from, fromsym, from_p,
|
|
||||||
to, prl_to, tosym, to_p,
|
|
||||||
tosym, fromsym, tosym);
|
|
||||||
free(prl_from);
|
|
||||||
free(prl_to);
|
|
||||||
break;
|
|
||||||
case ANY_INIT_TO_ANY_EXIT:
|
case ANY_INIT_TO_ANY_EXIT:
|
||||||
prl_from = sec2annotation(fromsec);
|
|
||||||
prl_to = sec2annotation(tosec);
|
|
||||||
fprintf(stderr,
|
|
||||||
"The %s %s%s%s references\n"
|
|
||||||
"a %s %s%s%s.\n"
|
|
||||||
"This is often seen when error handling "
|
|
||||||
"in the init function\n"
|
|
||||||
"uses functionality in the exit path.\n"
|
|
||||||
"The fix is often to remove the %sannotation of\n"
|
|
||||||
"%s%s so it may be used outside an exit section.\n",
|
|
||||||
from, prl_from, fromsym, from_p,
|
|
||||||
to, prl_to, tosym, to_p,
|
|
||||||
prl_to, tosym, to_p);
|
|
||||||
free(prl_from);
|
|
||||||
free(prl_to);
|
|
||||||
break;
|
|
||||||
case ANY_EXIT_TO_ANY_INIT:
|
case ANY_EXIT_TO_ANY_INIT:
|
||||||
prl_from = sec2annotation(fromsec);
|
warn("%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n",
|
||||||
prl_to = sec2annotation(tosec);
|
modname, fromsym, fromsec, tosym, tosec);
|
||||||
fprintf(stderr,
|
|
||||||
"The %s %s%s%s references\n"
|
|
||||||
"a %s %s%s%s.\n"
|
|
||||||
"This is often seen when error handling "
|
|
||||||
"in the exit function\n"
|
|
||||||
"uses functionality in the init path.\n"
|
|
||||||
"The fix is often to remove the %sannotation of\n"
|
|
||||||
"%s%s so it may be used outside an init section.\n",
|
|
||||||
from, prl_from, fromsym, from_p,
|
|
||||||
to, prl_to, tosym, to_p,
|
|
||||||
prl_to, tosym, to_p);
|
|
||||||
free(prl_from);
|
|
||||||
free(prl_to);
|
|
||||||
break;
|
break;
|
||||||
case EXPORT_TO_INIT_EXIT:
|
case EXPORT_TO_INIT_EXIT:
|
||||||
prl_to = sec2annotation(tosec);
|
warn("%s: EXPORT_SYMBOL used for init/exit symbol: %s (section: %s)\n",
|
||||||
fprintf(stderr,
|
modname, tosym, tosec);
|
||||||
"The symbol %s is exported and annotated %s\n"
|
|
||||||
"Fix this by removing the %sannotation of %s "
|
|
||||||
"or drop the export.\n",
|
|
||||||
tosym, prl_to, prl_to, tosym);
|
|
||||||
free(prl_to);
|
|
||||||
break;
|
break;
|
||||||
case EXTABLE_TO_NON_TEXT:
|
case EXTABLE_TO_NON_TEXT:
|
||||||
fatal("There's a special handler for this mismatch type, "
|
fatal("There's a special handler for this mismatch type, we should never get here.\n");
|
||||||
"we should never get here.");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void default_mismatch_handler(const char *modname, struct elf_info *elf,
|
static void default_mismatch_handler(const char *modname, struct elf_info *elf,
|
||||||
|
@ -1454,9 +1279,6 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
|
||||||
from = find_elf_symbol2(elf, r->r_offset, fromsec);
|
from = find_elf_symbol2(elf, r->r_offset, fromsec);
|
||||||
fromsym = sym_name(elf, from);
|
fromsym = sym_name(elf, from);
|
||||||
|
|
||||||
if (strstarts(fromsym, "reference___initcall"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
tosec = sec_name(elf, get_secindex(elf, sym));
|
tosec = sec_name(elf, get_secindex(elf, sym));
|
||||||
to = find_elf_symbol(elf, r->r_addend, sym);
|
to = find_elf_symbol(elf, r->r_addend, sym);
|
||||||
tosym = sym_name(elf, to);
|
tosym = sym_name(elf, to);
|
||||||
|
@ -1465,9 +1287,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
|
||||||
if (secref_whitelist(mismatch,
|
if (secref_whitelist(mismatch,
|
||||||
fromsec, fromsym, tosec, tosym)) {
|
fromsec, fromsym, tosec, tosym)) {
|
||||||
report_sec_mismatch(modname, mismatch,
|
report_sec_mismatch(modname, mismatch,
|
||||||
fromsec, r->r_offset, fromsym,
|
fromsec, fromsym, tosec, tosym);
|
||||||
is_function(from), tosec, tosym,
|
|
||||||
is_function(to));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1623,9 +1443,6 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
|
||||||
break;
|
break;
|
||||||
case R_386_PC32:
|
case R_386_PC32:
|
||||||
r->r_addend = TO_NATIVE(*location) + 4;
|
r->r_addend = TO_NATIVE(*location) + 4;
|
||||||
/* For CONFIG_RELOCATABLE=y */
|
|
||||||
if (elf->hdr->e_type == ET_EXEC)
|
|
||||||
r->r_addend += r->r_offset;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1718,8 +1535,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
|
||||||
Elf_Rela *start = (void *)elf->hdr + sechdr->sh_offset;
|
Elf_Rela *start = (void *)elf->hdr + sechdr->sh_offset;
|
||||||
Elf_Rela *stop = (void *)start + sechdr->sh_size;
|
Elf_Rela *stop = (void *)start + sechdr->sh_size;
|
||||||
|
|
||||||
fromsec = sech_name(elf, sechdr);
|
fromsec = sec_name(elf, sechdr->sh_info);
|
||||||
fromsec += strlen(".rela");
|
|
||||||
/* if from section (name) is know good then skip it */
|
/* if from section (name) is know good then skip it */
|
||||||
if (match(fromsec, section_white_list))
|
if (match(fromsec, section_white_list))
|
||||||
return;
|
return;
|
||||||
|
@ -1771,8 +1587,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
|
||||||
Elf_Rel *start = (void *)elf->hdr + sechdr->sh_offset;
|
Elf_Rel *start = (void *)elf->hdr + sechdr->sh_offset;
|
||||||
Elf_Rel *stop = (void *)start + sechdr->sh_size;
|
Elf_Rel *stop = (void *)start + sechdr->sh_size;
|
||||||
|
|
||||||
fromsec = sech_name(elf, sechdr);
|
fromsec = sec_name(elf, sechdr->sh_info);
|
||||||
fromsec += strlen(".rel");
|
|
||||||
/* if from section (name) is know good then skip it */
|
/* if from section (name) is know good then skip it */
|
||||||
if (match(fromsec, section_white_list))
|
if (match(fromsec, section_white_list))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#define Elf_Shdr Elf32_Shdr
|
#define Elf_Shdr Elf32_Shdr
|
||||||
#define Elf_Sym Elf32_Sym
|
#define Elf_Sym Elf32_Sym
|
||||||
#define Elf_Addr Elf32_Addr
|
#define Elf_Addr Elf32_Addr
|
||||||
#define Elf_Sword Elf64_Sword
|
|
||||||
#define Elf_Section Elf32_Half
|
#define Elf_Section Elf32_Half
|
||||||
#define ELF_ST_BIND ELF32_ST_BIND
|
#define ELF_ST_BIND ELF32_ST_BIND
|
||||||
#define ELF_ST_TYPE ELF32_ST_TYPE
|
#define ELF_ST_TYPE ELF32_ST_TYPE
|
||||||
|
@ -41,7 +40,6 @@
|
||||||
#define Elf_Shdr Elf64_Shdr
|
#define Elf_Shdr Elf64_Shdr
|
||||||
#define Elf_Sym Elf64_Sym
|
#define Elf_Sym Elf64_Sym
|
||||||
#define Elf_Addr Elf64_Addr
|
#define Elf_Addr Elf64_Addr
|
||||||
#define Elf_Sword Elf64_Sxword
|
|
||||||
#define Elf_Section Elf64_Half
|
#define Elf_Section Elf64_Half
|
||||||
#define ELF_ST_BIND ELF64_ST_BIND
|
#define ELF_ST_BIND ELF64_ST_BIND
|
||||||
#define ELF_ST_TYPE ELF64_ST_TYPE
|
#define ELF_ST_TYPE ELF64_ST_TYPE
|
||||||
|
@ -158,22 +156,28 @@ static inline int is_shndx_special(unsigned int i)
|
||||||
return i != SHN_XINDEX && i >= SHN_LORESERVE && i <= SHN_HIRESERVE;
|
return i != SHN_XINDEX && i >= SHN_LORESERVE && i <= SHN_HIRESERVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Move reserved section indices SHN_LORESERVE..SHN_HIRESERVE out of
|
|
||||||
* the way to -256..-1, to avoid conflicting with real section
|
|
||||||
* indices.
|
|
||||||
*/
|
|
||||||
#define SPECIAL(i) ((i) - (SHN_HIRESERVE + 1))
|
|
||||||
|
|
||||||
/* Accessor for sym->st_shndx, hides ugliness of "64k sections" */
|
/* Accessor for sym->st_shndx, hides ugliness of "64k sections" */
|
||||||
static inline unsigned int get_secindex(const struct elf_info *info,
|
static inline unsigned int get_secindex(const struct elf_info *info,
|
||||||
const Elf_Sym *sym)
|
const Elf_Sym *sym)
|
||||||
{
|
{
|
||||||
if (is_shndx_special(sym->st_shndx))
|
unsigned int index = sym->st_shndx;
|
||||||
return SPECIAL(sym->st_shndx);
|
|
||||||
if (sym->st_shndx != SHN_XINDEX)
|
/*
|
||||||
return sym->st_shndx;
|
* Elf{32,64}_Sym::st_shndx is 2 byte. Big section numbers are available
|
||||||
return info->symtab_shndx_start[sym - info->symtab_start];
|
* in the .symtab_shndx section.
|
||||||
|
*/
|
||||||
|
if (index == SHN_XINDEX)
|
||||||
|
return info->symtab_shndx_start[sym - info->symtab_start];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Move reserved section indices SHN_LORESERVE..SHN_HIRESERVE out of
|
||||||
|
* the way to UINT_MAX-255..UINT_MAX, to avoid conflicting with real
|
||||||
|
* section indices.
|
||||||
|
*/
|
||||||
|
if (index >= SHN_LORESERVE && index <= SHN_HIRESERVE)
|
||||||
|
return index - SHN_HIRESERVE - 1;
|
||||||
|
|
||||||
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* file2alias.c */
|
/* file2alias.c */
|
||||||
|
@ -187,6 +191,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen);
|
||||||
/* from modpost.c */
|
/* from modpost.c */
|
||||||
char *read_text_file(const char *filename);
|
char *read_text_file(const char *filename);
|
||||||
char *get_line(char **stringp);
|
char *get_line(char **stringp);
|
||||||
|
void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym);
|
||||||
|
|
||||||
enum loglevel {
|
enum loglevel {
|
||||||
LOG_WARN,
|
LOG_WARN,
|
||||||
|
|
|
@ -49,6 +49,9 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
|
||||||
URL: https://www.kernel.org
|
URL: https://www.kernel.org
|
||||||
$S Source: kernel-$__KERNELRELEASE.tar.gz
|
$S Source: kernel-$__KERNELRELEASE.tar.gz
|
||||||
Provides: $PROVIDES
|
Provides: $PROVIDES
|
||||||
|
# $UTS_MACHINE as a fallback of _arch in case
|
||||||
|
# /usr/lib/rpm/platform/*/macros was not included.
|
||||||
|
%define _arch %{?_arch:$UTS_MACHINE}
|
||||||
%define __spec_install_post /usr/lib/rpm/brp-compress || :
|
%define __spec_install_post /usr/lib/rpm/brp-compress || :
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue