Commit 87b049b5 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-sam.bkbits.net/kbuild

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 5c4ac43f 3a28b9c6
...@@ -149,14 +149,13 @@ space := $(nullstring) # end of line ...@@ -149,14 +149,13 @@ space := $(nullstring) # end of line
# careful not to include files twice if building in the source # careful not to include files twice if building in the source
# directory. LOCALVERSION from the command line override all of this # directory. LOCALVERSION from the command line override all of this
ifeq ($(objtree),$(srctree)) localver := $(objtree)/localversion* $(srctree)/localversion*
localversion-files := $(wildcard $(srctree)/localversion*) localver := $(sort $(wildcard $(localver)))
else # skip backup files (containing '~')
localversion-files := $(wildcard $(objtree)/localversion* $(srctree)/localversion*) localver := $(foreach f, $(localver), $(if $(findstring ~, $(f)),,$(f)))
endif
LOCALVERSION = $(subst $(space),, \ LOCALVERSION = $(subst $(space),, \
$(shell cat /dev/null $(localversion-files:%~=)) \ $(shell cat /dev/null $(localver)) \
$(patsubst "%",%,$(CONFIG_LOCALVERSION))) $(patsubst "%",%,$(CONFIG_LOCALVERSION)))
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION) KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION)
...@@ -291,7 +290,7 @@ check_gcc = $(warning check_gcc is deprecated - use cc-option) \ ...@@ -291,7 +290,7 @@ check_gcc = $(warning check_gcc is deprecated - use cc-option) \
$(call cc-option, $(1),$(2)) $(call cc-option, $(1),$(2))
# cc-option-yn # cc-option-yn
# Usage: flag := $(call gcc-option-yn, -march=winchip-c6) # Usage: flag := $(call cc-option-yn, -march=winchip-c6)
cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "y"; else echo "n"; fi;) > /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
...@@ -331,7 +330,10 @@ DEPMOD = /sbin/depmod ...@@ -331,7 +330,10 @@ DEPMOD = /sbin/depmod
KALLSYMS = scripts/kallsyms KALLSYMS = scripts/kallsyms
PERL = perl PERL = perl
CHECK = sparse CHECK = sparse
NOSTDINC_FLAGS := -nostdinc -isystem $(shell $(CC) -print-file-name=include)
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__
CHECKFLAGS += $(NOSTDINC_FLAGS)
MODFLAGS = -DMODULE MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS) CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS) AFLAGS_MODULE = $(MODFLAGS)
...@@ -339,7 +341,6 @@ LDFLAGS_MODULE = -r ...@@ -339,7 +341,6 @@ LDFLAGS_MODULE = -r
CFLAGS_KERNEL = CFLAGS_KERNEL =
AFLAGS_KERNEL = AFLAGS_KERNEL =
NOSTDINC_FLAGS = -nostdinc -iwithprefix include
# Use LINUXINCLUDE when you must reference the include/ directory. # Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option # Needed to be compatible with the O= option
...@@ -389,7 +390,7 @@ scripts_basic: ...@@ -389,7 +390,7 @@ scripts_basic:
# using a seperate output directory. This allows convinient use # using a seperate output directory. This allows convinient use
# of make in output directory # of make in output directory
outputmakefile: outputmakefile:
$(Q)if /usr/bin/env test ! $(srctree) -ef $(objtree); then \ $(Q)if test ! $(srctree) -ef $(objtree); then \
$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \ $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \
> $(objtree)/Makefile; \ > $(objtree)/Makefile; \
...@@ -1210,6 +1211,9 @@ checkstack: ...@@ -1210,6 +1211,9 @@ checkstack:
$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
$(PERL) $(src)/scripts/checkstack.pl $(ARCH) $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
kernelrelease:
@echo $(KERNELRELEASE)
# FIXME Should go into a make.lib or something # FIXME Should go into a make.lib or something
# =========================================================================== # ===========================================================================
......
...@@ -614,3 +614,13 @@ int in_gate_area(struct task_struct *task, unsigned long addr) ...@@ -614,3 +614,13 @@ int in_gate_area(struct task_struct *task, unsigned long addr)
struct vm_area_struct *vma = get_gate_vma(task); struct vm_area_struct *vma = get_gate_vma(task);
return (addr >= vma->vm_start) && (addr < vma->vm_end); return (addr >= vma->vm_start) && (addr < vma->vm_end);
} }
/* Use this when you have no reliable task/vma, typically from interrupt
* context. It is less reliable than using the task's vma and may give
* false positives.
*/
int in_gate_area_no_task(unsigned long addr)
{
return (((addr >= VSYSCALL_START) && (addr < VSYSCALL_END)) ||
((addr >= VSYSCALL32_BASE) && (addr < VSYSCALL32_END)));
}
...@@ -134,13 +134,7 @@ extern __inline__ int get_order(unsigned long size) ...@@ -134,13 +134,7 @@ extern __inline__ int get_order(unsigned long size)
(((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#define CONFIG_ARCH_GATE_AREA 1 #define __HAVE_ARCH_GATE_AREA 1
#ifndef __ASSEMBLY__
struct task_struct;
struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
int in_gate_area(struct task_struct *task, unsigned long addr);
#endif
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -816,10 +816,14 @@ kernel_map_pages(struct page *page, int numpages, int enable) ...@@ -816,10 +816,14 @@ kernel_map_pages(struct page *page, int numpages, int enable)
} }
#endif #endif
#ifndef CONFIG_ARCH_GATE_AREA
extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
#ifdef __HAVE_ARCH_GATE_AREA
int in_gate_area_no_task(unsigned long addr);
int in_gate_area(struct task_struct *task, unsigned long addr); int in_gate_area(struct task_struct *task, unsigned long addr);
#endif #else
int in_gate_area_no_task(unsigned long addr);
#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
#endif /* __HAVE_ARCH_GATE_AREA */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _LINUX_MM_H */ #endif /* _LINUX_MM_H */
...@@ -18,6 +18,13 @@ ...@@ -18,6 +18,13 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/mm.h>
#ifdef CONFIG_KALLSYMS_ALL
#define all_var 1
#else
#define all_var 0
#endif
/* These will be re-linked against their real values during the second link stage */ /* These will be re-linked against their real values during the second link stage */
extern unsigned long kallsyms_addresses[] __attribute__((weak)); extern unsigned long kallsyms_addresses[] __attribute__((weak));
...@@ -30,7 +37,7 @@ extern u16 kallsyms_token_index[] __attribute__((weak)); ...@@ -30,7 +37,7 @@ extern u16 kallsyms_token_index[] __attribute__((weak));
extern unsigned long kallsyms_markers[] __attribute__((weak)); extern unsigned long kallsyms_markers[] __attribute__((weak));
/* Defined by the linker script. */ /* Defined by the linker script. */
extern char _stext[], _etext[], _sinittext[], _einittext[]; extern char _stext[], _etext[], _sinittext[], _einittext[], _end[];
static inline int is_kernel_inittext(unsigned long addr) static inline int is_kernel_inittext(unsigned long addr)
{ {
...@@ -44,7 +51,7 @@ static inline int is_kernel_text(unsigned long addr) ...@@ -44,7 +51,7 @@ static inline int is_kernel_text(unsigned long addr)
{ {
if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
return 1; return 1;
return 0; return in_gate_area_no_task(addr);
} }
/* expand a compressed symbol data into the resulting uncompressed string, /* expand a compressed symbol data into the resulting uncompressed string,
...@@ -147,7 +154,7 @@ const char *kallsyms_lookup(unsigned long addr, ...@@ -147,7 +154,7 @@ const char *kallsyms_lookup(unsigned long addr,
namebuf[KSYM_NAME_LEN] = 0; namebuf[KSYM_NAME_LEN] = 0;
namebuf[0] = 0; namebuf[0] = 0;
if (is_kernel_text(addr) || is_kernel_inittext(addr)) { if (all_var || is_kernel_text(addr) || is_kernel_inittext(addr)) {
unsigned long symbol_end=0; unsigned long symbol_end=0;
/* do a binary search on the sorted kallsyms_addresses array */ /* do a binary search on the sorted kallsyms_addresses array */
...@@ -181,7 +188,7 @@ const char *kallsyms_lookup(unsigned long addr, ...@@ -181,7 +188,7 @@ const char *kallsyms_lookup(unsigned long addr,
if (is_kernel_inittext(addr)) if (is_kernel_inittext(addr))
symbol_end = (unsigned long)_einittext; symbol_end = (unsigned long)_einittext;
else else
symbol_end = (unsigned long)_etext; symbol_end = all_var ? (unsigned long)_end : (unsigned long)_etext;
} }
*symbolsize = symbol_end - kallsyms_addresses[low]; *symbolsize = symbol_end - kallsyms_addresses[low];
......
...@@ -2092,7 +2092,7 @@ unsigned long vmalloc_to_pfn(void * vmalloc_addr) ...@@ -2092,7 +2092,7 @@ unsigned long vmalloc_to_pfn(void * vmalloc_addr)
EXPORT_SYMBOL(vmalloc_to_pfn); EXPORT_SYMBOL(vmalloc_to_pfn);
#if !defined(CONFIG_ARCH_GATE_AREA) #if !defined(__HAVE_ARCH_GATE_AREA)
#if defined(AT_SYSINFO_EHDR) #if defined(AT_SYSINFO_EHDR)
struct vm_area_struct gate_vma; struct vm_area_struct gate_vma;
...@@ -2118,7 +2118,7 @@ struct vm_area_struct *get_gate_vma(struct task_struct *tsk) ...@@ -2118,7 +2118,7 @@ struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
#endif #endif
} }
int in_gate_area(struct task_struct *task, unsigned long addr) int in_gate_area_no_task(unsigned long addr)
{ {
#ifdef AT_SYSINFO_EHDR #ifdef AT_SYSINFO_EHDR
if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END)) if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END))
...@@ -2127,4 +2127,4 @@ int in_gate_area(struct task_struct *task, unsigned long addr) ...@@ -2127,4 +2127,4 @@ int in_gate_area(struct task_struct *task, unsigned long addr)
return 0; return 0;
} }
#endif #endif /* __HAVE_ARCH_GATE_AREA */
...@@ -83,7 +83,6 @@ __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ ...@@ -83,7 +83,6 @@ __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
# Linus' kernel sanity checking tool # Linus' kernel sanity checking tool
ifneq ($(KBUILD_CHECKSRC),0) ifneq ($(KBUILD_CHECKSRC),0)
CHECKFLAGS += -I$(shell $(CC) -print-file-name=include)
ifeq ($(KBUILD_CHECKSRC),2) ifeq ($(KBUILD_CHECKSRC),2)
quiet_cmd_force_checksrc = CHECK $< quiet_cmd_force_checksrc = CHECK $<
cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ;
......
...@@ -184,6 +184,15 @@ symbol_valid(struct sym_entry *s) ...@@ -184,6 +184,15 @@ symbol_valid(struct sym_entry *s)
if ((s->addr < _stext || s->addr > _etext) if ((s->addr < _stext || s->addr > _etext)
&& (s->addr < _sinittext || s->addr > _einittext)) && (s->addr < _sinittext || s->addr > _einittext))
return 0; return 0;
/* Corner case. Discard any symbols with the same value as
* _etext or _einittext, they can move between pass 1 and 2
* when the kallsyms data is added. If these symbols move then
* they may get dropped in pass 2, which breaks the kallsyms
* rules.
*/
if ((s->addr == _etext && strcmp(s->sym + 1, "_etext")) ||
(s->addr == _einittext && strcmp(s->sym + 1, "_einittext")))
return 0;
} }
/* Exclude symbols which vary between passes. */ /* Exclude symbols which vary between passes. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment