1 /* Script for ld -r: link without relocation */ 2 /* Copyright (C) 2014 Free Software Foundation, Inc. 3 Copying and distribution of this script, with or without modification, 4 are permitted in any medium without royalty provided the copyright 5 notice and this notice are preserved. */ 6 OUTPUT_FORMAT("elf32-bigaarch64", "elf32-bigaarch64", 7 "elf32-littleaarch64") 8 OUTPUT_ARCH(aarch64:ilp32) 9 /* For some reason, the Solaris linker makes bad executables 10 if gld -r is used and the intermediate file has sections starting 11 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld 12 bug. But for now assigning the zero vmas works. */ 13 SECTIONS 14 { 15 /* Read-only sections, merged into text segment: */ 16 .interp 0 : { *(.interp) } 17 .note.gnu.build-id : { *(.note.gnu.build-id) } 18 .hash 0 : { *(.hash) } 19 .gnu.hash 0 : { *(.gnu.hash) } 20 .dynsym 0 : { *(.dynsym) } 21 .dynstr 0 : { *(.dynstr) } 22 .gnu.version 0 : { *(.gnu.version) } 23 .gnu.version_d 0: { *(.gnu.version_d) } 24 .gnu.version_r 0: { *(.gnu.version_r) } 25 .rela.init 0 : { *(.rela.init) } 26 .rela.text 0 : { *(.rela.text) } 27 .rela.fini 0 : { *(.rela.fini) } 28 .rela.rodata 0 : { *(.rela.rodata) } 29 .rela.data.rel.ro 0 : { *(.rela.data.rel.ro) } 30 .rela.data 0 : { *(.rela.data) } 31 .rela.tdata 0 : { *(.rela.tdata) } 32 .rela.tbss 0 : { *(.rela.tbss) } 33 .rela.ctors 0 : { *(.rela.ctors) } 34 .rela.dtors 0 : { *(.rela.dtors) } 35 .rela.got 0 : { *(.rela.got) } 36 .rela.bss 0 : { *(.rela.bss) } 37 .rela.ifunc 0 : { *(.rela.ifunc) } 38 .rela.plt 0 : 39 { 40 *(.rela.plt) 41 } 42 .init 0 : 43 { 44 KEEP (*(SORT_NONE(.init))) 45 } =0 46 .plt 0 : ALIGN(16) { *(.plt) *(.iplt) } 47 .text 0 : 48 { 49 *(.text .stub) 50 /* .gnu.warning sections are handled specially by elf32.em. */ 51 *(.gnu.warning) 52 } =0 53 .fini 0 : 54 { 55 KEEP (*(SORT_NONE(.fini))) 56 } =0 57 .rodata 0 : { *(.rodata) } 58 .rodata1 0 : { *(.rodata1) } 59 .eh_frame_hdr : { *(.eh_frame_hdr) } 60 .eh_frame 0 : ONLY_IF_RO { KEEP (*(.eh_frame)) } 61 .gcc_except_table 0 : ONLY_IF_RO { *(.gcc_except_table 62 .gcc_except_table.*) } 63 /* These sections are generated by the Sun/Oracle C++ compiler. */ 64 .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges 65 .exception_ranges*) } 66 /* Adjust the address for the data segment. For 32 bits we want to align 67 at exactly a page boundary to make life easier for apriori. */ 68 /* Exception handling */ 69 .eh_frame 0 : ONLY_IF_RW { KEEP (*(.eh_frame)) } 70 .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 71 .exception_ranges 0 : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } 72 /* Thread Local Storage sections */ 73 .tdata 0 : { *(.tdata) } 74 .tbss 0 : { *(.tbss) } 75 /* Ensure the __preinit_array_start label is properly aligned. We 76 could instead move the label definition inside the section, but 77 the linker would then create the section even if it turns out to 78 be empty, which isn't pretty. */ 79 .preinit_array 0 : 80 { 81 KEEP (*(.preinit_array)) 82 } 83 .jcr 0 : { KEEP (*(.jcr)) } 84 .dynamic 0 : { *(.dynamic) } 85 .got 0 : { *(.got) *(.igot) } 86 .got.plt 0 : { *(.got.plt) *(.igot.plt) } 87 .data 0 : 88 { 89 *(.data) 90 } 91 .data1 0 : { *(.data1) } 92 .bss 0 : 93 { 94 *(.dynbss) 95 *(.bss) 96 *(COMMON) 97 /* Align here to ensure that the .bss section occupies space up to 98 _end. Align after .bss to ensure correct alignment even if the 99 .bss section disappears because there are no input sections. */ 100 } 101 /* Stabs debugging sections. */ 102 .stab 0 : { *(.stab) } 103 .stabstr 0 : { *(.stabstr) } 104 .stab.excl 0 : { *(.stab.excl) } 105 .stab.exclstr 0 : { *(.stab.exclstr) } 106 .stab.index 0 : { *(.stab.index) } 107 .stab.indexstr 0 : { *(.stab.indexstr) } 108 .comment 0 : { *(.comment) } 109 /* DWARF debug sections. 110 Symbols in the DWARF debugging sections are relative to the beginning 111 of the section so we begin them at 0. */ 112 /* DWARF 1 */ 113 .debug 0 : { *(.debug) } 114 .line 0 : { *(.line) } 115 /* GNU DWARF 1 extensions */ 116 .debug_srcinfo 0 : { *(.debug_srcinfo) } 117 .debug_sfnames 0 : { *(.debug_sfnames) } 118 /* DWARF 1.1 and DWARF 2 */ 119 .debug_aranges 0 : { *(.debug_aranges) } 120 .debug_pubnames 0 : { *(.debug_pubnames) } 121 /* DWARF 2 */ 122 .debug_info 0 : { *(.debug_info) } 123 .debug_abbrev 0 : { *(.debug_abbrev) } 124 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } 125 .debug_frame 0 : { *(.debug_frame) } 126 .debug_str 0 : { *(.debug_str) } 127 .debug_loc 0 : { *(.debug_loc) } 128 .debug_macinfo 0 : { *(.debug_macinfo) } 129 /* SGI/MIPS DWARF 2 extensions */ 130 .debug_weaknames 0 : { *(.debug_weaknames) } 131 .debug_funcnames 0 : { *(.debug_funcnames) } 132 .debug_typenames 0 : { *(.debug_typenames) } 133 .debug_varnames 0 : { *(.debug_varnames) } 134 /* DWARF 3 */ 135 .debug_pubtypes 0 : { *(.debug_pubtypes) } 136 .debug_ranges 0 : { *(.debug_ranges) } 137 /* DWARF Extension. */ 138 .debug_macro 0 : { *(.debug_macro) } 139 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } 140 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 141 } 142