Wu Zhangjin | d4d9a55 | 2009-12-10 22:55:13 +0800 | [diff] [blame] | 1 | /* |
| 2 | * ld.script for compressed kernel support of MIPS |
| 3 | * |
| 4 | * Copyright (C) 2009 Lemote Inc. |
| 5 | * Author: Wu Zhangjin <wuzj@lemote.com> |
| 6 | */ |
| 7 | |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 8 | OUTPUT_ARCH(mips) |
| 9 | ENTRY(start) |
| 10 | SECTIONS |
| 11 | { |
Wu Zhangjin | d4d9a55 | 2009-12-10 22:55:13 +0800 | [diff] [blame] | 12 | /* . = VMLINUZ_LOAD_ADDRESS */ |
| 13 | /* read-only */ |
| 14 | _text = .; /* Text and read-only data */ |
| 15 | .text : { |
| 16 | _ftext = . ; |
| 17 | *(.text) |
| 18 | *(.rodata) |
| 19 | } = 0 |
| 20 | _etext = .; /* End of text section */ |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 21 | |
Wu Zhangjin | d4d9a55 | 2009-12-10 22:55:13 +0800 | [diff] [blame] | 22 | /* writable */ |
| 23 | .data : { /* Data */ |
| 24 | _fdata = . ; |
| 25 | *(.data) |
| 26 | /* Put the compressed image here, so bss is on the end. */ |
| 27 | __image_begin = .; |
| 28 | *(.image) |
| 29 | __image_end = .; |
| 30 | CONSTRUCTORS |
| 31 | } |
| 32 | .sdata : { *(.sdata) } |
| 33 | . = ALIGN(4); |
| 34 | _edata = .; /* End of data section */ |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 35 | |
Wu Zhangjin | d4d9a55 | 2009-12-10 22:55:13 +0800 | [diff] [blame] | 36 | /* BSS */ |
| 37 | __bss_start = .; |
| 38 | _fbss = .; |
| 39 | .sbss : { *(.sbss) *(.scommon) } |
| 40 | .bss : { |
| 41 | *(.dynbss) |
| 42 | *(.bss) |
| 43 | *(COMMON) |
| 44 | } |
| 45 | . = ALIGN(4); |
| 46 | _end = . ; |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 47 | |
Wu Zhangjin | d4d9a55 | 2009-12-10 22:55:13 +0800 | [diff] [blame] | 48 | /* These are needed for ELF backends which have not yet been converted |
| 49 | * to the new style linker. */ |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 50 | |
Wu Zhangjin | d4d9a55 | 2009-12-10 22:55:13 +0800 | [diff] [blame] | 51 | .stab 0 : { *(.stab) } |
| 52 | .stabstr 0 : { *(.stabstr) } |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 53 | |
Wu Zhangjin | d4d9a55 | 2009-12-10 22:55:13 +0800 | [diff] [blame] | 54 | /* These must appear regardless of . */ |
| 55 | .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } |
| 56 | .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 57 | |
Wu Zhangjin | d4d9a55 | 2009-12-10 22:55:13 +0800 | [diff] [blame] | 58 | /* Sections to be discarded */ |
| 59 | /DISCARD/ : { |
| 60 | *(.MIPS.options) |
| 61 | *(.options) |
| 62 | *(.pdr) |
| 63 | *(.reginfo) |
| 64 | *(.comment) |
| 65 | *(.note) |
| 66 | } |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 67 | } |