]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Scripts/GccBase.lds
BaseTools GCC: add unified GCC linker script for all archs and versions
[mirror_edk2.git] / BaseTools / Scripts / GccBase.lds
1 /** @file
2
3 Unified linker script for GCC based builds
4
5 Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
6 Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
7
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 SECTIONS {
19
20 /*
21 * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
22 * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
23 * between 32-bit and 64-bit builds). The actual start of the .text section
24 * will be rounded up based on its actual alignment.
25 */
26 . = PECOFF_HEADER_SIZE;
27
28 .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
29 *(.text .text.* .stub .gnu.linkonce.t.*)
30 *(.rodata .rodata.* .gnu.linkonce.r.*)
31 *(.got .got.*)
32 }
33
34 /*
35 * The alignment of the .data section should be less than or equal to the
36 * alignment of the .text section. This ensures that the relative offset
37 * between these sections is the same in the ELF and the PE/COFF versions of
38 * this binary.
39 */
40 .data : ALIGN(CONSTANT(COMMONPAGESIZE)) {
41 *(.data .data.* .gnu.linkonce.d.*)
42 *(.bss .bss.* *COM*)
43 }
44
45 .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
46 KEEP (*(.eh_frame))
47 }
48
49 .rela ALIGN(CONSTANT(COMMONPAGESIZE)) : {
50 *(.rela .rela.*)
51 }
52
53 /DISCARD/ : {
54 *(.note.GNU-stack)
55 *(.gnu_debuglink)
56 *(.interp)
57 *(.dynsym)
58 *(.dynstr)
59 *(.dynamic)
60 *(.hash)
61 *(.comment)
62 }
63 }