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 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
10 |
|
---|
11 | **/
|
---|
12 |
|
---|
13 | SECTIONS {
|
---|
14 |
|
---|
15 | /*
|
---|
16 | * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
|
---|
17 | * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
|
---|
18 | * between 32-bit and 64-bit builds). The actual start of the .text section
|
---|
19 | * will be rounded up based on its actual alignment.
|
---|
20 | */
|
---|
21 | . = PECOFF_HEADER_SIZE;
|
---|
22 |
|
---|
23 | .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
|
---|
24 | *(.text .text.* .stub .gnu.linkonce.t.*)
|
---|
25 | *(.rodata .rodata.* .gnu.linkonce.r.*)
|
---|
26 | *(.got .got.*)
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * The contents of AutoGen.c files are mostly constant from the POV of the
|
---|
30 | * program, but most of it ends up in .data or .bss by default since few of
|
---|
31 | * the variable definitions that get emitted are declared as CONST.
|
---|
32 | * Unfortunately, we cannot pull it into the .text section entirely, since
|
---|
33 | * patchable PCDs are also emitted here, but we can at least move all of the
|
---|
34 | * emitted GUIDs here.
|
---|
35 | */
|
---|
36 | *:AutoGen.obj(.data.g*Guid)
|
---|
37 | }
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * The alignment of the .data section should be less than or equal to the
|
---|
41 | * alignment of the .text section. This ensures that the relative offset
|
---|
42 | * between these sections is the same in the ELF and the PE/COFF versions of
|
---|
43 | * this binary.
|
---|
44 | */
|
---|
45 | .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {
|
---|
46 | *(.data .data.* .gnu.linkonce.d.*)
|
---|
47 | *(.bss .bss.*)
|
---|
48 | }
|
---|
49 |
|
---|
50 | .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
|
---|
51 | KEEP (*(.eh_frame))
|
---|
52 | }
|
---|
53 |
|
---|
54 | .rela (INFO) : {
|
---|
55 | *(.rela .rela.*)
|
---|
56 | }
|
---|
57 |
|
---|
58 | .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {
|
---|
59 | KEEP (*(.hii))
|
---|
60 | }
|
---|
61 |
|
---|
62 | .got : {
|
---|
63 | *(.got)
|
---|
64 | }
|
---|
65 | ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!")
|
---|
66 |
|
---|
67 | .got.plt (INFO) : {
|
---|
68 | *(.got.plt)
|
---|
69 | }
|
---|
70 | ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0xc || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!")
|
---|
71 |
|
---|
72 | /*
|
---|
73 | * Retain the GNU build id but in a non-allocatable section so GenFw
|
---|
74 | * does not copy it into the PE/COFF image.
|
---|
75 | */
|
---|
76 | .build-id (INFO) : { *(.note.gnu.build-id) }
|
---|
77 |
|
---|
78 | /DISCARD/ : {
|
---|
79 | *(.note.GNU-stack)
|
---|
80 | *(.gnu_debuglink)
|
---|
81 | *(.interp)
|
---|
82 | *(.dynsym)
|
---|
83 | *(.dynstr)
|
---|
84 | *(.dynamic)
|
---|
85 | *(.hash .gnu.hash)
|
---|
86 | *(.comment)
|
---|
87 | }
|
---|
88 | }
|
---|