diff options
| -rw-r--r-- | Makefile | 16 | ||||
| -rw-r--r-- | lib/Makefile | 3 | ||||
| -rw-r--r-- | lib/debug_info.c | 27 | ||||
| -rwxr-xr-x | scripts/link-vmlinux.sh | 18 |
4 files changed, 52 insertions, 12 deletions
| @@ -335,15 +335,6 @@ endif | |||
| 335 | export KBUILD_MODULES KBUILD_BUILTIN | 335 | export KBUILD_MODULES KBUILD_BUILTIN |
| 336 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | 336 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD |
| 337 | 337 | ||
| 338 | ifneq ($(CC),) | ||
| 339 | ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) | ||
| 340 | COMPILER := clang | ||
| 341 | else | ||
| 342 | COMPILER := gcc | ||
| 343 | endif | ||
| 344 | export COMPILER | ||
| 345 | endif | ||
| 346 | |||
| 347 | # We need some generic definitions (do not try to remake the file). | 338 | # We need some generic definitions (do not try to remake the file). |
| 348 | scripts/Kbuild.include: ; | 339 | scripts/Kbuild.include: ; |
| 349 | include scripts/Kbuild.include | 340 | include scripts/Kbuild.include |
| @@ -670,6 +661,13 @@ endif | |||
| 670 | endif | 661 | endif |
| 671 | KBUILD_CFLAGS += $(stackp-flag) | 662 | KBUILD_CFLAGS += $(stackp-flag) |
| 672 | 663 | ||
| 664 | ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) | ||
| 665 | COMPILER := clang | ||
| 666 | else | ||
| 667 | COMPILER := gcc | ||
| 668 | endif | ||
| 669 | export COMPILER | ||
| 670 | |||
| 673 | ifeq ($(COMPILER),clang) | 671 | ifeq ($(COMPILER),clang) |
| 674 | KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) | 672 | KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) |
| 675 | KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,) | 673 | KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,) |
diff --git a/lib/Makefile b/lib/Makefile index ff37c8c2f7b2..6897b527581a 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -45,6 +45,9 @@ CFLAGS_kobject.o += -DDEBUG | |||
| 45 | CFLAGS_kobject_uevent.o += -DDEBUG | 45 | CFLAGS_kobject_uevent.o += -DDEBUG |
| 46 | endif | 46 | endif |
| 47 | 47 | ||
| 48 | obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o | ||
| 49 | CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) | ||
| 50 | |||
| 48 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o | 51 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o |
| 49 | obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o | 52 | obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o |
| 50 | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o | 53 | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o |
diff --git a/lib/debug_info.c b/lib/debug_info.c new file mode 100644 index 000000000000..2edbe27517ed --- /dev/null +++ b/lib/debug_info.c | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | /* | ||
| 2 | * This file exists solely to ensure debug information for some core | ||
| 3 | * data structures is included in the final image even for | ||
| 4 | * CONFIG_DEBUG_INFO_REDUCED. Please do not add actual code. However, | ||
| 5 | * adding appropriate #includes is fine. | ||
| 6 | */ | ||
| 7 | #include <stdarg.h> | ||
| 8 | |||
| 9 | #include <linux/cred.h> | ||
| 10 | #include <linux/crypto.h> | ||
| 11 | #include <linux/dcache.h> | ||
| 12 | #include <linux/device.h> | ||
| 13 | #include <linux/fs.h> | ||
| 14 | #include <linux/fscache-cache.h> | ||
| 15 | #include <linux/io.h> | ||
| 16 | #include <linux/kallsyms.h> | ||
| 17 | #include <linux/kernel.h> | ||
| 18 | #include <linux/kobject.h> | ||
| 19 | #include <linux/mm.h> | ||
| 20 | #include <linux/module.h> | ||
| 21 | #include <linux/net.h> | ||
| 22 | #include <linux/sched.h> | ||
| 23 | #include <linux/slab.h> | ||
| 24 | #include <linux/types.h> | ||
| 25 | #include <net/addrconf.h> | ||
| 26 | #include <net/sock.h> | ||
| 27 | #include <net/tcp.h> | ||
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 86a4fe75f453..1a10d8ac8162 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
| @@ -82,7 +82,7 @@ kallsyms() | |||
| 82 | kallsymopt="${kallsymopt} --all-symbols" | 82 | kallsymopt="${kallsymopt} --all-symbols" |
| 83 | fi | 83 | fi |
| 84 | 84 | ||
| 85 | if [ -n "${CONFIG_ARM}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then | 85 | if [ -n "${CONFIG_ARM}" ] && [ -z "${CONFIG_XIP_KERNEL}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then |
| 86 | kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" | 86 | kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" |
| 87 | fi | 87 | fi |
| 88 | 88 | ||
| @@ -111,7 +111,6 @@ sortextable() | |||
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | # Delete output files in case of error | 113 | # Delete output files in case of error |
| 114 | trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR | ||
| 115 | cleanup() | 114 | cleanup() |
| 116 | { | 115 | { |
| 117 | rm -f .old_version | 116 | rm -f .old_version |
| @@ -124,6 +123,20 @@ cleanup() | |||
| 124 | rm -f vmlinux.o | 123 | rm -f vmlinux.o |
| 125 | } | 124 | } |
| 126 | 125 | ||
| 126 | on_exit() | ||
| 127 | { | ||
| 128 | if [ $? -ne 0 ]; then | ||
| 129 | cleanup | ||
| 130 | fi | ||
| 131 | } | ||
| 132 | trap on_exit EXIT | ||
| 133 | |||
| 134 | on_signals() | ||
| 135 | { | ||
| 136 | exit 1 | ||
| 137 | } | ||
| 138 | trap on_signals HUP INT QUIT TERM | ||
| 139 | |||
| 127 | # | 140 | # |
| 128 | # | 141 | # |
| 129 | # Use "make V=1" to debug this script | 142 | # Use "make V=1" to debug this script |
| @@ -231,7 +244,6 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then | |||
| 231 | if ! cmp -s System.map .tmp_System.map; then | 244 | if ! cmp -s System.map .tmp_System.map; then |
| 232 | echo >&2 Inconsistent kallsyms data | 245 | echo >&2 Inconsistent kallsyms data |
| 233 | echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround | 246 | echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround |
| 234 | cleanup | ||
| 235 | exit 1 | 247 | exit 1 |
| 236 | fi | 248 | fi |
| 237 | fi | 249 | fi |
