]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Scripts/GccBase.lds
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Scripts / GccBase.lds
CommitLineData
efe690ca
AB
1/** @file\r
2\r
3 Unified linker script for GCC based builds\r
4\r
5 Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
6 Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\r
03630a81 7 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
efe690ca 8\r
2e351cbe 9 SPDX-License-Identifier: BSD-2-Clause-Patent\r
efe690ca
AB
10\r
11**/\r
12\r
13SECTIONS {\r
14\r
15 /*\r
16 * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of\r
17 * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs\r
18 * between 32-bit and 64-bit builds). The actual start of the .text section\r
19 * will be rounded up based on its actual alignment.\r
20 */\r
21 . = PECOFF_HEADER_SIZE;\r
22\r
23 .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {\r
24 *(.text .text.* .stub .gnu.linkonce.t.*)\r
25 *(.rodata .rodata.* .gnu.linkonce.r.*)\r
26 *(.got .got.*)\r
233bd25b
AB
27\r
28 /*\r
3cf41b87
AB
29 * The contents of AutoGen.c files are mostly constant from the POV of the\r
30 * program, but most of it ends up in .data or .bss by default since few of\r
233bd25b 31 * the variable definitions that get emitted are declared as CONST.\r
3cf41b87
AB
32 * Unfortunately, we cannot pull it into the .text section entirely, since\r
33 * patchable PCDs are also emitted here, but we can at least move all of the\r
34 * emitted GUIDs here.\r
233bd25b 35 */\r
3cf41b87 36 *:AutoGen.obj(.data.g*Guid)\r
efe690ca
AB
37 }\r
38\r
39 /*\r
40 * The alignment of the .data section should be less than or equal to the\r
41 * alignment of the .text section. This ensures that the relative offset\r
42 * between these sections is the same in the ELF and the PE/COFF versions of\r
43 * this binary.\r
44 */\r
56948ba1 45 .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {\r
efe690ca 46 *(.data .data.* .gnu.linkonce.d.*)\r
214a3b79 47 *(.bss .bss.*)\r
efe690ca
AB
48 }\r
49\r
50 .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {\r
51 KEEP (*(.eh_frame))\r
52 }\r
53\r
669a7562 54 .rela (INFO) : {\r
efe690ca
AB
55 *(.rela .rela.*)\r
56 }\r
57\r
03630a81
TP
58 .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {\r
59 KEEP (*(.hii))\r
60 }\r
61\r
7fd5d619
AB
62 /*\r
63 * Retain the GNU build id but in a non-allocatable section so GenFw\r
64 * does not copy it into the PE/COFF image.\r
65 */\r
66 .build-id (INFO) : { *(.note.gnu.build-id) }\r
67\r
efe690ca
AB
68 /DISCARD/ : {\r
69 *(.note.GNU-stack)\r
70 *(.gnu_debuglink)\r
71 *(.interp)\r
72 *(.dynsym)\r
73 *(.dynstr)\r
74 *(.dynamic)\r
f4d3ba87 75 *(.hash .gnu.hash)\r
efe690ca 76 *(.comment)\r
214a3b79 77 *(COMMON)\r
efe690ca
AB
78 }\r
79}\r