Skip to content

Commit

Permalink
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/mmarek/kbuild

Pull kbuild updates from Michal Marek:
 "Just a few kbuild core commits this time:

   - kallsyms fix for CONFIG_XIP_KERNEL

   - bashisms in scripts/link-vmlinux.sh fixed

   - workaround to make DEBUG_INFO_REDUCED more useful yet still space
     efficient

   - clang is not wrongly detected when cross-compiling"

* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kbuild: include core debug info when DEBUG_INFO_REDUCED
  scripts: link-vmlinux: Don't pass page offset to kallsyms if XIP Kernel
  scripts: fix link-vmlinux.sh bash-ism
  Makefile: Fix detection of clang when cross-compiling
  • Loading branch information
torvalds committed Jul 2, 2015
2 parents a95cb3c + 50ab9a6 commit e965b8c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 12 deletions.
16 changes: 7 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,6 @@ endif
export KBUILD_MODULES KBUILD_BUILTIN
export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD

ifneq ($(CC),)
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
COMPILER := clang
else
COMPILER := gcc
endif
export COMPILER
endif

# We need some generic definitions (do not try to remake the file).
scripts/Kbuild.include: ;
include scripts/Kbuild.include
Expand Down Expand Up @@ -670,6 +661,13 @@ endif
endif
KBUILD_CFLAGS += $(stackp-flag)

ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
COMPILER := clang
else
COMPILER := gcc
endif
export COMPILER

ifeq ($(COMPILER),clang)
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
Expand Down
3 changes: 3 additions & 0 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ CFLAGS_kobject.o += -DDEBUG
CFLAGS_kobject_uevent.o += -DDEBUG
endif

obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o
CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any)

obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
Expand Down
27 changes: 27 additions & 0 deletions lib/debug_info.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* This file exists solely to ensure debug information for some core
* data structures is included in the final image even for
* CONFIG_DEBUG_INFO_REDUCED. Please do not add actual code. However,
* adding appropriate #includes is fine.
*/
#include <stdarg.h>

#include <linux/cred.h>
#include <linux/crypto.h>
#include <linux/dcache.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/fscache-cache.h>
#include <linux/io.h>
#include <linux/kallsyms.h>
#include <linux/kernel.h>
#include <linux/kobject.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/net.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <net/addrconf.h>
#include <net/sock.h>
#include <net/tcp.h>
18 changes: 15 additions & 3 deletions scripts/link-vmlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ kallsyms()
kallsymopt="${kallsymopt} --all-symbols"
fi

if [ -n "${CONFIG_ARM}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then
if [ -n "${CONFIG_ARM}" ] && [ -z "${CONFIG_XIP_KERNEL}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then
kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET"
fi

Expand Down Expand Up @@ -111,7 +111,6 @@ sortextable()
}

# Delete output files in case of error
trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR
cleanup()
{
rm -f .old_version
Expand All @@ -124,6 +123,20 @@ cleanup()
rm -f vmlinux.o
}

on_exit()
{
if [ $? -ne 0 ]; then
cleanup
fi
}
trap on_exit EXIT

on_signals()
{
exit 1
}
trap on_signals HUP INT QUIT TERM

#
#
# Use "make V=1" to debug this script
Expand Down Expand Up @@ -231,7 +244,6 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
if ! cmp -s System.map .tmp_System.map; then
echo >&2 Inconsistent kallsyms data
echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
cleanup
exit 1
fi
fi
Expand Down

0 comments on commit e965b8c

Please sign in to comment.