diff options
-rwxr-xr-x | BaseTools/Conf/tools_def.template | 3 | ||||
-rw-r--r-- | BaseTools/Scripts/ClangBase.lds | 89 | ||||
-rw-r--r-- | BaseTools/Scripts/GccBase.lds | 6 |
3 files changed, 4 insertions, 94 deletions
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 25579d853e..db7d4b4164 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -2036,7 +2036,7 @@ DEFINE CLANGDWARF_X64_PREFIX = ENV(CLANG_BIN) # LLVM/CLANG doesn't support -n link option. So, it can't share the same IA32_X64_DLINK_COMMON flag.
# LLVM/CLANG doesn't support common page size. So, it can't share the same GccBase.lds script.
DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-sections -z common-page-size=0x40
-DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
+DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive -Wl,-z,notext
DEFINE CLANGDWARF_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
@@ -2216,7 +2216,6 @@ RELEASE_CLANGDWARF_AARCH64_DLINK_FLAGS = DEF(CLANGDWARF_AARCH64_DLINK_FLAGS) -fl DEFINE CLANGDWARF_RISCV64_TARGET = -target riscv64-linux-gnu
DEFINE CLANGDWARF_RISCV64_CC_COMMON = DEF(GCC5_RISCV_ALL_CC_FLAGS) DEF(GCC5_RISCV_ALL_CC_FLAGS_WARNING_DISABLE) DEF(GCC5_RISCV_OPENSBI_TYPES) -march=DEF(GCC5_RISCV64_ARCH) -fno-builtin -fno-builtin-memcpy -fno-stack-protector -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -Wno-unused-but-set-variable -fpack-struct=8 -mcmodel=medany -mabi=lp64 -mno-relax
DEFINE CLANGDWARF_RISCV64_CC_FLAGS = DEF(CLANGDWARF_RISCV64_CC_COMMON) DEF(CLANGDWARF_RISCV64_TARGET) DEF(CLANGDWARF_WARNING_OVERRIDES)
-DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
# This is similar to GCC flags but without -n
DEFINE CLANGDWARF_RISCV64_ALL_DLINK_COMMON = -nostdlib -Wl,-q,--gc-sections -z common-page-size=0x40
diff --git a/BaseTools/Scripts/ClangBase.lds b/BaseTools/Scripts/ClangBase.lds deleted file mode 100644 index f7981843d6..0000000000 --- a/BaseTools/Scripts/ClangBase.lds +++ /dev/null @@ -1,89 +0,0 @@ -/** @file
-
- Unified linker script for CLANG based builds
-
- Copyright (c) 2010 - 2021, 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(COMMONPAGESIZE)) {
- KEEP(*(.entry))
- *(.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(COMMONPAGESIZE)) {
- *(.data .data.* .gnu.linkonce.d.*)
- *(.bss .bss.*)
- }
-
- .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
- KEEP (*(.eh_frame))
- }
-
- .rela (INFO) : {
- *(.rela .rela.*)
- }
-
- .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {
- KEEP (*(.hii))
- }
-
- .got : {
- *(.got)
- }
- ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!")
-
- .got.plt (INFO) : {
- *(.got.plt)
- }
- ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0xc || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!")
-
- /*
- * 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)
- *(.hash .gnu.hash)
- *(.comment)
- *(COMMON)
- }
-}
diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds index 9f27e83bb0..582d00ccba 100644 --- a/BaseTools/Scripts/GccBase.lds +++ b/BaseTools/Scripts/GccBase.lds @@ -1,8 +1,8 @@ /** @file
- Unified linker script for GCC based builds
+ Unified linker script for GCC and CLANG based builds
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2021, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
@@ -21,6 +21,7 @@ SECTIONS { . = PECOFF_HEADER_SIZE;
.text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
+ KEEP(*(.entry))
*(.text .text.* .stub .gnu.linkonce.t.*)
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.got .got.*)
@@ -81,7 +82,6 @@ SECTIONS { *(.interp)
*(.dynsym)
*(.dynstr)
- *(.dynamic)
*(.hash .gnu.hash)
*(.comment)
}
|