Commit 080e8927 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fix

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fix:
  mm/slab: fix section mismatch warning
  mm: fix section mismatch warnings
  init/main: use __init_refok to fix section mismatch
  kbuild: introduce __init_refok/__initdata_refok to supress section mismatch warnings
  all-archs: consolidate .data section definition in asm-generic
  all-archs: consolidate .text section definition in asm-generic
  kbuild: add "Section mismatch" warning whitelist for powerpc
  kbuild: make better section mismatch reports on i386, arm and mips
  kbuild: make modpost section warnings clearer
  kconfig: search harder for curses library in check-lxdialog.sh
  kbuild: include limits.h in sumversion.c for PATH_MAX
  powerpc: Fix the MODALIAS generation in modpost for of devices
parents 4b85df04 38bdc32a
...@@ -15,7 +15,7 @@ SECTIONS ...@@ -15,7 +15,7 @@ SECTIONS
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
.text : { .text : {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -89,7 +89,7 @@ SECTIONS ...@@ -89,7 +89,7 @@ SECTIONS
_data = .; _data = .;
.data : { /* Data */ .data : { /* Data */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -90,7 +90,7 @@ SECTIONS ...@@ -90,7 +90,7 @@ SECTIONS
__exception_text_start = .; __exception_text_start = .;
*(.exception.text) *(.exception.text)
__exception_text_end = .; __exception_text_end = .;
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
...@@ -158,7 +158,7 @@ SECTIONS ...@@ -158,7 +158,7 @@ SECTIONS
/* /*
* and the usual data section * and the usual data section
*/ */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
_edata = .; _edata = .;
......
...@@ -64,7 +64,7 @@ SECTIONS ...@@ -64,7 +64,7 @@ SECTIONS
.text : { /* Real text segment */ .text : { /* Real text segment */
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT /* FIXME - borrowed from arm32 - check*/ LOCK_TEXT /* FIXME - borrowed from arm32 - check*/
*(.fixup) *(.fixup)
...@@ -111,7 +111,7 @@ SECTIONS ...@@ -111,7 +111,7 @@ SECTIONS
/* /*
* and the usual data section * and the usual data section
*/ */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
*(.init.data) *(.init.data)
......
...@@ -65,7 +65,7 @@ SECTIONS ...@@ -65,7 +65,7 @@ SECTIONS
.text : { /* Real text segment */ .text : { /* Real text segment */
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -106,7 +106,7 @@ SECTIONS ...@@ -106,7 +106,7 @@ SECTIONS
/* /*
* and the usual data section * and the usual data section
*/ */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
_edata = .; _edata = .;
......
...@@ -76,7 +76,7 @@ SECTIONS ...@@ -76,7 +76,7 @@ SECTIONS
. = 0x100; . = 0x100;
*(.scall.text) *(.scall.text)
*(.irq.text) *(.irq.text)
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
KPROBES_TEXT KPROBES_TEXT
...@@ -112,7 +112,7 @@ SECTIONS ...@@ -112,7 +112,7 @@ SECTIONS
/* And the rest... */ /* And the rest... */
*(.data.rel*) *(.data.rel*)
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
_edata = .; _edata = .;
......
...@@ -54,7 +54,7 @@ SECTIONS ...@@ -54,7 +54,7 @@ SECTIONS
{ {
_text = .; _text = .;
__stext = .; __stext = .;
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
*(.text.lock) *(.text.lock)
. = ALIGN(16); . = ALIGN(16);
...@@ -200,7 +200,7 @@ SECTIONS ...@@ -200,7 +200,7 @@ SECTIONS
__sdata = .; __sdata = .;
. = ALIGN(0x2000); . = ALIGN(0x2000);
*(.data.init_task) *(.data.init_task)
*(.data) DATA_DATA
. = ALIGN(32); . = ALIGN(32);
*(.data.cacheline_aligned) *(.data.cacheline_aligned)
......
...@@ -101,13 +101,14 @@ SECTIONS ...@@ -101,13 +101,14 @@ SECTIONS
_stext = .; _stext = .;
.text : { .text : {
*( *(
.text.start .text .text.* .text.start .text.*
#ifdef CONFIG_DEBUG_INFO #ifdef CONFIG_DEBUG_INFO
.init.text .init.text
.exit.text .exit.text
.exitcall.exit .exitcall.exit
#endif #endif
) )
TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -135,7 +136,8 @@ SECTIONS ...@@ -135,7 +136,8 @@ SECTIONS
_sdata = .; _sdata = .;
.data : { /* Data */ .data : { /* Data */
*(.data .data.*) DATA_DATA
*(.data.*)
*(.exit.data) *(.exit.data)
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -75,7 +75,7 @@ SECTIONS ...@@ -75,7 +75,7 @@ SECTIONS
*(.int_redirect) *(.int_redirect)
#endif #endif
__stext = . ; __stext = . ;
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
__etext = . ; __etext = . ;
...@@ -103,7 +103,7 @@ SECTIONS ...@@ -103,7 +103,7 @@ SECTIONS
. = ALIGN(0x2000) ; . = ALIGN(0x2000) ;
*(.data.init_task) *(.data.init_task)
. = ALIGN(0x4) ; . = ALIGN(0x4) ;
*(.data) DATA_DATA
. = ALIGN(0x4) ; . = ALIGN(0x4) ;
*(.data.*) *(.data.*)
......
...@@ -44,7 +44,7 @@ SECTIONS ...@@ -44,7 +44,7 @@ SECTIONS
/* read-only */ /* read-only */
.text : AT(ADDR(.text) - LOAD_OFFSET) { .text : AT(ADDR(.text) - LOAD_OFFSET) {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
KPROBES_TEXT KPROBES_TEXT
...@@ -74,7 +74,7 @@ SECTIONS ...@@ -74,7 +74,7 @@ SECTIONS
/* writeable */ /* writeable */
. = ALIGN(4096); . = ALIGN(4096);
.data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} :data } :data
......
...@@ -44,7 +44,7 @@ SECTIONS ...@@ -44,7 +44,7 @@ SECTIONS
.text : AT(ADDR(.text) - LOAD_OFFSET) .text : AT(ADDR(.text) - LOAD_OFFSET)
{ {
IVT_TEXT IVT_TEXT
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
KPROBES_TEXT KPROBES_TEXT
...@@ -214,7 +214,12 @@ SECTIONS ...@@ -214,7 +214,12 @@ SECTIONS
data : { } :data data : { } :data
.data : AT(ADDR(.data) - LOAD_OFFSET) .data : AT(ADDR(.data) - LOAD_OFFSET)
{ *(.data) *(.data1) *(.gnu.linkonce.d*) CONSTRUCTORS } {
DATA_DATA
*(.data1)
*(.gnu.linkonce.d*)
CONSTRUCTORS
}
. = ALIGN(16); /* gp must be 16-byte aligned for exc. table */ . = ALIGN(16); /* gp must be 16-byte aligned for exc. table */
.got : AT(ADDR(.got) - LOAD_OFFSET) .got : AT(ADDR(.got) - LOAD_OFFSET)
......
...@@ -27,7 +27,7 @@ SECTIONS ...@@ -27,7 +27,7 @@ SECTIONS
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
.boot : { *(.boot) } = 0 .boot : { *(.boot) } = 0
.text : { .text : {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -50,7 +50,7 @@ SECTIONS ...@@ -50,7 +50,7 @@ SECTIONS
.data : { /* Data */ .data : { /* Data */
*(.spu) *(.spu)
*(.spi) *(.spi)
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -11,7 +11,7 @@ SECTIONS ...@@ -11,7 +11,7 @@ SECTIONS
. = 0x1000; . = 0x1000;
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
.text : { .text : {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -28,7 +28,7 @@ SECTIONS ...@@ -28,7 +28,7 @@ SECTIONS
_etext = .; /* End of text section */ _etext = .; /* End of text section */
.data : { /* Data */ .data : { /* Data */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -12,7 +12,7 @@ SECTIONS ...@@ -12,7 +12,7 @@ SECTIONS
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
.text : { .text : {
*(.head) *(.head)
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -23,7 +23,7 @@ SECTIONS ...@@ -23,7 +23,7 @@ SECTIONS
_etext = .; /* End of text section */ _etext = .; /* End of text section */
.data : { /* Data */ .data : { /* Data */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
. = ALIGN(16); /* Exception table */ . = ALIGN(16); /* Exception table */
__start___ex_table = .; __start___ex_table = .;
......
...@@ -62,7 +62,7 @@ SECTIONS { ...@@ -62,7 +62,7 @@ SECTIONS {
.text : { .text : {
_text = .; _text = .;
_stext = . ; _stext = . ;
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
*(.text.lock) *(.text.lock)
...@@ -133,7 +133,7 @@ SECTIONS { ...@@ -133,7 +133,7 @@ SECTIONS {
.data DATA_ADDR : { .data DATA_ADDR : {
. = ALIGN(4); . = ALIGN(4);
_sdata = . ; _sdata = . ;
*(.data) DATA_DATA
. = ALIGN(8192) ; . = ALIGN(8192) ;
*(.data.init_task) *(.data.init_task)
_edata = . ; _edata = . ;
......
...@@ -27,7 +27,7 @@ SECTIONS ...@@ -27,7 +27,7 @@ SECTIONS
/* read-only */ /* read-only */
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
.text : { .text : {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -62,7 +62,7 @@ SECTIONS ...@@ -62,7 +62,7 @@ SECTIONS
. = ALIGN(_PAGE_SIZE); . = ALIGN(_PAGE_SIZE);
*(.data.init_task) *(.data.init_task)
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -51,7 +51,7 @@ SECTIONS ...@@ -51,7 +51,7 @@ SECTIONS
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
.text ALIGN(16) : { .text ALIGN(16) : {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.text.do_softirq) *(.text.do_softirq)
...@@ -91,7 +91,7 @@ SECTIONS ...@@ -91,7 +91,7 @@ SECTIONS
. = ALIGN(L1_CACHE_BYTES); . = ALIGN(L1_CACHE_BYTES);
.data : { /* Data */ .data : { /* Data */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -34,7 +34,8 @@ SECTIONS ...@@ -34,7 +34,8 @@ SECTIONS
/* Text and gots */ /* Text and gots */
.text : { .text : {
_text = .; _text = .;
*(.text .text.*) *(.text.*)
TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
KPROBES_TEXT KPROBES_TEXT
...@@ -167,7 +168,7 @@ SECTIONS ...@@ -167,7 +168,7 @@ SECTIONS
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
.data : .data :
{ {
*(.data) DATA_DATA
*(.sdata) *(.sdata)
*(.got.plt) *(.got) *(.got.plt) *(.got)
} }
......
...@@ -32,7 +32,7 @@ SECTIONS ...@@ -32,7 +32,7 @@ SECTIONS
.text : .text :
{ {
_text = .; _text = .;
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -67,7 +67,7 @@ SECTIONS ...@@ -67,7 +67,7 @@ SECTIONS
. = ALIGN(4096); . = ALIGN(4096);
.data : .data :
{ {
*(.data) DATA_DATA
*(.data1) *(.data1)
*(.sdata) *(.sdata)
*(.sdata2) *(.sdata2)
......
...@@ -21,7 +21,7 @@ SECTIONS ...@@ -21,7 +21,7 @@ SECTIONS
. = 0x00000000; . = 0x00000000;
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
.text : { .text : {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
KPROBES_TEXT KPROBES_TEXT
...@@ -48,7 +48,7 @@ SECTIONS ...@@ -48,7 +48,7 @@ SECTIONS
BUG_TABLE BUG_TABLE
.data : { /* Data */ .data : { /* Data */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -22,7 +22,7 @@ SECTIONS ...@@ -22,7 +22,7 @@ SECTIONS
*(.empty_zero_page) *(.empty_zero_page)
} = 0 } = 0
.text : { .text : {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -41,7 +41,7 @@ SECTIONS ...@@ -41,7 +41,7 @@ SECTIONS
BUG_TABLE BUG_TABLE
.data : { /* Data */ .data : { /* Data */
*(.data) DATA_DATA
/* Align the initial ramdisk image (INITRD) on page boundaries. */ /* Align the initial ramdisk image (INITRD) on page boundaries. */
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
......
...@@ -54,7 +54,7 @@ SECTIONS ...@@ -54,7 +54,7 @@ SECTIONS
} = 0 } = 0
.text : C_PHYS(.text) { .text : C_PHYS(.text) {
*(.text) TEXT_TEXT
*(.text64) *(.text64)
*(.text..SHmedia32) *(.text..SHmedia32)
SCHED_TEXT SCHED_TEXT
...@@ -78,7 +78,7 @@ SECTIONS ...@@ -78,7 +78,7 @@ SECTIONS
_etext = .; /* End of text section */ _etext = .; /* End of text section */
.data : C_PHYS(.data) { /* Data */ .data : C_PHYS(.data) { /* Data */
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -12,7 +12,7 @@ SECTIONS ...@@ -12,7 +12,7 @@ SECTIONS
.text 0xf0004000 : .text 0xf0004000 :
{ {
_text = .; _text = .;
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.gnu.warning) *(.gnu.warning)
...@@ -22,7 +22,7 @@ SECTIONS ...@@ -22,7 +22,7 @@ SECTIONS
RODATA RODATA
.data : .data :
{ {
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
.data1 : { *(.data1) } .data1 : { *(.data1) }
......
...@@ -14,7 +14,7 @@ SECTIONS ...@@ -14,7 +14,7 @@ SECTIONS
.text 0x0000000000404000 : .text 0x0000000000404000 :
{ {
_text = .; _text = .;
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
KPROBES_TEXT KPROBES_TEXT
...@@ -27,7 +27,7 @@ SECTIONS ...@@ -27,7 +27,7 @@ SECTIONS
.data : .data :
{ {
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} }
.data1 : { *(.data1) } .data1 : { *(.data1) }
......
...@@ -62,7 +62,7 @@ SECTIONS ...@@ -62,7 +62,7 @@ SECTIONS
} =0x90909090 } =0x90909090
.plt : { *(.plt) } .plt : { *(.plt) }
.text : { .text : {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -99,7 +99,8 @@ SECTIONS ...@@ -99,7 +99,8 @@ SECTIONS
*(.data.init_task) *(.data.init_task)
. = ALIGN(KERNEL_STACK_SIZE); . = ALIGN(KERNEL_STACK_SIZE);
*(.data.init_irqstack) *(.data.init_irqstack)
*(.data .data.* .gnu.linkonce.d.*) DATA_DATA
*(.data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS) SORT(CONSTRUCTORS)
} }
.data1 : { *(.data1) } .data1 : { *(.data1) }
......
...@@ -37,7 +37,7 @@ SECTIONS ...@@ -37,7 +37,7 @@ SECTIONS
.text : .text :
{ {
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
*(.fixup) *(.fixup)
...@@ -61,7 +61,7 @@ SECTIONS ...@@ -61,7 +61,7 @@ SECTIONS
*(.data.init_task) *(.data.init_task)
. = ALIGN(KERNEL_STACK_SIZE); . = ALIGN(KERNEL_STACK_SIZE);
*(.data.init_irqstack) *(.data.init_irqstack)
*(.data) DATA_DATA
*(.gnu.linkonce.d*) *(.gnu.linkonce.d*)
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
#define TEXT_CONTENTS \ #define TEXT_CONTENTS \
_text = .; \ _text = .; \
__stext = . ; \ __stext = . ; \
*(.text) \ TEXT_TEXT \
SCHED_TEXT \ SCHED_TEXT \
*(.exit.text) /* 2.5 convention */ \ *(.exit.text) /* 2.5 convention */ \
*(.text.exit) /* 2.4 convention */ \ *(.text.exit) /* 2.4 convention */ \
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
/* Kernel data segment. */ /* Kernel data segment. */
#define DATA_CONTENTS \ #define DATA_CONTENTS \
__sdata = . ; \ __sdata = . ; \
*(.data) \ DATA_DATA \
*(.exit.data) /* 2.5 convention */ \ *(.exit.data) /* 2.5 convention */ \
*(.data.exit) /* 2.4 convention */ \ *(.data.exit) /* 2.4 convention */ \
. = ALIGN (16) ; \ . = ALIGN (16) ; \
......
...@@ -31,7 +31,7 @@ SECTIONS ...@@ -31,7 +31,7 @@ SECTIONS
*(.bootstrap.text) *(.bootstrap.text)
_stext = .; _stext = .;
/* Then the rest */ /* Then the rest */
*(.text) TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
KPROBES_TEXT KPROBES_TEXT
...@@ -55,7 +55,7 @@ SECTIONS ...@@ -55,7 +55,7 @@ SECTIONS
. = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */
/* Data */ /* Data */
.data : AT(ADDR(.data) - LOAD_OFFSET) { .data : AT(ADDR(.data) - LOAD_OFFSET) {
*(.data) DATA_DATA
CONSTRUCTORS CONSTRUCTORS
} :data } :data
......
...@@ -84,7 +84,8 @@ SECTIONS ...@@ -84,7 +84,8 @@ SECTIONS
{ {
/* The .head.text section must be the first section! */ /* The .head.text section must be the first section! */
*(.head.text) *(.head.text)
*(.literal .text) *(.literal)
TEXT_TEXT
*(.srom.text) *(.srom.text)
VMLINUX_SYMBOL(__sched_text_start) = .; VMLINUX_SYMBOL(__sched_text_start) = .;
*(.sched.literal .sched.text) *(.sched.literal .sched.text)
...@@ -144,7 +145,8 @@ SECTIONS ...@@ -144,7 +145,8 @@ SECTIONS
_fdata = .; _fdata = .;
.data : .data :
{ {
*(.data) CONSTRUCTORS DATA_DATA
CONSTRUCTORS
. = ALIGN(XCHAL_ICACHE_LINESIZE); . = ALIGN(XCHAL_ICACHE_LINESIZE);
*(.data.cacheline_aligned) *(.data.cacheline_aligned)
} }
......
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
/* Align . to a 8 byte boundary equals to maximum function alignment. */ /* Align . to a 8 byte boundary equals to maximum function alignment. */
#define ALIGN_FUNCTION() . = ALIGN(8) #define ALIGN_FUNCTION() . = ALIGN(8)
/* .data section */
#define DATA_DATA \
*(.data) \
*(.data.init.refok)
#define RODATA \ #define RODATA \
. = ALIGN(4096); \ . = ALIGN(4096); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
...@@ -139,6 +144,13 @@ ...@@ -139,6 +144,13 @@
VMLINUX_SYMBOL(__security_initcall_end) = .; \ VMLINUX_SYMBOL(__security_initcall_end) = .; \
} }
/* .text section. Map to function alignment to avoid address changes
* during second ld run in second ld pass when generating System.map */
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
*(.text) \
*(.text.init.refok)
/* sched.text is aling to function alignment to secure we have same /* sched.text is aling to function alignment to secure we have same
* address even at second ld pass when generating System.map */ * address even at second ld pass when generating System.map */
#define SCHED_TEXT \ #define SCHED_TEXT \
......
...@@ -45,6 +45,19 @@ ...@@ -45,6 +45,19 @@
#define __exitdata __attribute__ ((__section__(".exit.data"))) #define __exitdata __attribute__ ((__section__(".exit.data")))
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) #define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
/* modpost check for section mismatches during the kernel build.
* A section mismatch happens when there are references from a
* code or data section to an init section (both code or data).
* The init sections are (for most archs) discarded by the kernel
* when early init has completed so all such references are potential bugs.
* For exit sections the same issue exists.
* The following markers are used for the cases where the reference to
* the init/exit section (code or data) is valid and will teach modpost
* not to issue a warning.
* The markers follow same syntax rules as __init / __initdata. */
#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok")))
#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
#ifdef MODULE #ifdef MODULE
#define __exit __attribute__ ((__section__(".exit.text"))) #define __exit __attribute__ ((__section__(".exit.text")))
#else #else
......
...@@ -423,7 +423,7 @@ static void __init setup_command_line(char *command_line) ...@@ -423,7 +423,7 @@ static void __init setup_command_line(char *command_line)
* gcc-3.4 accidentally inlines this function, so use noinline. * gcc-3.4 accidentally inlines this function, so use noinline.
*/ */
static void noinline rest_init(void) static void noinline __init_refok rest_init(void)
__releases(kernel_lock) __releases(kernel_lock)
{ {
int pid; int pid;
......
...@@ -2165,7 +2165,7 @@ void __init setup_per_cpu_pageset(void) ...@@ -2165,7 +2165,7 @@ void __init setup_per_cpu_pageset(void)
#endif #endif
static __meminit noinline static noinline __init_refok
int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages) int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages)
{ {
int i; int i;
...@@ -2678,7 +2678,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat, ...@@ -2678,7 +2678,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
} }
} }
static void __meminit alloc_node_mem_map(struct pglist_data *pgdat) static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat)
{ {
/* Skip empty nodes */ /* Skip empty nodes */
if (!pgdat->node_spanned_pages) if (!pgdat->node_spanned_pages)
......
...@@ -2037,7 +2037,7 @@ static size_t calculate_slab_order(struct kmem_cache *cachep, ...@@ -2037,7 +2037,7 @@ static size_t calculate_slab_order(struct kmem_cache *cachep,
return left_over; return left_over;
} }
static int setup_cpu_cache(struct kmem_cache *cachep) static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
{ {
if (g_cpucache_up == FULL) if (g_cpucache_up == FULL)
return enable_cpucache(cachep); return enable_cpucache(cachep);
......
...@@ -44,7 +44,7 @@ EXPORT_SYMBOL(page_to_nid); ...@@ -44,7 +44,7 @@ EXPORT_SYMBOL(page_to_nid);
#endif #endif
#ifdef CONFIG_SPARSEMEM_EXTREME #ifdef CONFIG_SPARSEMEM_EXTREME
static struct mem_section noinline *sparse_index_alloc(int nid) static struct mem_section noinline __init_refok *sparse_index_alloc(int nid)
{ {
struct mem_section *section = NULL; struct mem_section *section = NULL;
unsigned long array_size = SECTIONS_PER_ROOT * unsigned long array_size = SECTIONS_PER_ROOT *
......
...@@ -4,21 +4,15 @@ ...@@ -4,21 +4,15 @@
# What library to link # What library to link
ldflags() ldflags()
{ {
$cc -print-file-name=libncursesw.so | grep -q / for ext in so a dylib ; do
if [ $? -eq 0 ]; then for lib in ncursesw ncurses curses ; do
echo '-lncursesw' $cc -print-file-name=lib${lib}.${ext} | grep -q /
exit if [ $? -eq 0 ]; then
fi echo "-l${lib}"
$cc -print-file-name=libncurses.so | grep -q / exit
if [ $? -eq 0 ]; then fi
echo '-lncurses' done
exit done
fi
$cc -print-file-name=libcurses.so | grep -q /
if [ $? -eq 0 ]; then
echo '-lcurses'
exit
fi
exit 1 exit 1
} }
......
...@@ -353,11 +353,16 @@ static int do_pcmcia_entry(const char *filename, ...@@ -353,11 +353,16 @@ static int do_pcmcia_entry(const char *filename,
static int do_of_entry (const char *filename, struct of_device_id *of, char *alias) static int do_of_entry (const char *filename, struct of_device_id *of, char *alias)
{ {
int len;
char *tmp; char *tmp;
sprintf (alias, "of:N%sT%sC%s", len = sprintf (alias, "of:N%sT%s",
of->name[0] ? of->name : "*", of->name[0] ? of->name : "*",
of->type[0] ? of->type : "*", of->type[0] ? of->type : "*");
of->compatible[0] ? of->compatible : "*");
if (of->compatible[0])
sprintf (&alias[len], "%sC%s",
of->type[0] ? "*" : "",
of->compatible);
/* Replace all whitespace with underscores */ /* Replace all whitespace with underscores */
for (tmp = alias; tmp && *tmp; tmp++) for (tmp = alias; tmp && *tmp; tmp++)
......
...@@ -384,6 +384,7 @@ static int parse_elf(struct elf_info *info, const char *filename) ...@@ -384,6 +384,7 @@ static int parse_elf(struct elf_info *info, const char *filename)
sechdrs[i].sh_size = TO_NATIVE(sechdrs[i].sh_size); sechdrs[i].sh_size = TO_NATIVE(sechdrs[i].sh_size);
sechdrs[i].sh_link = TO_NATIVE(sechdrs[i].sh_link); sechdrs[i].sh_link = TO_NATIVE(sechdrs[i].sh_link);
sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name); sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name);
sechdrs[i].sh_info = TO_NATIVE(sechdrs[i].sh_info);
} }
/* Find symbol table. */ /* Find symbol table. */
for (i = 1; i < hdr->e_shnum; i++) { for (i = 1; i < hdr->e_shnum; i++) {
...@@ -582,6 +583,12 @@ static int strrcmp(const char *s, const char *sub) ...@@ -582,6 +583,12 @@ static int strrcmp(const char *s, const char *sub)
/** /**
* Whitelist to allow certain references to pass with no warning. * Whitelist to allow certain references to pass with no warning.
*
* Pattern 0:
* Do not warn if funtion/data are marked with __init_refok/__initdata_refok.
* The pattern is identified by:
* fromsec = .text.init.refok | .data.init.refok
*
* Pattern 1: * Pattern 1:
* If a module parameter is declared __initdata and permissions=0 * If a module parameter is declared __initdata and permissions=0
* then this is legal despite the warning generated. * then this is legal despite the warning generated.
...@@ -619,14 +626,6 @@ static int strrcmp(const char *s, const char *sub) ...@@ -619,14 +626,6 @@ static int strrcmp(const char *s, const char *sub)
* This pattern is identified by * This pattern is identified by
* refsymname = __init_begin, _sinittext, _einittext * refsymname = __init_begin, _sinittext, _einittext
* *
* Pattern 6:
* During the early init phase we have references from .init.text to
* .text we have an intended section mismatch - do not warn about it.
* See kernel_init() in init/main.c
* tosec = .init.text
* fromsec = .text
* atsym = kernel_init
*
* Pattern 7: * Pattern 7:
* Logos used in drivers/video/logo reside in __initdata but the * Logos used in drivers/video/logo reside in __initdata but the
* funtion that references them are EXPORT_SYMBOL() so cannot be * funtion that references them are EXPORT_SYMBOL() so cannot be
...@@ -642,16 +641,11 @@ static int strrcmp(const char *s, const char *sub) ...@@ -642,16 +641,11 @@ static int strrcmp(const char *s, const char *sub)
* tosec = .init.text * tosec = .init.text
* fromsec = .paravirtprobe * fromsec = .paravirtprobe
* *
* Pattern 9:
* Some of functions are common code between boot time and hotplug
* time. The bootmem allocater is called only boot time in its
* functions. So it's ok to reference.
* tosec = .init.text
*
* Pattern 10: * Pattern 10:
* ia64 has machvec table for each platform. It is mixture of function * ia64 has machvec table for each platform and
* pointer of .init.text and .text. * powerpc has a machine desc table for each platform.
* fromsec = .machvec * It is mixture of function pointers of .init.text and .text.
* fromsec = .machvec | .machine.desc
**/ **/
static int secref_whitelist(const char *modname, const char *tosec, static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym, const char *fromsec, const char *atsym,
...@@ -678,11 +672,10 @@ static int secref_whitelist(const char *modname, const char *tosec, ...@@ -678,11 +672,10 @@ static int secref_whitelist(const char *modname, const char *tosec,
NULL NULL
}; };
const char *pat4sym[] = { /* Check for pattern 0 */
"sparse_index_alloc", if ((strcmp(fromsec, ".text.init.refok") == 0) ||
"zone_wait_table_init", (strcmp(fromsec, ".data.init.refok") == 0))
NULL return 1;
};
/* Check for pattern 1 */ /* Check for pattern 1 */
if (strcmp(tosec, ".init.data") != 0) if (strcmp(tosec, ".init.data") != 0)
...@@ -725,12 +718,6 @@ static int secref_whitelist(const char *modname, const char *tosec, ...@@ -725,12 +718,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
if (strcmp(refsymname, *s) == 0) if (strcmp(refsymname, *s) == 0)
return 1; return 1;
/* Check for pattern 6 */
if ((strcmp(tosec, ".init.text") == 0) &&
(strcmp(fromsec, ".text") == 0) &&
(strcmp(refsymname, "kernel_init") == 0))
return 1;
/* Check for pattern 7 */ /* Check for pattern 7 */
if ((strcmp(tosec, ".init.data") == 0) && if ((strcmp(tosec, ".init.data") == 0) &&
(strncmp(fromsec, ".text", strlen(".text")) == 0) && (strncmp(fromsec, ".text", strlen(".text")) == 0) &&
...@@ -742,15 +729,9 @@ static int secref_whitelist(const char *modname, const char *tosec, ...@@ -742,15 +729,9 @@ static int secref_whitelist(const char *modname, const char *tosec,
(strcmp(fromsec, ".paravirtprobe") == 0)) (strcmp(fromsec, ".paravirtprobe") == 0))
return 1; return 1;
/* Check for pattern 9 */
if ((strcmp(tosec, ".init.text") == 0) &&
(strcmp(fromsec, ".text") == 0))
for (s = pat4sym; *s; s++)
if (strcmp(atsym, *s) == 0)
return 1;
/* Check for pattern 10 */ /* Check for pattern 10 */
if (strcmp(fromsec, ".machvec") == 0) if ((strcmp(fromsec, ".machvec") == 0) ||
(strcmp(fromsec, ".machine.desc") == 0))
return 1; return 1;
return 0; return 0;
...@@ -773,6 +754,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr, ...@@ -773,6 +754,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
if (sym->st_shndx != relsym->st_shndx) if (sym->st_shndx != relsym->st_shndx)
continue; continue;
if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
continue;
if (sym->st_value == addr) if (sym->st_value == addr)
return sym; return sym;
} }
...@@ -884,33 +867,99 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, ...@@ -884,33 +867,99 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
elf->strtab + before->st_name, refsymname)) elf->strtab + before->st_name, refsymname))
return; return;
/* fromsec whitelist - without a valid 'before'
* powerpc has a GOT table in .got2 section */
if (strcmp(fromsec, ".got2") == 0)
return;
if (before && after) { if (before && after) {
warn("%s - Section mismatch: reference to %s:%s from %s " warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"between '%s' (at offset 0x%llx) and '%s'\n", "(between '%s' and '%s')\n",
modname, secname, refsymname, fromsec, modname, fromsec, (unsigned long long)r.r_offset,
secname, refsymname,
elf->strtab + before->st_name, elf->strtab + before->st_name,
(long long)r.r_offset,
elf->strtab + after->st_name); elf->strtab + after->st_name);
} else if (before) { } else if (before) {
warn("%s - Section mismatch: reference to %s:%s from %s " warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"after '%s' (at offset 0x%llx)\n", "(after '%s')\n",
modname, secname, refsymname, fromsec, modname, fromsec, (unsigned long long)r.r_offset,
elf->strtab + before->st_name, secname, refsymname,
(long long)r.r_offset); elf->strtab + before->st_name);
} else if (after) { } else if (after) {
warn("%s - Section mismatch: reference to %s:%s from %s " warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"before '%s' (at offset -0x%llx)\n", "before '%s' (at offset -0x%llx)\n",
modname, secname, refsymname, fromsec, modname, fromsec, (unsigned long long)r.r_offset,
elf->strtab + after->st_name, secname, refsymname,
(long long)r.r_offset); elf->strtab + after->st_name);
} else { } else {
warn("%s - Section mismatch: reference to %s:%s from %s " warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
"(offset 0x%llx)\n", modname, fromsec, (unsigned long long)r.r_offset,
modname, secname, fromsec, refsymname, secname, refsymname);
(long long)r.r_offset);
} }
} }
static void addend_386_rel(struct elf_info *elf, int section, Elf_Rela *r)
{
Elf_Shdr *sechdrs = elf->sechdrs;
unsigned int r_typ;
unsigned int *location;
r_typ = ELF_R_TYPE(r->r_info);
location = (void *)elf->hdr +
sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset;
switch (r_typ) {
case R_386_32:
r->r_addend = TO_NATIVE(*location);
break;
case R_386_PC32:
r->r_addend = TO_NATIVE(*location) + 4;
break;
}
}
static void addend_arm_rel(struct elf_info *elf, int section, Elf_Rela *r)
{
Elf_Shdr *sechdrs = elf->sechdrs;
unsigned int r_typ;
unsigned int *location;
r_typ = ELF_R_TYPE(r->r_info);
location = (void *)elf->hdr +
sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset;
switch (r_typ) {
case R_ARM_ABS32:
r->r_addend = TO_NATIVE(*location);
break;
case R_ARM_PC24:
r->r_addend = ((TO_NATIVE(*location) & 0x00ffffff) << 2) + 8;
break;
}
}
static int addend_mips_rel(struct elf_info *elf, int section, Elf_Rela *r)
{
Elf_Shdr *sechdrs = elf->sechdrs;
unsigned int r_typ;
unsigned int *location;
unsigned int inst;
r_typ = ELF_R_TYPE(r->r_info);
if (r_typ == R_MIPS_HI16)
return 1; /* skip this */
location = (void *)elf->hdr +
sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset;
inst = TO_NATIVE(*location);
switch (r_typ) {
case R_MIPS_LO16:
r->r_addend = ((inst & 0xffff) ^ 0x8000) - 0x8000;
break;
case R_MIPS_26:
r->r_addend = (inst & 0x03ffffff) << 2;
break;
}
return 0;
}
/** /**
* A module includes a number of sections that are discarded * A module includes a number of sections that are discarded
* either when loaded or when used as built-in. * either when loaded or when used as built-in.
...@@ -954,8 +1003,11 @@ static void check_sec_ref(struct module *mod, const char *modname, ...@@ -954,8 +1003,11 @@ static void check_sec_ref(struct module *mod, const char *modname,
r.r_offset = TO_NATIVE(rela->r_offset); r.r_offset = TO_NATIVE(rela->r_offset);
#if KERNEL_ELFCLASS == ELFCLASS64 #if KERNEL_ELFCLASS == ELFCLASS64
if (hdr->e_machine == EM_MIPS) { if (hdr->e_machine == EM_MIPS) {
unsigned int r_typ;
r_sym = ELF64_MIPS_R_SYM(rela->r_info); r_sym = ELF64_MIPS_R_SYM(rela->r_info);
r_sym = TO_NATIVE(r_sym); r_sym = TO_NATIVE(r_sym);
r_typ = ELF64_MIPS_R_TYPE(rela->r_info);
r.r_info = ELF64_R_INFO(r_sym, r_typ);
} else { } else {
r.r_info = TO_NATIVE(rela->r_info); r.r_info = TO_NATIVE(rela->r_info);
r_sym = ELF_R_SYM(r.r_info); r_sym = ELF_R_SYM(r.r_info);
...@@ -988,8 +1040,11 @@ static void check_sec_ref(struct module *mod, const char *modname, ...@@ -988,8 +1040,11 @@ static void check_sec_ref(struct module *mod, const char *modname,
r.r_offset = TO_NATIVE(rel->r_offset); r.r_offset = TO_NATIVE(rel->r_offset);
#if KERNEL_ELFCLASS == ELFCLASS64 #if KERNEL_ELFCLASS == ELFCLASS64
if (hdr->e_machine == EM_MIPS) { if (hdr->e_machine == EM_MIPS) {
unsigned int r_typ;
r_sym = ELF64_MIPS_R_SYM(rel->r_info); r_sym = ELF64_MIPS_R_SYM(rel->r_info);
r_sym = TO_NATIVE(r_sym); r_sym = TO_NATIVE(r_sym);
r_typ = ELF64_MIPS_R_TYPE(rel->r_info);
r.r_info = ELF64_R_INFO(r_sym, r_typ);
} else { } else {
r.r_info = TO_NATIVE(rel->r_info); r.r_info = TO_NATIVE(rel->r_info);
r_sym = ELF_R_SYM(r.r_info); r_sym = ELF_R_SYM(r.r_info);
...@@ -999,6 +1054,14 @@ static void check_sec_ref(struct module *mod, const char *modname, ...@@ -999,6 +1054,14 @@ static void check_sec_ref(struct module *mod, const char *modname,
r_sym = ELF_R_SYM(r.r_info); r_sym = ELF_R_SYM(r.r_info);
#endif #endif
r.r_addend = 0; r.r_addend = 0;
if (hdr->e_machine == EM_386)
addend_386_rel(elf, i, &r);
else if (hdr->e_machine == EM_ARM)
addend_arm_rel(elf, i, &r);
else if (hdr->e_machine == EM_MIPS) {
if (addend_mips_rel(elf, i, &r))
continue;
}
sym = elf->symtab_start + r_sym; sym = elf->symtab_start + r_sym;
/* Skip special sections */ /* Skip special sections */
if (sym->st_shndx >= SHN_LORESERVE) if (sym->st_shndx >= SHN_LORESERVE)
......
...@@ -60,6 +60,9 @@ typedef union ...@@ -60,6 +60,9 @@ typedef union
#define ELF64_MIPS_R_SYM(i) \ #define ELF64_MIPS_R_SYM(i) \
((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym) ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
#define ELF64_MIPS_R_TYPE(i) \
((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1)
#if KERNEL_ELFDATA != HOST_ELFDATA #if KERNEL_ELFDATA != HOST_ELFDATA
static inline void __endian(const void *src, void *dest, unsigned int size) static inline void __endian(const void *src, void *dest, unsigned int size)
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include "modpost.h" #include "modpost.h"
/* /*
......
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