| 1 |
/* Linker script for normal executables with BSS in hugepages */ |
| 2 |
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", |
| 3 |
"elf64-x86-64") |
| 4 |
OUTPUT_ARCH(i386:x86-64) |
| 5 |
ENTRY(_start) |
| 6 |
SEARCH_DIR("/usr/x86_64-linux-gnu/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/x86_64-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); |
| 7 |
INPUT(-lhugetlbfs); |
| 8 |
/* Do we need any of these for elf? |
| 9 |
__DYNAMIC = 0; */ |
| 10 |
PHDRS |
| 11 |
{ |
| 12 |
headers PT_PHDR PHDRS ; |
| 13 |
interp PT_INTERP ; |
| 14 |
text PT_LOAD FILEHDR PHDRS ; |
| 15 |
data PT_LOAD ; |
| 16 |
htlb PT_LOAD FLAGS (0x00100007); |
| 17 |
dynamic PT_DYNAMIC ; |
| 18 |
note PT_NOTE ; |
| 19 |
gnu_stack PT_GNU_STACK ; |
| 20 |
/* this is the value of PT_GNU_EH_FRAME as defined in |
| 21 |
usr/include/elf.h but binutils does not recognize that identifier |
| 22 |
as it does other PT_ constants. */ |
| 23 |
eh_frame_hdr 1685382480 FLAGS (0x00000004); |
| 24 |
} |
| 25 |
SECTIONS |
| 26 |
{ |
| 27 |
/* Read-only sections, merged into text segment: */ |
| 28 |
__executable_start = 0x400000; . = 0x400000 + SIZEOF_HEADERS; |
| 29 |
.interp : { *(.interp) } :text :interp |
| 30 |
.note.SuSE : { *(.note.SuSE) } :text :note |
| 31 |
.note.ABI-tag : { *(.note.ABI-tag) } :text :note |
| 32 |
.note.gnu.build-id : { *(.note.gnu.build-id) } :text :note |
| 33 |
.hash : { *(.hash) } :text |
| 34 |
.dynsym : { *(.dynsym) } :text |
| 35 |
.dynstr : { *(.dynstr) } :text |
| 36 |
.gnu.version : { *(.gnu.version) } :text |
| 37 |
.gnu.version_d : { *(.gnu.version_d) } :text |
| 38 |
.gnu.version_r : { *(.gnu.version_r) } :text |
| 39 |
.rel.init : { *(.rel.init) } :text |
| 40 |
.rela.init : { *(.rela.init) } :text |
| 41 |
.rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } :text |
| 42 |
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } :text |
| 43 |
.rel.fini : { *(.rel.fini) } :text |
| 44 |
.rela.fini : { *(.rela.fini) } :text |
| 45 |
.rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } :text |
| 46 |
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } :text |
| 47 |
.rel.data.rel.ro : { *(.rel.data.rel.ro*) } :text |
| 48 |
.rela.data.rel.ro : { *(.rel.data.rel.ro*) } :text |
| 49 |
.rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } :text |
| 50 |
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } :text |
| 51 |
.rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } :text |
| 52 |
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } :text |
| 53 |
.rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } :text |
| 54 |
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } :text |
| 55 |
.rel.ctors : { *(.rel.ctors) } :text |
| 56 |
.rela.ctors : { *(.rela.ctors) } :text |
| 57 |
.rel.dtors : { *(.rel.dtors) } :text |
| 58 |
.rela.dtors : { *(.rela.dtors) } :text |
| 59 |
.rel.got : { *(.rel.got) } :text |
| 60 |
.rela.got : { *(.rela.got) } :text |
| 61 |
.rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } :text |
| 62 |
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } :text |
| 63 |
.rel.plt : { *(.rel.plt) } :text |
| 64 |
.rela.plt : { *(.rela.plt) } :text |
| 65 |
.init : |
| 66 |
{ |
| 67 |
KEEP (*(.init)) |
| 68 |
} :text =0x90909090 |
| 69 |
.plt : { *(.plt)} :text |
| 70 |
.text : |
| 71 |
{ |
| 72 |
*(.text .stub .text.* .gnu.linkonce.t.*) |
| 73 |
KEEP (*(.text.*personality*)) |
| 74 |
/* .gnu.warning sections are handled specially by elf32.em. */ |
| 75 |
*(.gnu.warning) |
| 76 |
} :text =0x90909090 |
| 77 |
.fini : |
| 78 |
{ |
| 79 |
KEEP (*(.fini)) |
| 80 |
} :text =0x90909090 |
| 81 |
PROVIDE (__etext = .); |
| 82 |
PROVIDE (_etext = .); |
| 83 |
PROVIDE (etext = .); |
| 84 |
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :text |
| 85 |
.rodata1 : { *(.rodata1) } :text |
| 86 |
.eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr |
| 87 |
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } :text |
| 88 |
.gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } :text |
| 89 |
/* Adjust the address for the data segment. We want to adjust up to |
| 90 |
the same address within the page on the next page up. */ |
| 91 |
. = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000); |
| 92 |
/* Exception handling */ |
| 93 |
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } :data |
| 94 |
.gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } :data |
| 95 |
/* Thread Local Storage sections */ |
| 96 |
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } :data |
| 97 |
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } :data |
| 98 |
/* Ensure the __preinit_array_start label is properly aligned. We |
| 99 |
could instead move the label definition inside the section, but |
| 100 |
the linker would then create the section even if it turns out to |
| 101 |
be empty, which isn't pretty. */ |
| 102 |
. = ALIGN(64 / 8); |
| 103 |
PROVIDE (__preinit_array_start = .); |
| 104 |
.preinit_array : { KEEP (*(.preinit_array)) } :data |
| 105 |
PROVIDE (__preinit_array_end = .); |
| 106 |
PROVIDE (__init_array_start = .); |
| 107 |
.init_array : { KEEP (*(.init_array)) } :data |
| 108 |
PROVIDE (__init_array_end = .); |
| 109 |
PROVIDE (__fini_array_start = .); |
| 110 |
.fini_array : { KEEP (*(.fini_array)) } :data |
| 111 |
PROVIDE (__fini_array_end = .); |
| 112 |
.ctors : |
| 113 |
{ |
| 114 |
/* gcc uses crtbegin.o to find the start of |
| 115 |
the constructors, so we make sure it is |
| 116 |
first. Because this is a wildcard, it |
| 117 |
doesn't matter if the user does not |
| 118 |
actually link against crtbegin.o; the |
| 119 |
linker won't look for a file to match a |
| 120 |
wildcard. The wildcard also means that it |
| 121 |
doesn't matter which directory crtbegin.o |
| 122 |
is in. */ |
| 123 |
KEEP (*crtbegin*.o(.ctors)) |
| 124 |
/* We don't want to include the .ctor section from |
| 125 |
from the crtend.o file until after the sorted ctors. |
| 126 |
The .ctor section from the crtend file contains the |
| 127 |
end of ctors marker and it must be last */ |
| 128 |
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) |
| 129 |
KEEP (*(SORT(.ctors.*))) |
| 130 |
KEEP (*(.ctors)) |
| 131 |
} :data |
| 132 |
.dtors : |
| 133 |
{ |
| 134 |
KEEP (*crtbegin*.o(.dtors)) |
| 135 |
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) |
| 136 |
KEEP (*(SORT(.dtors.*))) |
| 137 |
KEEP (*(.dtors)) |
| 138 |
} :data |
| 139 |
.jcr : { KEEP (*(.jcr)) } :data |
| 140 |
.data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } :data |
| 141 |
.dynamic : { *(.dynamic) } :dynamic :data |
| 142 |
.got : { *(.got) } :data |
| 143 |
. = DATA_SEGMENT_RELRO_END (24, .); |
| 144 |
.got.plt : { *(.got.plt) } :data |
| 145 |
.data : |
| 146 |
{ |
| 147 |
*(.data .data.* .gnu.linkonce.d.*) |
| 148 |
KEEP (*(.gnu.linkonce.d.*personality*)) |
| 149 |
SORT(CONSTRUCTORS) |
| 150 |
} :data |
| 151 |
.data1 : { *(.data1) } :data |
| 152 |
_edata = .; |
| 153 |
PROVIDE (edata = .); |
| 154 |
__bss_start = .; |
| 155 |
. = ALIGN(64 / 8); |
| 156 |
. = DATA_SEGMENT_END (.); |
| 157 |
/* Hugepage area */ |
| 158 |
. = ALIGN(0x1000000); /* Align to 16MB (2MB hugepage size, plus some slack in case of larger hugepages in future */ |
| 159 |
__bss_start = .; |
| 160 |
.bss : |
| 161 |
{ |
| 162 |
*(.dynbss) |
| 163 |
*(.bss .bss.* .gnu.linkonce.b.*) |
| 164 |
*(COMMON) |
| 165 |
} :htlb |
| 166 |
_end = .; |
| 167 |
PROVIDE (end = .); |
| 168 |
/* Stabs debugging sections. */ |
| 169 |
.stab 0 : { *(.stab) } |
| 170 |
.stabstr 0 : { *(.stabstr) } |
| 171 |
.stab.excl 0 : { *(.stab.excl) } |
| 172 |
.stab.exclstr 0 : { *(.stab.exclstr) } |
| 173 |
.stab.index 0 : { *(.stab.index) } |
| 174 |
.stab.indexstr 0 : { *(.stab.indexstr) } |
| 175 |
.comment 0 : { *(.comment) } |
| 176 |
/* DWARF debug sections. |
| 177 |
Symbols in the DWARF debugging sections are relative to the beginning |
| 178 |
of the section so we begin them at 0. */ |
| 179 |
/* DWARF 1 */ |
| 180 |
.debug 0 : { *(.debug) } |
| 181 |
.line 0 : { *(.line) } |
| 182 |
/* GNU DWARF 1 extensions */ |
| 183 |
.debug_srcinfo 0 : { *(.debug_srcinfo) } |
| 184 |
.debug_sfnames 0 : { *(.debug_sfnames) } |
| 185 |
/* DWARF 1.1 and DWARF 2 */ |
| 186 |
.debug_aranges 0 : { *(.debug_aranges) } |
| 187 |
.debug_pubnames 0 : { *(.debug_pubnames) } |
| 188 |
/* DWARF 2 */ |
| 189 |
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
| 190 |
.debug_abbrev 0 : { *(.debug_abbrev) } |
| 191 |
.debug_line 0 : { *(.debug_line) } |
| 192 |
.debug_frame 0 : { *(.debug_frame) } |
| 193 |
.debug_str 0 : { *(.debug_str) } |
| 194 |
.debug_loc 0 : { *(.debug_loc) } |
| 195 |
.debug_macinfo 0 : { *(.debug_macinfo) } |
| 196 |
/* SGI/MIPS DWARF 2 extensions */ |
| 197 |
.debug_weaknames 0 : { *(.debug_weaknames) } |
| 198 |
.debug_funcnames 0 : { *(.debug_funcnames) } |
| 199 |
.debug_typenames 0 : { *(.debug_typenames) } |
| 200 |
.debug_varnames 0 : { *(.debug_varnames) } |
| 201 |
/DISCARD/ : { *(.note.GNU-stack) } |
| 202 |
} |