vmlinux.lds.S 2.79 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5 6 7
/*
 *  Copyright (C) 2000 Russell King
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
8 9 10 11 12 13 14 15 16 17

#ifdef CONFIG_CPU_ENDIAN_BE8
#define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \
			  (((x) >>  8) & 0x0000ff00) | \
			  (((x) <<  8) & 0x00ff0000) | \
			  (((x) << 24) & 0xff000000) )
#else
#define ZIMAGE_MAGIC(x) (x)
#endif

Linus Torvalds's avatar
Linus Torvalds committed
18 19 20 21
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
22 23 24
  /DISCARD/ : {
    *(.ARM.exidx*)
    *(.ARM.extab*)
25 26 27 28 29 30 31
    /*
     * Discard any r/w data - this produces a link error if we have any,
     * which is required for PIC decompression.  Local data generates
     * GOTOFF relocations, which prevents it being relocated independently
     * of the text/got segments.
     */
    *(.data)
32 33
  }

Linus Torvalds's avatar
Linus Torvalds committed
34 35 36 37 38 39 40
  . = TEXT_START;
  _text = .;

  .text : {
    _start = .;
    *(.start)
    *(.text)
41
    *(.text.*)
Linus Torvalds's avatar
Linus Torvalds committed
42 43
    *(.fixup)
    *(.gnu.warning)
44 45 46
    *(.glue_7t)
    *(.glue_7)
  }
47 48 49 50 51 52 53 54 55
  .table : ALIGN(4) {
    _table_start = .;
    LONG(ZIMAGE_MAGIC(2))
    LONG(ZIMAGE_MAGIC(0x5a534c4b))
    LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
    LONG(ZIMAGE_MAGIC(_kernel_bss_size))
    LONG(0)
    _table_end = .;
  }
56
  .rodata : {
Linus Torvalds's avatar
Linus Torvalds committed
57 58
    *(.rodata)
    *(.rodata.*)
59 60
  }
  .piggydata : {
Linus Torvalds's avatar
Linus Torvalds committed
61
    *(.piggydata)
62
    __piggy_size_addr = . - 4;
Linus Torvalds's avatar
Linus Torvalds committed
63 64
  }

65
  . = ALIGN(4);
Linus Torvalds's avatar
Linus Torvalds committed
66 67
  _etext = .;

68
  .got.plt		: { *(.got.plt) }
Linus Torvalds's avatar
Linus Torvalds committed
69 70 71
  _got_start = .;
  .got			: { *(.got) }
  _got_end = .;
72 73 74 75

  /* ensure the zImage file size is always a multiple of 64 bits */
  /* (without a dummy byte, ld just ignores the empty section) */
  .pad			: { BYTE(0); . = ALIGN(8); }
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95

#ifdef CONFIG_EFI_STUB
  .data : ALIGN(4096) {
    __pecoff_data_start = .;
    /*
     * The EFI stub always executes from RAM, and runs strictly before the
     * decompressor, so we can make an exception for its r/w data, and keep it
     */
    *(.data.efistub)
    __pecoff_data_end = .;

    /*
     * PE/COFF mandates a file size which is a multiple of 512 bytes if the
     * section size equals or exceeds 4 KB
     */
    . = ALIGN(512);
  }
  __pecoff_data_rawsize = . - ADDR(.data);
#endif

Linus Torvalds's avatar
Linus Torvalds committed
96 97
  _edata = .;

98 99 100
  _magic_sig = ZIMAGE_MAGIC(0x016f2818);
  _magic_start = ZIMAGE_MAGIC(_start);
  _magic_end = ZIMAGE_MAGIC(_edata);
101
  _magic_table = ZIMAGE_MAGIC(_table_start - _start);
102

Linus Torvalds's avatar
Linus Torvalds committed
103 104 105 106 107
  . = BSS_START;
  __bss_start = .;
  .bss			: { *(.bss) }
  _end = .;

108
  . = ALIGN(8);		/* the stack must be 64-bit aligned */
109
  .stack		: { *(.stack) }
Linus Torvalds's avatar
Linus Torvalds committed
110

111 112 113
  PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
  PROVIDE(__pecoff_end = ALIGN(512));

Linus Torvalds's avatar
Linus Torvalds committed
114 115 116 117 118 119 120 121
  .stab 0		: { *(.stab) }
  .stabstr 0		: { *(.stabstr) }
  .stab.excl 0		: { *(.stab.excl) }
  .stab.exclstr 0	: { *(.stab.exclstr) }
  .stab.index 0		: { *(.stab.index) }
  .stab.indexstr 0	: { *(.stab.indexstr) }
  .comment 0		: { *(.comment) }
}