linux/arch/i386/kernel/vmlinux.lds.S
<<
>>
Prefs
   1/* ld script to make i386 Linux kernel
   2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
   3 *
   4 * Don't define absolute symbols until and unless you know that symbol
   5 * value is should remain constant even if kernel image is relocated
   6 * at run time. Absolute symbols are not relocated. If symbol value should
   7 * change if kernel is relocated, make the symbol section relative and
   8 * put it inside the section definition.
   9 */
  10
  11/* Don't define absolute symbols until and unless you know that symbol
  12 * value is should remain constant even if kernel image is relocated
  13 * at run time. Absolute symbols are not relocated. If symbol value should
  14 * change if kernel is relocated, make the symbol section relative and
  15 * put it inside the section definition.
  16 */
  17#define LOAD_OFFSET __PAGE_OFFSET
  18
  19#include <asm-generic/vmlinux.lds.h>
  20#include <asm/thread_info.h>
  21#include <asm/page.h>
  22#include <asm/cache.h>
  23#include <asm/boot.h>
  24
  25OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
  26OUTPUT_ARCH(i386)
  27ENTRY(phys_startup_32)
  28jiffies = jiffies_64;
  29
  30PHDRS {
  31        text PT_LOAD FLAGS(5);  /* R_E */
  32        data PT_LOAD FLAGS(7);  /* RWE */
  33        note PT_NOTE FLAGS(0);  /* ___ */
  34}
  35SECTIONS
  36{
  37  . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
  38  phys_startup_32 = startup_32 - LOAD_OFFSET;
  39
  40  .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
  41        _text = .;                      /* Text and read-only data */
  42        *(.text.head)
  43  } :text = 0x9090
  44
  45  /* read-only */
  46  .text : AT(ADDR(.text) - LOAD_OFFSET) {
  47        TEXT_TEXT
  48        SCHED_TEXT
  49        LOCK_TEXT
  50        KPROBES_TEXT
  51        *(.fixup)
  52        *(.gnu.warning)
  53        _etext = .;                     /* End of text section */
  54  } :text = 0x9090
  55
  56  . = ALIGN(16);                /* Exception table */
  57  __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
  58        __start___ex_table = .;
  59         *(__ex_table)
  60        __stop___ex_table = .;
  61  }
  62
  63  BUG_TABLE
  64
  65  . = ALIGN(4);
  66  .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
  67        __tracedata_start = .;
  68        *(.tracedata)
  69        __tracedata_end = .;
  70  }
  71
  72  RODATA
  73
  74  /* writeable */
  75  . = ALIGN(4096);
  76  .data : AT(ADDR(.data) - LOAD_OFFSET) {       /* Data */
  77        DATA_DATA
  78        CONSTRUCTORS
  79        } :data
  80
  81  . = ALIGN(4096);
  82  .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
  83        __nosave_begin = .;
  84        *(.data.nosave)
  85        . = ALIGN(4096);
  86        __nosave_end = .;
  87  }
  88
  89  . = ALIGN(4096);
  90  .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
  91        *(.data.idt)
  92  }
  93
  94  . = ALIGN(32);
  95  .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
  96        *(.data.cacheline_aligned)
  97  }
  98
  99  /* rarely changed data like cpu maps */
 100  . = ALIGN(32);
 101  .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
 102        *(.data.read_mostly)
 103        _edata = .;             /* End of data section */
 104  }
 105
 106  . = ALIGN(THREAD_SIZE);       /* init_task */
 107  .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
 108        *(.data.init_task)
 109  }
 110
 111  /* might get freed after init */
 112  . = ALIGN(4096);
 113  .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
 114        __smp_locks = .;
 115        *(.smp_locks)
 116        __smp_locks_end = .;
 117  }
 118  /* will be freed after init
 119   * Following ALIGN() is required to make sure no other data falls on the
 120   * same page where __smp_alt_end is pointing as that page might be freed
 121   * after boot. Always make sure that ALIGN() directive is present after
 122   * the section which contains __smp_alt_end.
 123   */
 124  . = ALIGN(4096);
 125
 126  /* will be freed after init */
 127  . = ALIGN(4096);              /* Init code and data */
 128  .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
 129        __init_begin = .;
 130        _sinittext = .;
 131        *(.init.text)
 132        _einittext = .;
 133  }
 134  .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
 135  . = ALIGN(16);
 136  .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
 137        __setup_start = .;
 138        *(.init.setup)
 139        __setup_end = .;
 140   }
 141  .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
 142        __initcall_start = .;
 143        INITCALLS
 144        __initcall_end = .;
 145  }
 146  .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
 147        __con_initcall_start = .;
 148        *(.con_initcall.init)
 149        __con_initcall_end = .;
 150  }
 151  SECURITY_INIT
 152  . = ALIGN(4);
 153  .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
 154        __alt_instructions = .;
 155        *(.altinstructions)
 156        __alt_instructions_end = .;
 157  }
 158  .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
 159        *(.altinstr_replacement)
 160  }
 161  . = ALIGN(4);
 162  .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
 163        __parainstructions = .;
 164        *(.parainstructions)
 165        __parainstructions_end = .;
 166  }
 167  /* .exit.text is discard at runtime, not link time, to deal with references
 168     from .altinstructions and .eh_frame */
 169  .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
 170  .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
 171#if defined(CONFIG_BLK_DEV_INITRD)
 172  . = ALIGN(4096);
 173  .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
 174        __initramfs_start = .;
 175        *(.init.ramfs)
 176        __initramfs_end = .;
 177  }
 178#endif
 179  . = ALIGN(4096);
 180  .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
 181        __per_cpu_start = .;
 182        *(.data.percpu)
 183        __per_cpu_end = .;
 184  }
 185  . = ALIGN(4096);
 186  /* freed after init ends here */
 187        
 188  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
 189        __init_end = .;
 190        __bss_start = .;                /* BSS */
 191        *(.bss.page_aligned)
 192        *(.bss)
 193        . = ALIGN(4);
 194        __bss_stop = .;
 195        _end = . ;
 196        /* This is where the kernel creates the early boot page tables */
 197        . = ALIGN(4096);
 198        pg0 = . ;
 199  }
 200
 201  /* Sections to be discarded */
 202  /DISCARD/ : {
 203        *(.exitcall.exit)
 204        }
 205
 206  STABS_DEBUG
 207
 208  DWARF_DEBUG
 209
 210  NOTES
 211}
 212
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.