]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Scripts/GccBase.lds
BaseTools: Use absolute import in Scripts
[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 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
8
9 This program and the accompanying materials are licensed and made available under
10 the terms and conditions of the BSD License that accompanies this distribution.
11 The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php.
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 **/
18
19 SECTIONS {
20
21 /*
22 * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
23 * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
24 * between 32-bit and 64-bit builds). The actual start of the .text section
25 * will be rounded up based on its actual alignment.
26 */
27 . = PECOFF_HEADER_SIZE;
28
29 .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
30 *(.text .text.* .stub .gnu.linkonce.t.*)
31 *(.rodata .rodata.* .gnu.linkonce.r.*)
32 *(.got .got.*)
33
34 /*
35 * The contents of AutoGen.c files are mostly constant from the POV of the
36 * program, but most of it ends up in .data or .bss by default since few of
37 * the variable definitions that get emitted are declared as CONST.
38 * Unfortunately, we cannot pull it into the .text section entirely, since
39 * patchable PCDs are also emitted here, but we can at least move all of the
40 * emitted GUIDs here.
41 */
42 *:AutoGen.obj(.data.g*Guid)
43 }
44
45 /*
46 * The alignment of the .data section should be less than or equal to the
47 * alignment of the .text section. This ensures that the relative offset
48 * between these sections is the same in the ELF and the PE/COFF versions of
49 * this binary.
50 */
51 .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {
52 *(.data .data.* .gnu.linkonce.d.*)
53 *(.bss .bss.*)
54 }
55
56 .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
57 KEEP (*(.eh_frame))
58 }
59
60 .rela (INFO) : {
61 *(.rela .rela.*)
62 }
63
64 .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {
65 KEEP (*(.hii))
66 }
67
68 /*
69 * Retain the GNU build id but in a non-allocatable section so GenFw
70 * does not copy it into the PE/COFF image.
71 */
72 .build-id (INFO) : { *(.note.gnu.build-id) }
73
74 /DISCARD/ : {
75 *(.note.GNU-stack)
76 *(.gnu_debuglink)
77 *(.interp)
78 *(.dynsym)
79 *(.dynstr)
80 *(.dynamic)
81 *(.hash .gnu.hash)
82 *(.comment)
83 *(COMMON)
84 }
85 }