Commit a58b228f authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-isdn.bkbits.net/linux-2.5.make

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 8bdf7c39 d6699e96
......@@ -394,6 +394,17 @@ $(SUBDIRS): .hdepend prepare
prepare: include/linux/version.h include/asm include/config/MARKER
@echo ' Starting the build. KBUILD_BUILTIN=$(KBUILD_BUILTIN) KBUILD_MODULES=$(KBUILD_MODULES)'
# We need to build init/vermagic.o before descending since all modules
# (*.ko) need it already
ifdef CONFIG_MODULES
prepare: init/vermagic.o
init/vermagic.o: include/linux/version.h
endif
# This can be used by arch/$ARCH/Makefile to preprocess
# their vmlinux.lds.S file
......
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf64-alpha")
ENTRY(__start)
......@@ -25,29 +26,7 @@ SECTIONS
__stop___ex_table = .;
}
/* Kernel symbol table */
__ksymtab ALIGN(8) : {
__start___ksymtab = .;
*(__ksymtab)
__stop___ksymtab = .;
}
/* Kernel symbol table: GPL only */
__gpl_ksymtab ALIGN(8) : {
__start___gpl_ksymtab = .;
*(__gpl_ksymtab)
__stop___gpl_ksymtab = .;
}
/* All kernel symbols */
__kallsyms ALIGN(8) : {
__start___kallsyms = .;
*(__kallsyms)
__stop___kallsyms = .;
}
.kstrtab : { *(.kstrtab) }
.rodata : { *(.rodata) *(.rodata.*) }
RODATA
/* Startup code */
.init.text ALIGN(8192) : {
......
......@@ -2,6 +2,9 @@
* taken from the i386 version by Russell King
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(arm)
ENTRY(stext)
jiffies = jiffies_64;
......@@ -63,8 +66,6 @@ SECTIONS
_etext = .; /* End of text section */
}
.kstrtab : { *(.kstrtab) }
. = ALIGN(16);
__ex_table : { /* Exception table */
__start___ex_table = .;
......@@ -72,17 +73,7 @@ SECTIONS
__stop___ex_table = .;
}
__ksymtab : { /* Kernel symbol table */
__start___ksymtab = .;
*(__ksymtab)
__stop___ksymtab = .;
}
__gpl_ksymtab : { /* Kernel symbol table: GPL-only */
__start___gpl_ksymtab = .;
*(__gpl_ksymtab)
__stop___gpl_ksymtab = .;
}
RODATA
.data : {
/*
......
......@@ -2,6 +2,9 @@
* taken from the i386 version by Russell King
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(arm)
ENTRY(stext)
jiffies = jiffies_64;
......@@ -66,8 +69,6 @@ SECTIONS
_etext = .; /* End of text section */
}
.kstrtab : { *(.kstrtab) }
. = ALIGN(16);
__ex_table : { /* Exception table */
__start___ex_table = .;
......@@ -75,23 +76,7 @@ SECTIONS
__stop___ex_table = .;
}
__gpl_ksymtab : { /* GPL Kernel symbol table */
__start___gpl_ksymtab = .;
*(__gpl_ksymtab)
__stop___gpl_ksymtab = .;
}
__ksymtab : { /* Kernel symbol table */
__start___ksymtab = .;
*(__ksymtab)
__stop___ksymtab = .;
}
__kallsyms : { /* All kernel symbols */
__start___kallsyms = .;
*(__kallsyms)
__stop___kallsyms = .;
}
RODATA
. = ALIGN(8192);
......
......@@ -9,7 +9,8 @@
*/
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
jiffies = jiffies_64;
SECTIONS
{
......@@ -31,21 +32,12 @@ SECTIONS
_etext = . ; /* End of text section */
__etext = .;
.rodata : { *(.rodata) *(.rodata.__*) }
.kstrtab : { *(.kstrtab) }
. = ALIGN(4); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
. = ALIGN (4);
___data_start = . ;
......
/* ld script to make i386 Linux kernel
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
......@@ -18,26 +21,12 @@ SECTIONS
_etext = .; /* End of text section */
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
RODATA
/* writeable */
.data : { /* Data */
......
......@@ -90,6 +90,8 @@ SECTIONS
{ *(.rodata) *(.rodata.*) }
.kstrtab : AT(ADDR(.kstrtab) - PAGE_OFFSET)
{ *(.kstrtab) }
__vermagic : AT(ADDR(__vermagic) - PAGE_OFFSET)
{ *(__vermagic) }
.opd : AT(ADDR(.opd) - PAGE_OFFSET)
{ *(.opd) }
......
/* ld script to make m68k Linux kernel */
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
OUTPUT_ARCH(m68k)
ENTRY(_start)
......@@ -12,21 +15,13 @@ SECTIONS
*(.fixup)
*(.gnu.warning)
} = 0x4e75
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL only */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
_etext = .; /* End of text section */
......
/* ld script to make m68k Linux kernel */
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
OUTPUT_ARCH(m68k)
ENTRY(_start)
......@@ -13,26 +16,16 @@ SECTIONS
*(.fixup)
*(.gnu.warning)
} = 0x4e75
.kstrtab : { *(.kstrtab) }
_etext = .; /* End of text section */
.data : { /* Data */
*(.rodata)
*(.rodata.*)
*(.data)
RODATA
CONSTRUCTORS
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
*(__ex_table)
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
*(__ksymtab)
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
}
/* End of data goes *here* so that freeing init code works properly. */
_edata = .;
......
......@@ -10,6 +10,7 @@
*/
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
/*
* Original Palm pilot (same for Xcopilot).
......@@ -219,20 +220,13 @@ SECTIONS {
_stext = . ;
*(.text)
*(.text.lock)
*(.rodata)
*(.rodata.*)
. = ALIGN(0x4) ;
*(.kstrtab)
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
*(__ex_table)
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
*(__ksymtab)
__stop___ksymtab = .;
RODATA
. = ALIGN(4) ;
_etext = . ;
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(mips)
ENTRY(kernel_entry)
SECTIONS
......@@ -9,12 +11,9 @@ SECTIONS
{
_ftext = . ;
*(.text)
*(.rodata)
*(.rodata1)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =0
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
......@@ -25,14 +24,8 @@ SECTIONS
__dbe_table : { *(__dbe_table) }
__stop___dbe_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
_etext = .;
. = ALIGN(8192);
......
......@@ -25,6 +25,7 @@ SECTIONS
*(.gnu.warning)
} = 0
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(mips)
ENTRY(kernel_entry)
SECTIONS
......@@ -7,13 +9,9 @@ SECTIONS
.text :
{
*(.text)
*(.rodata)
*(.rodata.*)
*(.rodata1)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =0
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
......@@ -24,6 +22,8 @@ SECTIONS
__dbe_table : { *(__dbe_table) }
__stop___dbe_table = .;
RODATA
_etext = .;
. = ALIGN(16384);
......
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
/* ld script to make hppa Linux kernel */
#ifndef CONFIG_PARISC64
OUTPUT_FORMAT("elf32-hppa-linux")
......@@ -31,31 +32,17 @@ SECTIONS
_etext = .; /* End of text section */
. = ALIGN(16);
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
.data BLOCK(8192) : { /* Data without special */
data_start = .;
*(.data)
}
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
.data BLOCK(8192) : { /* Data without special */
data_start = .;
*(.data)
}
#ifdef CONFIG_PARISC64
. = ALIGN(16); /* Linkage tables */
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(powerpc)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
/* Do we need any of these for elf?
......@@ -40,13 +42,8 @@ SECTIONS
}
_etext = .;
PROVIDE (etext = .);
.rodata :
{
*(.rodata)
*(.rodata.*)
*(.rodata1)
}
.kstrtab : { *(.kstrtab) }
RODATA
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
......@@ -57,18 +54,6 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
/* Read-write section, merged into data segment: */
. = ALIGN(4096);
.data :
......
......@@ -42,6 +42,7 @@ SECTIONS
*(.rodata1)
}
.kstrtab : { *(.kstrtab) }
__vermagic : { *(__vermagic) }
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_ARCH(powerpc:common64)
/* Do we need any of these for elf?
__DYNAMIC = 0; */
......@@ -37,11 +39,9 @@ SECTIONS
. = ALIGN(4096);
_etext = .;
PROVIDE (etext = .);
.rodata :
{
*(.rodata)
*(.rodata1)
}
RODATA
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
......@@ -65,18 +65,6 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
. = ALIGN(16384); /* init_task */
.data.init_task : { *(.data.init_task) }
......
/* ld script to make s390 Linux kernel
* Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
OUTPUT_ARCH(s390)
ENTRY(_start)
......@@ -17,22 +20,12 @@ SECTIONS
_etext = .; /* End of text section */
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
#ifdef CONFIG_SHARED_KERNEL
. = ALIGN(1048576); /* VM shared segments are 1MB aligned */
......
/*
* Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
OUTPUT_ARCH(s390:64-bit)
ENTRY(_start)
......@@ -17,22 +20,12 @@ SECTIONS
_etext = .; /* End of text section */
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
RODATA
#ifdef CONFIG_SHARED_KERNEL
. = ALIGN(1048576); /* VM shared segments are 1MB aligned */
......
......@@ -3,6 +3,8 @@
* Written by Niibe Yutaka
*/
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
#ifdef CONFIG_CPU_LITTLE_ENDIAN
OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
jiffies = jiffies_64;
......@@ -25,25 +27,13 @@ SECTIONS
*(.fixup)
*(.gnu.warning)
} = 0x0009
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
RODATA
_etext = .; /* End of text section */
......
/* ld script to make SparcLinux kernel */
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
OUTPUT_ARCH(sparc)
ENTRY(_start)
......@@ -13,8 +16,7 @@ SECTIONS
} =0
_etext = .;
PROVIDE (etext = .);
.rodata : { *(.rodata) *(.rodata.*) }
.rodata1 : { *(.rodata1) }
RODATA
.data :
{
*(.data)
......@@ -30,19 +32,6 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .;
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .;
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
. = ALIGN(4096);
__init_begin = .;
.init.text : { *(.init.text) }
......
/* ld script to make UltraLinux kernel */
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
OUTPUT_ARCH(sparc:v9a)
ENTRY(_start)
......@@ -16,8 +19,9 @@ SECTIONS
} =0
_etext = .;
PROVIDE (etext = .);
.rodata : { *(.rodata) *(.rodata.*) }
.rodata1 : { *(.rodata1) }
RODATA
.data :
{
*(.data)
......@@ -35,17 +39,6 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .;
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .;
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__kstrtab : { *(.kstrtab) }
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
. = ALIGN(8192);
__init_begin = .;
.init.text : { *(.init.text) }
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT(ELF_FORMAT)
OUTPUT_ARCH(ELF_ARCH)
ENTRY(_start)
......@@ -31,20 +33,15 @@ SECTIONS
*(.gnu.warning)
*(.gnu.linkonce.t*)
}
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
RODATA
.fini : { *(.fini) } =0x9090
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
.rodata1 : { *(.rodata1) }
_etext = .;
PROVIDE (etext = .);
......
......@@ -12,6 +12,7 @@
*/
#include <linux/config.h>
#include <asm-generic/vmlinux.lds.h>
/* The following macros contain the usual definitions for various data areas.
......@@ -38,9 +39,7 @@
*(.text.lock) \
*(.exitcall.exit) \
__real_etext = . ; /* There may be data after here. */ \
*(.rodata) \
. = ALIGN (0x4) ; \
*(.kstrtab) \
RODATA \
. = ALIGN (4) ; \
*(.call_table_data) \
*(.call_table_text) \
......@@ -48,12 +47,6 @@
___start___ex_table = . ; \
*(__ex_table) \
___stop___ex_table = . ; \
___start___ksymtab = . ;/* Kernel symbol table. */ \
*(__ksymtab) \
___stop___ksymtab = . ; \
___start___gpl_ksymtab = . ; /* Same for GPL symbols. */ \
*(__gpl_ksymtab) \
___stop___gpl_ksymtab = . ; \
. = ALIGN (4) ; \
__etext = . ;
......
/* ld script to make x86-64 Linux kernel
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
*/
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
......@@ -18,25 +21,12 @@ SECTIONS
_etext = .; /* End of text section */
.rodata : { *(.rodata) *(.rodata.*) }
.kstrtab : { *(.kstrtab) }
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(64);
__start___ksymtab = .; /* Kernel symbol table */
__ksymtab : { *(__ksymtab) }
__stop___ksymtab = .;
__start___gpl_ksymtab = .; /* Kernel symbol table: GPL-only symbols */
__gpl_ksymtab : { *(__gpl_ksymtab) }
__stop___gpl_ksymtab = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
RODATA
.data : { /* Data */
*(.data)
......
#define RODATA \
.rodata : { *(.rodata) *(.rodata.*) *(.rodata1) } \
.rodata1 : { *(.rodata1) } \
\
.kstrtab : { *(.kstrtab) } \
\
/* Kernel version magic */ \
__vermagic : { *(__vermagic) } \
\
/* Kernel symbol table */ \
. = ALIGN(64); \
__start___ksymtab = .; \
__ksymtab : { *(__ksymtab) } \
__stop___ksymtab = .; \
\
/* Kernel symbol table: GPL-only symbols */ \
__start___gpl_ksymtab = .; \
__gpl_ksymtab : { *(__gpl_ksymtab) } \
__stop___gpl_ksymtab = .; \
\
/* All kernel symbols */ \
__start___kallsyms = .; \
__kallsyms : { *(__kallsyms) } \
__stop___kallsyms = .; \
#ifndef _ASM_I386_MODULE_H
#define _ASM_I386_MODULE_H
/* x86 is simple */
struct mod_arch_specific
{
......@@ -8,4 +9,47 @@ struct mod_arch_specific
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Ehdr Elf32_Ehdr
#ifdef CONFIG_M386
#define MODULE_PROC_FAMILY "386 "
#elif CONFIG_M486
#define MODULE_PROC_FAMILY "486 "
#elif CONFIG_M586
#define MODULE_PROC_FAMILY "586 "
#elif CONFIG_M586TSC
#define MODULE_PROC_FAMILY "586TSC "
#elif CONFIG_M586MMX
#define MODULE_PROC_FAMILY "586MMX "
#elif CONFIG_M686
#define MODULE_PROC_FAMILY "686 "
#elif CONFIG_MPENTIUMII
#define MODULE_PROC_FAMILY "PENTIUMII "
#elif CONFIG_MPENTIUMIII
#define MODULE_PROC_FAMILY "PENTIUMIII "
#elif CONFIG_MPENTIUM4
#define MODULE_PROC_FAMILY "PENTIUM4 "
#elif CONFIG_MK6
#define MODULE_PROC_FAMILY "K6 "
#elif CONFIG_MK7
#define MODULE_PROC_FAMILY "K7 "
#elif CONFIG_MK8
#define MODULE_PROC_FAMILY "K8 "
#elif CONFIG_MELAN
#define MODULE_PROC_FAMILY "ELAN "
#elif CONFIG_MCRUSOE
#define MODULE_PROC_FAMILY "CRUSOE "
#elif CONFIG_MWINCHIPC6
#define MODULE_PROC_FAMILY "WINCHIPC6 "
#elif CONFIG_MWINCHIP2
#define MODULE_PROC_FAMILY "WINCHIP2 "
#elif CONFIG_MWINCHIP3D
#define MODULE_PROC_FAMILY "WINCHIP3D "
#elif CONFIG_MCYRIXIII
#define MODULE_PROC_FAMILY "CYRIXIII "
#else
#error unknown processor family
#endif
#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
#endif /* _ASM_I386_MODULE_H */
......@@ -2,7 +2,8 @@
# Makefile for the linux kernel.
#
obj-y := main.o version.o do_mounts.o initramfs.o
obj-y := main.o version.o do_mounts.o initramfs.o
obj-$(CONFIG_MODULES) += vermagic.o
# files to be removed upon make clean
clean-files := ../include/linux/compile.h
......
#include <linux/version.h>
#include <linux/module.h>
/* Simply sanity version stamp for modules. */
#ifdef CONFIG_SMP
#define MODULE_VERMAGIC_SMP "SMP "
#else
#define MODULE_VERMAGIC_SMP ""
#endif
#ifdef CONFIG_PREEMPT
#define MODULE_VERMAGIC_PREEMPT "preempt "
#else
#define MODULE_VERMAGIC_PREEMPT ""
#endif
#ifndef MODULE_ARCH_VERMAGIC
#define MODULE_ARCH_VERMAGIC ""
#endif
const char vermagic[] __attribute__((section("__vermagic"))) =
UTS_RELEASE " "
MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT MODULE_ARCH_VERMAGIC
"gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__);
......@@ -963,6 +963,9 @@ static void set_license(struct module *mod, Elf_Shdr *sechdrs, int licenseidx)
}
}
/* From init/vermagic.o */
extern char vermagic[];
/* Allocate and load the module: note that size of section 0 is always
zero, and we rely on this for optional sections. */
static struct module *load_module(void *umod,
......@@ -973,7 +976,7 @@ static struct module *load_module(void *umod,
Elf_Shdr *sechdrs;
char *secstrings, *args;
unsigned int i, symindex, exportindex, strindex, setupindex, exindex,
modindex, obsparmindex, licenseindex, gplindex;
modindex, obsparmindex, licenseindex, gplindex, vmagindex;
long arglen;
struct module *mod;
long err = 0;
......@@ -1012,7 +1015,7 @@ static struct module *load_module(void *umod,
exportindex = setupindex = obsparmindex = gplindex = licenseindex = 0;
/* And these should exist, but gcc whinges if we don't init them */
symindex = strindex = exindex = modindex = 0;
symindex = strindex = exindex = modindex = vmagindex = 0;
/* Find where important sections are */
for (i = 1; i < hdr->e_shnum; i++) {
......@@ -1062,6 +1065,11 @@ static struct module *load_module(void *umod,
/* EXPORT_SYMBOL_GPL() */
DEBUGP("GPL symbols found in section %u\n", i);
gplindex = i;
} else if (strcmp(secstrings+sechdrs[i].sh_name,
"__vermagic") == 0) {
/* Version magic. */
DEBUGP("Version magic found in section %u\n", i);
vmagindex = i;
}
#ifdef CONFIG_KALLSYMS
/* symbol and string tables for decoding later. */
......@@ -1082,6 +1090,18 @@ static struct module *load_module(void *umod,
}
mod = (void *)sechdrs[modindex].sh_addr;
/* This is allowed: modprobe --force will strip it. */
if (!vmagindex) {
tainted |= TAINT_FORCED_MODULE;
printk(KERN_WARNING "%s: no version magic, tainting kernel.\n",
mod->name);
} else if (strcmp((char *)sechdrs[vmagindex].sh_addr, vermagic) != 0) {
printk(KERN_ERR "%s: version magic '%s' should be '%s'\n",
mod->name, (char*)sechdrs[vmagindex].sh_addr, vermagic);
err = -ENOEXEC;
goto free_hdr;
}
/* Now copy in args */
arglen = strlen_user(uargs);
if (!arglen) {
......
......@@ -176,10 +176,15 @@ quiet_cmd_link_multi-y = LD $@
cmd_link_multi-y = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^)
quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.ko=-objs))) $($(subst $(obj)/,,$(@:.ko=-y)))),$^)
cmd_link_multi-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.ko=-objs))) $($(subst $(obj)/,,$(@:.ko=-y)))),$^) init/vermagic.o
quiet_cmd_link_single-m = LD [M] $@
cmd_link_single-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $<
cmd_link_single-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $< init/vermagic.o
# Don't rebuilt vermagic.o unless we actually are in the init/ dir
ifneq ($(obj),init)
init/vermagic.o: ;
endif
# We would rather have a list of rules like
# foo.o: $(foo-objs)
......@@ -188,10 +193,10 @@ cmd_link_single-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $<
$(multi-used-y) : %.o: $(multi-objs-y) FORCE
$(call if_changed,link_multi-y)
$(multi-used-m:.o=.ko) : %.ko: $(multi-objs-m) FORCE
$(multi-used-m:.o=.ko) : %.ko: $(multi-objs-m) init/vermagic.o FORCE
$(call if_changed,link_multi-m)
$(single-used-m:.o=.ko) : %.ko: %.o FORCE
$(single-used-m:.o=.ko) : %.ko: %.o init/vermagic.o FORCE
$(call if_changed,link_single-m)
targets += $(multi-used-y) $(multi-used-m:.o=.ko) $(single-used-m:.o=.ko)
......
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