From: "Ni, Ray" <ray.ni@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>, Feng Bob C <bob.c.feng@intel.com>
Subject: [PATCH v2 1/6] BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size
Date: Wed, 2 Jun 2021 16:11:40 +0800 [thread overview]
Message-ID: <20210602081145.265-2-ray.ni@intel.com> (raw)
In-Reply-To: <20210602081145.265-1-ray.ni@intel.com>
From: Liming Gao <gaoliming@byosoft.com.cn>
LLVM LLD linker doesn't support common-page-size option. So, max-page-size
is used. To not impact GCC tool chain, new ClangBase.lds is added.
Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
---
BaseTools/Scripts/ClangBase.lds | 79 +++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 BaseTools/Scripts/ClangBase.lds
diff --git a/BaseTools/Scripts/ClangBase.lds b/BaseTools/Scripts/ClangBase.lds
new file mode 100644
index 0000000000..8abd54aee6
--- /dev/null
+++ b/BaseTools/Scripts/ClangBase.lds
@@ -0,0 +1,79 @@
+/** @file
+
+ Unified linker script for GCC based builds
+
+ Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+SECTIONS {
+
+ /*
+ * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
+ * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
+ * between 32-bit and 64-bit builds). The actual start of the .text section
+ * will be rounded up based on its actual alignment.
+ */
+ . = PECOFF_HEADER_SIZE;
+
+ .text : ALIGN(CONSTANT(MAXPAGESIZE)) {
+ *(.text .text.* .stub .gnu.linkonce.t.*)
+ *(.rodata .rodata.* .gnu.linkonce.r.*)
+ *(.got .got.*)
+
+ /*
+ * The contents of AutoGen.c files are mostly constant from the POV of the
+ * program, but most of it ends up in .data or .bss by default since few of
+ * the variable definitions that get emitted are declared as CONST.
+ * Unfortunately, we cannot pull it into the .text section entirely, since
+ * patchable PCDs are also emitted here, but we can at least move all of the
+ * emitted GUIDs here.
+ */
+ *:AutoGen.obj(.data.g*Guid)
+ }
+
+ /*
+ * The alignment of the .data section should be less than or equal to the
+ * alignment of the .text section. This ensures that the relative offset
+ * between these sections is the same in the ELF and the PE/COFF versions of
+ * this binary.
+ */
+ .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(MAXPAGESIZE)) {
+ *(.data .data.* .gnu.linkonce.d.*)
+ *(.bss .bss.*)
+ }
+
+ .eh_frame ALIGN(CONSTANT(MAXPAGESIZE)) : {
+ KEEP (*(.eh_frame))
+ }
+
+ .rela (INFO) : {
+ *(.rela .rela.*)
+ }
+
+ .hii : ALIGN(CONSTANT(MAXPAGESIZE)) {
+ KEEP (*(.hii))
+ }
+
+ /*
+ * Retain the GNU build id but in a non-allocatable section so GenFw
+ * does not copy it into the PE/COFF image.
+ */
+ .build-id (INFO) : { *(.note.gnu.build-id) }
+
+ /DISCARD/ : {
+ *(.note.GNU-stack)
+ *(.gnu_debuglink)
+ *(.interp)
+ *(.dynsym)
+ *(.dynstr)
+ *(.dynamic)
+ *(.hash .gnu.hash)
+ *(.comment)
+ *(COMMON)
+ }
+}
--
2.31.1.windows.1
next prev parent reply other threads:[~2021-06-02 8:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 8:11 [PATCH v2 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
2021-06-02 8:11 ` Ni, Ray [this message]
2021-06-02 8:11 ` [PATCH v2 2/6] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image Ni, Ray
2021-06-04 13:31 ` [edk2-devel] " Leif Lindholm
2021-06-05 0:07 ` Ni, Ray
2021-06-05 1:19 ` Ni, Ray
2021-06-05 1:35 ` 回复: " gaoliming
2021-06-02 8:11 ` [PATCH v2 3/6] BaseTools: Update build_rule to skip CLANG resource section generation Ni, Ray
2021-06-02 8:11 ` [PATCH v2 4/6] BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8 Ni, Ray
2021-06-02 8:11 ` [PATCH v2 5/6] BaseTools: Update ClangBase.lds to keep dynamic section Ni, Ray
2021-06-02 8:11 ` [PATCH v2 6/6] BaseTools: Change CLANG8ELF to CLANGDWARF Ni, Ray
2021-06-04 5:42 ` 回复: [edk2-devel] [PATCH v2 0/6] Add CLANGDWARF toolchain for universal payload needs gaoliming
2021-06-04 8:57 ` Bob Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210602081145.265-2-ray.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox