]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Scripts/GccBase.lds
Preserve hii section in GCC binaries
[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
AB
8\r
9 This program and the accompanying materials are licensed and made available under\r
10 the terms and conditions of the BSD License that accompanies this distribution.\r
11 The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php.\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17**/\r
18\r
19SECTIONS {\r
20\r
21 /*\r
22 * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of\r
23 * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs\r
24 * between 32-bit and 64-bit builds). The actual start of the .text section\r
25 * will be rounded up based on its actual alignment.\r
26 */\r
27 . = PECOFF_HEADER_SIZE;\r
28\r
29 .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {\r
30 *(.text .text.* .stub .gnu.linkonce.t.*)\r
31 *(.rodata .rodata.* .gnu.linkonce.r.*)\r
32 *(.got .got.*)\r
233bd25b
AB
33\r
34 /*\r
35 * The contents of AutoGen.c files are constant from the POV of the program,\r
36 * but most of its contents end up in .data or .bss by default since few of\r
37 * the variable definitions that get emitted are declared as CONST.\r
38 */\r
39 *:AutoGen.obj(.data .data.* .bss .bss.*)\r
efe690ca
AB
40 }\r
41\r
42 /*\r
43 * The alignment of the .data section should be less than or equal to the\r
44 * alignment of the .text section. This ensures that the relative offset\r
45 * between these sections is the same in the ELF and the PE/COFF versions of\r
46 * this binary.\r
47 */\r
56948ba1 48 .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {\r
efe690ca 49 *(.data .data.* .gnu.linkonce.d.*)\r
214a3b79 50 *(.bss .bss.*)\r
efe690ca
AB
51 }\r
52\r
53 .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {\r
54 KEEP (*(.eh_frame))\r
55 }\r
56\r
57 .rela ALIGN(CONSTANT(COMMONPAGESIZE)) : {\r
58 *(.rela .rela.*)\r
59 }\r
60\r
03630a81
TP
61 .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {\r
62 KEEP (*(.hii))\r
63 }\r
64\r
efe690ca
AB
65 /DISCARD/ : {\r
66 *(.note.GNU-stack)\r
67 *(.gnu_debuglink)\r
68 *(.interp)\r
69 *(.dynsym)\r
70 *(.dynstr)\r
71 *(.dynamic)\r
72 *(.hash)\r
73 *(.comment)\r
214a3b79 74 *(COMMON)\r
efe690ca
AB
75 }\r
76}\r