Date   

[patch 1/2] BaseTool/VfrCompile: Add missing question opcode

Dandan Bi
 

The function CheckQuestionOpCode is to check whether the opcode
is question opcode, but it misses two question opcodes:
'EFI_IFR_REF_OP' and 'EFI_IFR_RESET_BUTTON'. Now add them.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
---
BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
index 1612217..892b7b8 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
@@ -1,10 +1,10 @@
/** @file

The definition of CFormPkg's member function

-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

@@ -1179,10 +1179,12 @@ CIfrRecordInfoDB::CheckQuestionOpCode (
case EFI_IFR_ACTION_OP:
case EFI_IFR_STRING_OP:
case EFI_IFR_DATE_OP:
case EFI_IFR_TIME_OP:
case EFI_IFR_ORDERED_LIST_OP:
+ case EFI_IFR_REF_OP:
+ case EFI_IFR_RESET_BUTTON_OP:
return TRUE;
default:
return FALSE;
}
}
--
1.9.5.msysgit.1


[patch 0/2] BaseTools/VfrCompile: Add two new option for VfrCompile

Dandan Bi
 

patch 1 is to fix a bug in current code.
patch 2 is to add two compile option for VfrCompile.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>

Dandan Bi (2):
BaseTool/VfrCompile: Add missing question opcode
BaseTools/VfrCompile: Add two new option for VfrCompile

BaseTools/Source/C/VfrCompile/VfrCompiler.cpp | 56 +-
BaseTools/Source/C/VfrCompile/VfrCompiler.h | 3 +-
BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 792 ++++++++++++++++++++++--
BaseTools/Source/C/VfrCompile/VfrFormPkg.h | 33 +-
BaseTools/Source/C/VfrCompile/VfrSyntax.g | 118 ++--
BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 68 +-
BaseTools/Source/C/VfrCompile/VfrUtilityLib.h | 18 +-
7 files changed, 921 insertions(+), 167 deletions(-)

--
1.9.5.msysgit.1


Re: [PATCH v2 2/7] BaseTools-GenFw:Add new x86_64 Elf relocation types for PIC/PIE code

Ard Biesheuvel
 

(adding back our friends on cc)

On 1 August 2016 at 12:36, Shi, Steven <steven.shi@intel.com> wrote:
On 1 August 2016 at 12:16, Shi, Steven <steven.shi@intel.com> wrote:
OK, another example:

pie.s:

.globl foo
foo:
pushq n@GOTPCREL(%rip)
popq %rax
ret

.globl bar
bar:
pushq n@GOTPCREL(%rip)
popq %rax
ret

.globl n
n:
.quad 0

compile and link using

gcc -c -o pie.o /tmp/pie.s
ld -q -o pie pie.o -e foo

gives me

Relocation section '.rela.text' at offset 0x260 contains 2 entries:
Offset Info Type Sym. Value Sym. Name + Addend
0000004000b2 000700000009 R_X86_64_GOTPCREL 00000000004000be
n -
4
0000004000b9 000700000009 R_X86_64_GOTPCREL 00000000004000be
n -
4

Here, pie is a fully linked binary.
[Steven]: In this example, there are two R_X86_64_GOTPCREL relocation
address in the .text section need to fix up with same symbol runtime address,
these two relocation addresses are not same, and every relocation address
will be fixed up once. I don't see the problem of "Having multiple fixups for
the same symbol in the .reloc section", and current GenFw code should has
no problem on this example.
How many times will your code call CoffAddFixup() for the address of n?
[Steven]: My understanding is the n address (6000c8) is not a GOTPCREL relocation in .text section, but the 4000b2 and 4000b2 are GOTPCREL relocation in .text section. My CoffAddFixup() will only call twice for 4000b2 and 4000b2, but not for n address (6000c8).

Disassembly of section .text:

00000000004000b0 <foo>:
4000b0: ff 35 12 00 20 00 pushq 0x200012(%rip) # 6000c8 <n+0x200008>
4000b6: 58 pop %rax
4000b7: c3 retq

00000000004000b8 <bar>:
4000b8: ff 35 0a 00 20 00 pushq 0x20000a(%rip) # 6000c8 <n+0x200008>
4000be: 58 pop %rax
4000bf: c3 retq

00000000004000c0 <n>:
...
CoffAddFixup() must be used for absolute symbol references only. These
instructions contain relative symbol references, which are
recalculated in WriteSections64().

The only absolute symbol reference is the GOT entry for 'n', and your
code (in WriteRelocations64()) calculates the address of the GOT entry
(which is always in .text BTW) and adds a fixup for it, i.e.,

+ CoffAddFixup(
+ (UINT32)(UINTN)((UINT64)
mCoffSectionsOffset[RelShdr->sh_info] + GoTPcRelPtrOffset),
+ EFI_IMAGE_REL_BASED_DIR64);

This code adds a fixup to the PE/COFF .reloc section for the GOT entry
containing the address of 'n', and the instructions perform a IP
relative load of the contents of the GOT entry to retrieve the address
of 'n'.

By adding two fixups, the PE/COFF loader will apply the load offset
twice, resulting in an incorrect value.

--
Ard.


Re: [RFC 1/2] MdeModulePkg/EbcDxe: Add AARCH64 EBC VM support

Leif Lindholm <leif.lindholm@...>
 

(Apologies, missed out on this branch of the thread on first pass
since I was dropped from cc.)

On Sun, Jul 31, 2016 at 11:32:08PM -0700, Jordan Justen wrote:
On 2016-07-31 19:12:03, Tian, Feng wrote:
I may not speak it clear. Sorry for that.

I saw the patch with commit log "Submitted on behalf of a
third-party: xxxx". But this is part of "TianoCore Contribution
Agreement 1.0 section 4".

And the Contributions.txt clearly says "the commit message must
include your "Signed-off-by" signature, and "Contributed-under"
message". But the commit log hasn't.

So I am total confused how to solve this case. What's the correct
format for this?
Yes, Contributed-under and Signed-off-by are required.

I think it is possible in some cases to submit a third party
conribution, but you still have to add the Contributed-under and
Signed-off-by. See Contribtions.txt under either package for the text
of the 'TianoCore Contribution Agreement' to understand what the
'Contributed-under' tag is indicating. Basically you'd be asserting
that you are sure that the contribuion can be used under the
conditions specified in the TianoCore Contribution Agreement, despite
the fact that you don't own the copyright.
Since I was not certain of how this was historically, or should in the
future, be interpreted I left the Contributed-under out from the
submission.

The bit that is unclear to me is "You may submit it to TianoCore site
separately from any Contribution".
- Should this read "separately from any other contribution"?
- For practical purposes, Does separately mean "in a separate commit"?

If the answers to the two above questions are "yes", then I'm happy to
resubmit it with a Contributed-under.

Obviously it is easier if someone that owns the copyright makes the
patch submission.
Don't get me started...

/
Leif

We've taken code into OvmfPkg that wasn't contributed directly by the
copyright owner. (for example, some of the Xen .h files)
-Jordan


-----Original Message-----
From: Marvin H?user [mailto:Marvin.Haeuser@outlook.com]
Sent: Monday, August 1, 2016 9:58 AM
To: edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>
Subject: RE: [RFC 1/2] MdeModulePkg/EbcDxe: Add AARCH64 EBC VM support

Hey Feng,

According to the Contributions document, BSD 2-clause is one of the licenses that can be accepted, if the parent license cannot be used:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Contributions.txt#L25

Regards,
Marvin.

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
Tian, Feng
Sent: Monday, August 1, 2016 3:50 AM
To: Leif Lindholm <leif.lindholm@linaro.org>; edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Daniil Egranov
<daniil.egranov@linaro.org>; Jeff Brasen <jbrasen@codeaurora.org>;
Zeng, Star <star.zeng@intel.com>; Ard Biesheuvel
<ard.biesheuvel@linaro.org>
Subject: Re: [edk2] [RFC 1/2] MdeModulePkg/EbcDxe: Add AARCH64 EBC VM
support

Hi, Leif

If I understand correctly, EDKII doesn't allow such BSD license.

Correct me if anybody has different opinions.

Thanks
Feng

-----Original Message-----
From: Leif Lindholm [mailto:leif.lindholm@linaro.org]
Sent: Saturday, July 30, 2016 12:06 AM
To: edk2-devel@lists.01.org
Cc: Jeff Brasen <jbrasen@codeaurora.org>; Ard Biesheuvel
<ard.biesheuvel@linaro.org>; Daniil Egranov
<daniil.egranov@linaro.org>; Tian, Feng <feng.tian@intel.com>; Zeng,
Star <star.zeng@intel.com>
Subject: [RFC 1/2] MdeModulePkg/EbcDxe: Add AARCH64 EBC VM support

From: Jeff Brasen <jbrasen@codeaurora.org>

Adds support for the EBC VM for AARCH64 platforms

Submitted on behalf of a third-party: The Linux Foundation This
contribution is licensed under the BSD license as found at
http://opensource.org/licenses/bsd-license.php

[Taken from https://source.codeaurora.org/external/server/edk2-blue/]
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
.../Universal/EbcDxe/AArch64/EbcLowLevel.S | 135 +++++
MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c | 563
+++++++++++++++++++++
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf | 6 +-
3 files changed, 703 insertions(+), 1 deletion(-) create mode 100644
MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
create mode 100644
MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c

diff --git a/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
new file mode 100644
index 0000000..e858227
--- /dev/null
+++ b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
@@ -0,0 +1,135 @@
+#/** @file
+#
+# This code provides low level routines that support the Virtual Machine
+# for option ROMs.
+#
+# Copyright (c) 2015, The Linux Foundation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights
+reserved.<BR> # This program and the accompanying materials # are
+licensed and made available under the terms and conditions of the BSD
+License # which accompanies this distribution. The full text of the
+license may be found at #
+http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
+BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
EITHER EXPRESS OR IMPLIED.
+#
+#**/
+
+#--------------------------------------------------------------------
+--
+-----
+# Equate files needed.
+#--------------------------------------------------------------------
+--
+-----
+
+ASM_GLOBAL ASM_PFX(CopyMem);
+ASM_GLOBAL ASM_PFX(EbcInterpret);
+ASM_GLOBAL ASM_PFX(ExecuteEbcImageEntryPoint);
+
+#********************************************************
**************
+******
+# EbcLLCALLEX
+#
+# This function is called to execute an EBC CALLEX instruction.
+# This instruction requires that we thunk out to external native #
+code. For AArch64, we copy the VM stack into the main stack and then
+pop # the first 8 arguments off according to the AArch64 Procedure
+Call Standard # On return, we restore the stack pointer to its original location.
+#
+#********************************************************
**************
+****** # UINTN EbcLLCALLEXNative(UINTN FuncAddr, UINTN
NewStackPointer,
+VOID *FramePtr) ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative);
+ASM_PFX(EbcLLCALLEXNative):
+ stp x19, x20, [sp, #-16]!
+ stp x29, x30, [sp, #-16]!
+
+ mov x19, x0
+ mov x20, sp
+ sub x2, x2, x1 // Length = NewStackPointer-FramePtr
+ sub sp, sp, x2
+ sub sp, sp, #64 // Make sure there is room for at least 8
+ args in the new
stack
+ mov x0, sp
+
+ bl CopyMem // Sp, NewStackPointer, Length
+
+ ldp x0, x1, [sp], #16
+ ldp x2, x3, [sp], #16
+ ldp x4, x5, [sp], #16
+ ldp x6, x7, [sp], #16
+
+ blr x19
+
+ mov sp, x20
+ ldp x29, x30, [sp], #16
+ ldp x19, x20, [sp], #16
+
+ ret
+
+#********************************************************
**************
+******
+# EbcLLEbcInterpret
+#
+# This function is called by the thunk code to handle an Native to
+EBC call # This can handle up to 16 arguments (1-8 on in x0-x7, 9-16
+are on the stack) # x9 contains the Entry point that will be the
+first argument when # EBCInterpret is called.
+#
+#********************************************************
**************
+******
+ASM_GLOBAL ASM_PFX(EbcLLEbcInterpret);
+ASM_PFX(EbcLLEbcInterpret):
+ stp x29, x30, [sp, #-16]!
+
+ // copy the current arguments 9-16 from old location and add arg
+ 7 to
stack
+ // keeping 16 byte stack alignment
+ sub sp, sp, #80
+ str x7, [sp]
+ ldr x11, [sp, #96]
+ str x11, [sp, #8]
+ ldr x11, [sp, #104]
+ str x11, [sp, #16]
+ ldr x11, [sp, #112]
+ str x11, [sp, #24]
+ ldr x11, [sp, #120]
+ str x11, [sp, #32]
+ ldr x11, [sp, #128]
+ str x11, [sp, #40]
+ ldr x11, [sp, #136]
+ str x11, [sp, #48]
+ ldr x11, [sp, #144]
+ str x11, [sp, #56]
+ ldr x11, [sp, #152]
+ str x11, [sp, #64]
+
+ // Shift arguments and add entry point and as argument 1
+ mov x7, x6
+ mov x6, x5
+ mov x5, x4
+ mov x4, x3
+ mov x3, x2
+ mov x2, x1
+ mov x1, x0
+ mov x0, x9
+
+ # call C-code
+ bl ASM_PFX(EbcInterpret)
+ add sp, sp, #80
+
+ ldp x29, x30, [sp], #16
+
+ ret
+
+#********************************************************
**************
+******
+# EbcLLExecuteEbcImageEntryPoint
+#
+# This function is called by the thunk code to handle the image entry
+point # x9 contains the Entry point that will be the first argument
+when # ExecuteEbcImageEntryPoint is called.
+#
+#********************************************************
**************
+****** ASM_GLOBAL ASM_PFX(EbcLLExecuteEbcImageEntryPoint);
+ASM_PFX(EbcLLExecuteEbcImageEntryPoint):
+ stp x29, x30, [sp, #-16]!
+ # build new paramater calling convention
+ mov x2, x1
+ mov x1, x0
+ mov x0, x9
+
+ # call C-code
+ bl ASM_PFX(ExecuteEbcImageEntryPoint)
+ ldp x29, x30, [sp], #16
+ ret
diff --git a/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c
b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c
new file mode 100644
index 0000000..23261a0
--- /dev/null
+++ b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c
@@ -0,0 +1,563 @@
+/** @file
+ This module contains EBC support routines that are customized based
+on
+ the target AArch64 processor.
+
+Copyright (c) 2015, The Linux Foundation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights
+reserved.<BR> This program and the accompanying materials are
+licensed and made available under the terms and conditions of the BSD
+License which accompanies this distribution. The full text of the
+license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED.
+
+**/
+
+#include "EbcInt.h"
+#include "EbcExecute.h"
+
+//
+// Amount of space that is not used in the stack // #define
+STACK_REMAIN_SIZE (1024 * 4)
+
+//
+// This is instruction buffer used to create EBC thunk //
+#define EBC_MAGIC_SIGNATURE 0xCA112EBCCA112EBCull
+#define EBC_ENTRYPOINT_SIGNATURE 0xAFAFAFAFAFAFAFAFull
+#define EBC_LL_EBC_ENTRYPOINT_SIGNATURE 0xFAFAFAFAFAFAFAFAull
+UINT8 mInstructionBufferTemplate[] = {
+ 0x03, 0x00, 0x00, 0x14, //b pc+16
+ //
+ // Add a magic code here to help the VM recognize the thunk..
+ //
+ (UINT8)(EBC_MAGIC_SIGNATURE & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 56) & 0xFF),
+ 0x69, 0x00, 0x00, 0x58, //ldr x9, #32
+ 0x8A, 0x00, 0x00, 0x58, //ldr x10, #40
+ 0x05, 0x00, 0x00, 0x14, //b pc+32
+ (UINT8)(EBC_ENTRYPOINT_SIGNATURE & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 56) & 0xFF),
+ (UINT8)(EBC_LL_EBC_ENTRYPOINT_SIGNATURE & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 56) & 0xFF),
+ 0x40, 0x01, 0x1F, 0xD6 //br x10
+
+};
+
+/**
+ Begin executing an EBC image.
+ This is used for Ebc Thunk call.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcLLEbcInterpret (
+ VOID
+ );
+
+/**
+ Begin executing an EBC image.
+ This is used for Ebc image entrypoint.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcLLExecuteEbcImageEntryPoint (
+ VOID
+ );
+
+/**
+ Pushes a 64 bit unsigned value to the VM stack.
+
+ @param VmPtr The pointer to current VM context.
+ @param Arg The value to be pushed.
+
+**/
+VOID
+PushU64 (
+ IN VM_CONTEXT *VmPtr,
+ IN UINT64 Arg
+ )
+{
+ //
+ // Advance the VM stack down, and then copy the argument to the stack.
+ // Hope it's aligned.
+ //
+ VmPtr->Gpr[0] -= sizeof (UINT64);
+ *(UINT64 *) VmPtr->Gpr[0] = Arg;
+ return;
+}
+
+
+/**
+ Begin executing an EBC image.
+
+ This is a thunk function.
+
+ @param EntryPoint The entrypoint of EBC code.
+ @param Arg1 The 1st argument.
+ @param Arg2 The 2nd argument.
+ @param Arg3 The 3rd argument.
+ @param Arg4 The 4th argument.
+ @param Arg5 The 5th argument.
+ @param Arg6 The 6th argument.
+ @param Arg7 The 7th argument.
+ @param Arg8 The 8th argument.
+ @param Arg9 The 9th argument.
+ @param Arg10 The 10th argument.
+ @param Arg11 The 11th argument.
+ @param Arg12 The 12th argument.
+ @param Arg13 The 13th argument.
+ @param Arg14 The 14th argument.
+ @param Arg15 The 15th argument.
+ @param Arg16 The 16th argument.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcInterpret (
+ IN UINTN EntryPoint,
+ IN UINTN Arg1,
+ IN UINTN Arg2,
+ IN UINTN Arg3,
+ IN UINTN Arg4,
+ IN UINTN Arg5,
+ IN UINTN Arg6,
+ IN UINTN Arg7,
+ IN UINTN Arg8,
+ IN UINTN Arg9,
+ IN UINTN Arg10,
+ IN UINTN Arg11,
+ IN UINTN Arg12,
+ IN UINTN Arg13,
+ IN UINTN Arg14,
+ IN UINTN Arg15,
+ IN UINTN Arg16
+ )
+{
+ //
+ // Create a new VM context on the stack
+ //
+ VM_CONTEXT VmContext;
+ UINTN Addr;
+ EFI_STATUS Status;
+ UINTN StackIndex;
+
+ //
+ // Get the EBC entry point
+ //
+ Addr = EntryPoint;
+
+ //
+ // Now clear out our context
+ //
+ ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
+
+ //
+ // Set the VM instruction pointer to the correct location in memory.
+ //
+ VmContext.Ip = (VMIP) Addr;
+
+ //
+ // Initialize the stack pointer for the EBC. Get the current system
+ stack // pointer and adjust it down by the max needed for the interpreter.
+ //
+
+ //
+ // Adjust the VM's stack pointer down.
+ //
+
+ Status = GetEBCStack((EFI_HANDLE)(UINTN)-1, &VmContext.StackPool,
+ &StackIndex); if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ VmContext.StackTop = (UINT8*)VmContext.StackPool +
+ (STACK_REMAIN_SIZE); VmContext.Gpr[0] = (UINT64)
+ ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
+ VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
VmContext.Gpr[0]
+ -= sizeof (UINTN);
+
+ //
+ // Align the stack on a natural boundary.
+ //
+ VmContext.Gpr[0] &= ~(VM_REGISTER)(sizeof (UINTN) - 1);
+
+ //
+ // Put a magic value in the stack gap, then adjust down again.
+ //
+ *(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN)
VM_STACK_KEY_VALUE;
+ VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
+
+ //
+ // The stack upper to LowStackTop is belong to the VM.
+ //
+ VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
+
+ //
+ // For the worst case, assume there are 4 arguments passed in
+ registers, store // them to VM's stack.
+ //
+ PushU64 (&VmContext, (UINT64) Arg16);
+ PushU64 (&VmContext, (UINT64) Arg15);
+ PushU64 (&VmContext, (UINT64) Arg14);
+ PushU64 (&VmContext, (UINT64) Arg13);
+ PushU64 (&VmContext, (UINT64) Arg12);
+ PushU64 (&VmContext, (UINT64) Arg11);
+ PushU64 (&VmContext, (UINT64) Arg10);
+ PushU64 (&VmContext, (UINT64) Arg9);
+ PushU64 (&VmContext, (UINT64) Arg8);
+ PushU64 (&VmContext, (UINT64) Arg7);
+ PushU64 (&VmContext, (UINT64) Arg6);
+ PushU64 (&VmContext, (UINT64) Arg5);
+ PushU64 (&VmContext, (UINT64) Arg4);
+ PushU64 (&VmContext, (UINT64) Arg3);
+ PushU64 (&VmContext, (UINT64) Arg2);
+ PushU64 (&VmContext, (UINT64) Arg1);
+
+ //
+ // Interpreter assumes 64-bit return address is pushed on the stack.
+ // AArch64 does not do this so pad the stack accordingly.
+ //
+ PushU64 (&VmContext, (UINT64) 0);
+ PushU64 (&VmContext, (UINT64) 0x1234567887654321ULL);
+
+ //
+ // For AArch64, this is where we say our return address is //
+ VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
+
+ //
+ // We need to keep track of where the EBC stack starts. This way,
+ if the EBC // accesses any stack variables above its initial stack
+ setting, then we know // it's accessing variables passed into it,
+ which means the data is on the // VM's stack.
+ // When we're called, on the stack (high to low) we have the
+ parameters, the // return address, then the saved ebp. Save the
+ pointer
to the return address.
+ // EBC code knows that's there, so should look above it for
+ function
parameters.
+ // The offset is the size of locals (VMContext + Addr + saved ebp).
+ // Note that the interpreter assumes there is a 16 bytes of return
+ address on // the stack too, so adjust accordingly.
+ // VmContext.HighStackBottom = (UINTN)(Addr + sizeof (VmContext) +
+ sizeof (Addr)); //
+
+ //
+ // Begin executing the EBC code
+ //
+ EbcExecute (&VmContext);
+
+ //
+ // Return the value in R[7] unless there was an error
+ //
+ ReturnEBCStack(StackIndex);
+ return (UINT64) VmContext.Gpr[7];
+}
+
+
+/**
+ Begin executing an EBC image.
+
+ @param EntryPoint The entrypoint of EBC code.
+ @param ImageHandle image handle for the EBC application we're
executing
+ @param SystemTable standard system table passed into an driver's
entry
+ point
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+ExecuteEbcImageEntryPoint (
+ IN UINTN EntryPoint,
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ //
+ // Create a new VM context on the stack
+ //
+ VM_CONTEXT VmContext;
+ UINTN Addr;
+ EFI_STATUS Status;
+ UINTN StackIndex;
+
+ //
+ // Get the EBC entry point
+ //
+ Addr = EntryPoint;
+
+ //
+ // Now clear out our context
+ //
+ ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
+
+ //
+ // Save the image handle so we can track the thunks created for
+ this image // VmContext.ImageHandle = ImageHandle;
VmContext.SystemTable
+ = SystemTable;
+
+ //
+ // Set the VM instruction pointer to the correct location in memory.
+ //
+ VmContext.Ip = (VMIP) Addr;
+
+ //
+ // Initialize the stack pointer for the EBC. Get the current system
+ stack // pointer and adjust it down by the max needed for the interpreter.
+ //
+
+ Status = GetEBCStack(ImageHandle, &VmContext.StackPool,
&StackIndex);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ VmContext.StackTop = (UINT8*)VmContext.StackPool +
+ (STACK_REMAIN_SIZE); VmContext.Gpr[0] = (UINT64)
+ ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
+ VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
VmContext.Gpr[0]
+ -= sizeof (UINTN);
+
+
+ //
+ // Put a magic value in the stack gap, then adjust down again //
+ *(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN)
VM_STACK_KEY_VALUE;
+ VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
+
+ //
+ // Align the stack on a natural boundary VmContext.Gpr[0] &=
+ ~(VM_REGISTER)(sizeof(UINTN) - 1); //
+ VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
+
+ //
+ // Simply copy the image handle and system table onto the EBC stack.
+ // Greatly simplifies things by not having to spill the args.
+ //
+ PushU64 (&VmContext, (UINT64) SystemTable);
+ PushU64 (&VmContext, (UINT64) ImageHandle);
+
+ //
+ // VM pushes 16-bytes for return address. Simulate that here.
+ //
+ PushU64 (&VmContext, (UINT64) 0);
+ PushU64 (&VmContext, (UINT64) 0x1234567887654321ULL);
+
+ //
+ // For AArch64, this is where we say our return address is //
+ VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
+
+ //
+ // Entry function needn't access high stack context, simply // put
+ the stack pointer here.
+ //
+
+ //
+ // Begin executing the EBC code
+ //
+ EbcExecute (&VmContext);
+
+ //
+ // Return the value in R[7] unless there was an error
+ //
+ ReturnEBCStack(StackIndex);
+ return (UINT64) VmContext.Gpr[7];
+}
+
+
+/**
+ Create thunks for an EBC image entry point, or an EBC protocol service.
+
+ @param ImageHandle Image handle for the EBC image. If not null,
then
+ we're creating a thunk for an image entry point.
+ @param EbcEntryPoint Address of the EBC code that the thunk is to
call
+ @param Thunk Returned thunk we create here
+ @param Flags Flags indicating options for creating the thunk
+
+ @retval EFI_SUCCESS The thunk was created successfully.
+ @retval EFI_INVALID_PARAMETER The parameter of EbcEntryPoint is not
16-bit
+ aligned.
+ @retval EFI_OUT_OF_RESOURCES There is not enough memory to
created the EBC
+ Thunk.
+ @retval EFI_BUFFER_TOO_SMALL EBC_THUNK_SIZE is not larger enough.
+
+**/
+EFI_STATUS
+EbcCreateThunks (
+ IN EFI_HANDLE ImageHandle,
+ IN VOID *EbcEntryPoint,
+ OUT VOID **Thunk,
+ IN UINT32 Flags
+ )
+{
+ UINT8 *Ptr;
+ UINT8 *ThunkBase;
+ UINT32 Index;
+ INT32 ThunkSize;
+
+ //
+ // Check alignment of pointer to EBC code // if ((UINT32) (UINTN)
+ EbcEntryPoint & 0x01) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ThunkSize = sizeof(mInstructionBufferTemplate);
+
+ Ptr = AllocatePool (sizeof(mInstructionBufferTemplate));
+
+ if (Ptr == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Print(L"Allocate TH: 0x%X\n", (UINT32)Ptr); // // Save the
+ start address so we can add a pointer to it to a list later.
+ //
+ ThunkBase = Ptr;
+
+ //
+ // Give them the address of our buffer we're going to fix up //
+ *Thunk = (VOID *) Ptr;
+
+ //
+ // Copy whole thunk instruction buffer template // CopyMem (Ptr,
+ mInstructionBufferTemplate, sizeof(mInstructionBufferTemplate));
+
+ //
+ // Patch EbcEntryPoint and EbcLLEbcInterpret // for (Index = 0;
+ Index < sizeof(mInstructionBufferTemplate) - sizeof(UINTN); Index++) {
+ if (*(UINTN *)&Ptr[Index] == EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcEntryPoint;
+ }
+ if (*(UINTN *)&Ptr[Index] == EBC_LL_EBC_ENTRYPOINT_SIGNATURE) {
+ if ((Flags & FLAG_THUNK_ENTRY_POINT) != 0) {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcLLExecuteEbcImageEntryPoint;
+ } else {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcLLEbcInterpret;
+ }
+ }
+ }
+
+ //
+ // Add the thunk to the list for this image. Do this last since the
+ add // function flushes the cache for us.
+ //
+ EbcAddImageThunk (ImageHandle, (VOID *) ThunkBase, ThunkSize);
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ This function is called to execute an EBC CALLEX instruction.
+ The function check the callee's content to see whether it is common
+native
+ code or a thunk to another piece of EBC code.
+ If the callee is common native code, use EbcLLCAllEXASM to
+manipulate,
+ otherwise, set the VM->IP to target EBC code directly to avoid
+another VM
+ be startup which cost time and stack space.
+
+ @param VmPtr Pointer to a VM context.
+ @param FuncAddr Callee's address
+ @param NewStackPointer New stack pointer after the call
+ @param FramePtr New frame pointer after the call
+ @param Size The size of call instruction
+
+**/
+VOID
+EbcLLCALLEX (
+ IN VM_CONTEXT *VmPtr,
+ IN UINTN FuncAddr,
+ IN UINTN NewStackPointer,
+ IN VOID *FramePtr,
+ IN UINT8 Size
+ )
+{
+ UINTN IsThunk;
+ UINTN TargetEbcAddr;
+ UINT8 InstructionBuffer[sizeof(mInstructionBufferTemplate)];
+ UINTN Index;
+ UINTN IndexOfEbcEntrypoint;
+
+ IsThunk = 1;
+ TargetEbcAddr = 0;
+ IndexOfEbcEntrypoint = 0;
+
+ //
+ // Processor specific code to check whether the callee is a thunk to EBC.
+ //
+ CopyMem (InstructionBuffer, (VOID *)FuncAddr,
+ sizeof(InstructionBuffer)); // // Fill the signature according to
+ mInstructionBufferTemplate // for (Index = 0; Index <
+ sizeof(mInstructionBufferTemplate) - sizeof(UINTN); Index++) {
+ if (*(UINTN *)&mInstructionBufferTemplate[Index] ==
EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&InstructionBuffer[Index] = EBC_ENTRYPOINT_SIGNATURE;
+ IndexOfEbcEntrypoint = Index;
+ }
+ if (*(UINTN *)&mInstructionBufferTemplate[Index] ==
EBC_LL_EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&InstructionBuffer[Index] =
EBC_LL_EBC_ENTRYPOINT_SIGNATURE;
+ }
+ }
+ //
+ // Check if we need thunk to native // if (CompareMem
+ (InstructionBuffer, mInstructionBufferTemplate,
sizeof(mInstructionBufferTemplate)) != 0) {
+ IsThunk = 0;
+ }
+
+ if (IsThunk == 1){
+ //
+ // The callee is a thunk to EBC, adjust the stack pointer down 16 bytes and
+ // put our return address and frame pointer on the VM stack.
+ // Then set the VM's IP to new EBC code.
+ //
+ VmPtr->Gpr[0] -= 8;
+ VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], (UINTN) FramePtr);
+ VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->Gpr[0];
+ VmPtr->Gpr[0] -= 8;
+ VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], (UINT64) (UINTN)
+ (VmPtr->Ip + Size));
+
+ CopyMem (&TargetEbcAddr, (UINT8 *)FuncAddr +
+ IndexOfEbcEntrypoint,
sizeof(UINTN));
+ VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr; } else {
+ //
+ // The callee is not a thunk to EBC, call native code,
+ // and get return value.
+ //
+ VmPtr->Gpr[7] = EbcLLCALLEXNative (FuncAddr, NewStackPointer,
+ FramePtr);
+
+ //
+ // Advance the IP.
+ //
+ VmPtr->Ip += Size;
+ }
+}
+
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
index 15dc01c..e9a0b28 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
@@ -5,6 +5,7 @@
# platform and processor-independent mechanisms for loading and
executing EFI # device drivers.
#
+# Copyright (c) 2015, The Linux Foundation. All rights reserved.
# Copyright (c) 2006 - 2014, Intel Corporation. All rights
reserved.<BR> # This program and the accompanying materials # are
licensed and made available under the terms and conditions of the BSD
License @@ -28,7 +29,7 @@ [Defines] # # The following information is
for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF
+# VALID_ARCHITECTURES = IA32 X64 IPF AARCH64
#

[Sources]
@@ -54,6 +55,9 @@ [Sources.IPF]
Ipf/EbcSupport.c
Ipf/EbcLowLevel.s

+[Sources.AARCH64]
+ AArch64/EbcSupport.c
+ AArch64/EbcLowLevel.S

[Packages]
MdePkg/MdePkg.dec
--
2.1.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [patch] NetworkPkg: Fix assert issue in iSCSI driver

Siyuan, Fu
 

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

-----Original Message-----
From: Zhang, Lubo
Sent: Monday, August 1, 2016 4:38 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>; Wu,
Jiaxin <jiaxin.wu@intel.com>
Subject: [patch] NetworkPkg: Fix assert issue in iSCSI driver

The bug is caused by using already freed memory.
If there is already an attempt and execute
'reconnect -r' command, all the AttemptConfig structure
will be freed, but the mCallbackInfo->Current is not
configured as null and this pointer will be used again in
IScsiFormExtractConfig.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
---
NetworkPkg/IScsiDxe/IScsiMisc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c
b/NetworkPkg/IScsiDxe/IScsiMisc.c
index deebf5d..a39c268 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -898,10 +898,12 @@ IScsiCleanDriverData (

EXIT:

gBS->CloseEvent (Private->ExitBootServiceEvent);

+ mCallbackInfo->Current = NULL;
+
FreePool (Private);
return Status;
}

/**
--
1.9.5.msysgit.1


Re: [patch] NetworkPkg: Fix assert issue in iSCSI driver

Ye, Ting <ting.ye@...>
 

Reviewed-by: Ye Ting <ting.ye@intel.com>

-----Original Message-----
From: Zhang, Lubo
Sent: Monday, August 01, 2016 4:38 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [patch] NetworkPkg: Fix assert issue in iSCSI driver

The bug is caused by using already freed memory.
If there is already an attempt and execute 'reconnect -r' command, all the AttemptConfig structure will be freed, but the mCallbackInfo->Current is not configured as null and this pointer will be used again in IScsiFormExtractConfig.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
---
NetworkPkg/IScsiDxe/IScsiMisc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index deebf5d..a39c268 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -898,10 +898,12 @@ IScsiCleanDriverData (

EXIT:

gBS->CloseEvent (Private->ExitBootServiceEvent);

+ mCallbackInfo->Current = NULL;
+
FreePool (Private);
return Status;
}

/**
--
1.9.5.msysgit.1


[patch] NetworkPkg: Fix assert issue in iSCSI driver

Zhang Lubo <lubo.zhang@...>
 

The bug is caused by using already freed memory.
If there is already an attempt and execute
'reconnect -r' command, all the AttemptConfig structure
will be freed, but the mCallbackInfo->Current is not
configured as null and this pointer will be used again in
IScsiFormExtractConfig.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
---
NetworkPkg/IScsiDxe/IScsiMisc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index deebf5d..a39c268 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -898,10 +898,12 @@ IScsiCleanDriverData (

EXIT:

gBS->CloseEvent (Private->ExitBootServiceEvent);

+ mCallbackInfo->Current = NULL;
+
FreePool (Private);
return Status;
}

/**
--
1.9.5.msysgit.1


Re: [RFC 1/2] MdeModulePkg/EbcDxe: Add AARCH64 EBC VM support

Ard Biesheuvel
 

On 29 July 2016 at 23:58, Daniil Egranov <daniil.egranov@arm.com> wrote:
Hi Leif,



On 07/29/2016 11:06 AM, Leif Lindholm wrote:

From: Jeff Brasen <jbrasen@codeaurora.org>

Adds support for the EBC VM for AARCH64 platforms

Submitted on behalf of a third-party: The Linux Foundation
This contribution is licensed under the BSD license as found at
http://opensource.org/licenses/bsd-license.php

[Taken from https://source.codeaurora.org/external/server/edk2-blue/]
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
.../Universal/EbcDxe/AArch64/EbcLowLevel.S | 135 +++++
MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c | 563
+++++++++++++++++++++
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf | 6 +-
3 files changed, 703 insertions(+), 1 deletion(-)
create mode 100644 MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
create mode 100644 MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c

diff --git a/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
new file mode 100644
index 0000000..e858227
--- /dev/null
+++ b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
@@ -0,0 +1,135 @@
+#/** @file
+#
+# This code provides low level routines that support the Virtual
Machine
+# for option ROMs.
+#
+# Copyright (c) 2015, The Linux Foundation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the
BSD License
+# which accompanies this distribution. The full text of the license may
be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED.
+#
+#**/
+

+#---------------------------------------------------------------------------
+# Equate files needed.

+#---------------------------------------------------------------------------
+
+ASM_GLOBAL ASM_PFX(CopyMem);
+ASM_GLOBAL ASM_PFX(EbcInterpret);
+ASM_GLOBAL ASM_PFX(ExecuteEbcImageEntryPoint);
+

+#****************************************************************************
+# EbcLLCALLEX
+#
+# This function is called to execute an EBC CALLEX instruction.
+# This instruction requires that we thunk out to external native
+# code. For AArch64, we copy the VM stack into the main stack and then
pop
+# the first 8 arguments off according to the AArch64 Procedure Call
Standard
+# On return, we restore the stack pointer to its original location.
+#

+#****************************************************************************
+# UINTN EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID
*FramePtr)
The code has a mix of using UINTN and UINT64 types. Even the ProcessorBind.h
defines UINTN as UINT64 for Aarch64, this code is specific for the Aarch64
architecture. Should the UINT64 type be explicitly used instead of UINTN and
avoid mixing of this types?
I don't object to using UINTN and UINT64 interchangeably in a file
that is specific to an architecture where they resolve to the same
thing.

+ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative);
+ASM_PFX(EbcLLCALLEXNative):
+ stp x19, x20, [sp, #-16]!
+ stp x29, x30, [sp, #-16]!
+
+ mov x19, x0
+ mov x20, sp
+ sub x2, x2, x1 // Length = NewStackPointer-FramePtr
+ sub sp, sp, x2
+ sub sp, sp, #64 // Make sure there is room for at least 8 args in
the new stack
+ mov x0, sp
+
+ bl CopyMem // Sp, NewStackPointer, Length
+
+ ldp x0, x1, [sp], #16
+ ldp x2, x3, [sp], #16
+ ldp x4, x5, [sp], #16
+ ldp x6, x7, [sp], #16
+
+ blr x19
+
+ mov sp, x20
+ ldp x29, x30, [sp], #16
+ ldp x19, x20, [sp], #16
+
+ ret
+

+#****************************************************************************
+# EbcLLEbcInterpret
+#
+# This function is called by the thunk code to handle an Native to EBC
call
+# This can handle up to 16 arguments (1-8 on in x0-x7, 9-16 are on the
stack)
+# x9 contains the Entry point that will be the first argument when
+# EBCInterpret is called.
+#

+#****************************************************************************
+ASM_GLOBAL ASM_PFX(EbcLLEbcInterpret);
+ASM_PFX(EbcLLEbcInterpret):
+ stp x29, x30, [sp, #-16]!
+
+ // copy the current arguments 9-16 from old location and add arg 7 to
stack
+ // keeping 16 byte stack alignment
+ sub sp, sp, #80
+ str x7, [sp]
+ ldr x11, [sp, #96]
+ str x11, [sp, #8]
+ ldr x11, [sp, #104]
+ str x11, [sp, #16]
+ ldr x11, [sp, #112]
+ str x11, [sp, #24]
+ ldr x11, [sp, #120]
+ str x11, [sp, #32]
+ ldr x11, [sp, #128]
+ str x11, [sp, #40]
+ ldr x11, [sp, #136]
+ str x11, [sp, #48]
+ ldr x11, [sp, #144]
+ str x11, [sp, #56]
+ ldr x11, [sp, #152]
+ str x11, [sp, #64]
+
+ // Shift arguments and add entry point and as argument 1
+ mov x7, x6
+ mov x6, x5
+ mov x5, x4
+ mov x4, x3
+ mov x3, x2
+ mov x2, x1
+ mov x1, x0
+ mov x0, x9
+
+ # call C-code
+ bl ASM_PFX(EbcInterpret)
+ add sp, sp, #80
+
+ ldp x29, x30, [sp], #16
+
+ ret
+

+#****************************************************************************
+# EbcLLExecuteEbcImageEntryPoint
+#
+# This function is called by the thunk code to handle the image entry
point
+# x9 contains the Entry point that will be the first argument when
+# ExecuteEbcImageEntryPoint is called.
+#

+#****************************************************************************
+ASM_GLOBAL ASM_PFX(EbcLLExecuteEbcImageEntryPoint);
+ASM_PFX(EbcLLExecuteEbcImageEntryPoint):
+ stp x29, x30, [sp, #-16]!
+ # build new paramater calling convention
+ mov x2, x1
+ mov x1, x0
+ mov x0, x9
+
+ # call C-code
+ bl ASM_PFX(ExecuteEbcImageEntryPoint)
+ ldp x29, x30, [sp], #16
+ ret
diff --git a/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c
b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c
new file mode 100644
index 0000000..23261a0
--- /dev/null
+++ b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c
@@ -0,0 +1,563 @@
+/** @file
+ This module contains EBC support routines that are customized based on
+ the target AArch64 processor.
+
+Copyright (c) 2015, The Linux Foundation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD
License
+which accompanies this distribution. The full text of the license may be
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED.
+
+**/
+
+#include "EbcInt.h"
+#include "EbcExecute.h"
+
+//
+// Amount of space that is not used in the stack
+//
The "#define VM_STACK_SIZE ()" exists in Ia32, X64 and Ipf code but not
here. However, it's not been used anywhere in the code directly. Is it safe
to ignore it?

+#define STACK_REMAIN_SIZE (1024 * 4)
+
+//
+// This is instruction buffer used to create EBC thunk
+//
+#define EBC_MAGIC_SIGNATURE 0xCA112EBCCA112EBCull
+#define EBC_ENTRYPOINT_SIGNATURE 0xAFAFAFAFAFAFAFAFull
+#define EBC_LL_EBC_ENTRYPOINT_SIGNATURE 0xFAFAFAFAFAFAFAFAull
+UINT8 mInstructionBufferTemplate[] = {
+ 0x03, 0x00, 0x00, 0x14, //b pc+16
+ //
+ // Add a magic code here to help the VM recognize the thunk..
+ //
+ (UINT8)(EBC_MAGIC_SIGNATURE & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 56) & 0xFF),
+ 0x69, 0x00, 0x00, 0x58, //ldr x9, #32
+ 0x8A, 0x00, 0x00, 0x58, //ldr x10, #40
+ 0x05, 0x00, 0x00, 0x14, //b pc+32
+ (UINT8)(EBC_ENTRYPOINT_SIGNATURE & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 56) & 0xFF),
+ (UINT8)(EBC_LL_EBC_ENTRYPOINT_SIGNATURE & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 56) & 0xFF),
+ 0x40, 0x01, 0x1F, 0xD6 //br x10
+
+};
This template may need additional comments explaining the code. There are
couple of branching in the template above with jumping to PC+16 and PC+32.
Are the 16 and 32 correct values?

Assuming that this template should have a similar functionality as x64
template:
mov rax, 0xca112ebcca112ebc //store a magic signature (EBC_MAGIC_SIGNATURE)
mov r10, XXXXXXXXXXXXXXXX // store EBC entry point, the dummy address
replaced with a valid address during runtime (EBC_ENTRYPOINT_SIGNATURE
marker)
mov r11, XXXXXXXXXXXXXXXX //store VM function address, the dummy address
replaced with a valid address during runtime
(EBC_LL_EBC_ENTRYPOINT_SIGNATURE marker)
jmp r11
The thunking code is a bit clunky, and tries to deal with variable
length instructions which makes no sense on AARCH64. I rewrote some
parts of it. I will send it out as soon as I have managed to test it.

+
+/**
+ Begin executing an EBC image.
+ This is used for Ebc Thunk call.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcLLEbcInterpret (
+ VOID
+ );
+
+/**
+ Begin executing an EBC image.
+ This is used for Ebc image entrypoint.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcLLExecuteEbcImageEntryPoint (
+ VOID
+ );
+
+/**
+ Pushes a 64 bit unsigned value to the VM stack.
+
+ @param VmPtr The pointer to current VM context.
+ @param Arg The value to be pushed.
+
+**/
+VOID
+PushU64 (
+ IN VM_CONTEXT *VmPtr,
+ IN UINT64 Arg
+ )
+{
+ //
+ // Advance the VM stack down, and then copy the argument to the stack.
+ // Hope it's aligned.
+ //
+ VmPtr->Gpr[0] -= sizeof (UINT64);
+ *(UINT64 *) VmPtr->Gpr[0] = Arg;
+ return;
+}
+
+
+/**
+ Begin executing an EBC image.
+
+ This is a thunk function.
+
+ @param EntryPoint The entrypoint of EBC code.
+ @param Arg1 The 1st argument.
+ @param Arg2 The 2nd argument.
+ @param Arg3 The 3rd argument.
+ @param Arg4 The 4th argument.
+ @param Arg5 The 5th argument.
+ @param Arg6 The 6th argument.
+ @param Arg7 The 7th argument.
+ @param Arg8 The 8th argument.
+ @param Arg9 The 9th argument.
+ @param Arg10 The 10th argument.
+ @param Arg11 The 11th argument.
+ @param Arg12 The 12th argument.
+ @param Arg13 The 13th argument.
+ @param Arg14 The 14th argument.
+ @param Arg15 The 15th argument.
+ @param Arg16 The 16th argument.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcInterpret (
+ IN UINTN EntryPoint,
+ IN UINTN Arg1,
+ IN UINTN Arg2,
+ IN UINTN Arg3,
+ IN UINTN Arg4,
+ IN UINTN Arg5,
+ IN UINTN Arg6,
+ IN UINTN Arg7,
+ IN UINTN Arg8,
+ IN UINTN Arg9,
+ IN UINTN Arg10,
+ IN UINTN Arg11,
+ IN UINTN Arg12,
+ IN UINTN Arg13,
+ IN UINTN Arg14,
+ IN UINTN Arg15,
+ IN UINTN Arg16
+ )
+{
+ //
+ // Create a new VM context on the stack
+ //
+ VM_CONTEXT VmContext;
+ UINTN Addr;
+ EFI_STATUS Status;
+ UINTN StackIndex;
+
+ //
+ // Get the EBC entry point
+ //
+ Addr = EntryPoint;
+
+ //
+ // Now clear out our context
+ //
+ ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
+
+ //
+ // Set the VM instruction pointer to the correct location in memory.
+ //
+ VmContext.Ip = (VMIP) Addr;
+
+ //
+ // Initialize the stack pointer for the EBC. Get the current system
stack
+ // pointer and adjust it down by the max needed for the interpreter.
+ //
+
+ //
+ // Adjust the VM's stack pointer down.
+ //
+
+ Status = GetEBCStack((EFI_HANDLE)(UINTN)-1, &VmContext.StackPool,
&StackIndex);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
+ VmContext.Gpr[0] = (UINT64) ((UINT8*)VmContext.StackPool +
STACK_POOL_SIZE);
+ VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
+ VmContext.Gpr[0] -= sizeof (UINTN);
+
+ //
+ // Align the stack on a natural boundary.
+ //
+ VmContext.Gpr[0] &= ~(VM_REGISTER)(sizeof (UINTN) - 1);
This code is the same as x64. Is this correct alignment for Aarch64?
This is the VM stack alignment, not the native stack alignment.

+
+ //
+ // Put a magic value in the stack gap, then adjust down again.
+ //
+ *(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) VM_STACK_KEY_VALUE;
+ VmContext.StackMagicPtr = (UINTN *) (UINTN)
VmContext.Gpr[0];
+
+ //
+ // The stack upper to LowStackTop is belong to the VM.
+ //
+ VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
+
+ //
+ // For the worst case, assume there are 4 arguments passed in
registers, store
+ // them to VM's stack.
+ //
+ PushU64 (&VmContext, (UINT64) Arg16);
+ PushU64 (&VmContext, (UINT64) Arg15);
+ PushU64 (&VmContext, (UINT64) Arg14);
+ PushU64 (&VmContext, (UINT64) Arg13);
+ PushU64 (&VmContext, (UINT64) Arg12);
+ PushU64 (&VmContext, (UINT64) Arg11);
+ PushU64 (&VmContext, (UINT64) Arg10);
+ PushU64 (&VmContext, (UINT64) Arg9);
+ PushU64 (&VmContext, (UINT64) Arg8);
+ PushU64 (&VmContext, (UINT64) Arg7);
+ PushU64 (&VmContext, (UINT64) Arg6);
+ PushU64 (&VmContext, (UINT64) Arg5);
+ PushU64 (&VmContext, (UINT64) Arg4);
+ PushU64 (&VmContext, (UINT64) Arg3);
+ PushU64 (&VmContext, (UINT64) Arg2);
+ PushU64 (&VmContext, (UINT64) Arg1);
+
+ //
+ // Interpreter assumes 64-bit return address is pushed on the stack.
+ // AArch64 does not do this so pad the stack accordingly.
+ //
+ PushU64 (&VmContext, (UINT64) 0);
+ PushU64 (&VmContext, (UINT64) 0x1234567887654321ULL);
+
+ //
+ // For AArch64, this is where we say our return address is
+ //
+ VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
+
+ //
+ // We need to keep track of where the EBC stack starts. This way, if
the EBC
+ // accesses any stack variables above its initial stack setting, then
we know
+ // it's accessing variables passed into it, which means the data is on
the
+ // VM's stack.
+ // When we're called, on the stack (high to low) we have the
parameters, the
+ // return address, then the saved ebp. Save the pointer to the return
address.
+ // EBC code knows that's there, so should look above it for function
parameters.
+ // The offset is the size of locals (VMContext + Addr + saved ebp).
+ // Note that the interpreter assumes there is a 16 bytes of return
address on
+ // the stack too, so adjust accordingly.
+ // VmContext.HighStackBottom = (UINTN)(Addr + sizeof (VmContext) +
sizeof (Addr));
+ //
+
+ //
+ // Begin executing the EBC code
+ //
+ EbcExecute (&VmContext);
+
+ //
+ // Return the value in R[7] unless there was an error
+ //
+ ReturnEBCStack(StackIndex);
+ return (UINT64) VmContext.Gpr[7];
+}
+
+
+/**
+ Begin executing an EBC image.
+
+ @param EntryPoint The entrypoint of EBC code.
+ @param ImageHandle image handle for the EBC application we're
executing
+ @param SystemTable standard system table passed into an driver's
entry
+ point
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+ExecuteEbcImageEntryPoint (
+ IN UINTN EntryPoint,
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ //
+ // Create a new VM context on the stack
+ //
+ VM_CONTEXT VmContext;
+ UINTN Addr;
+ EFI_STATUS Status;
+ UINTN StackIndex;
+
+ //
+ // Get the EBC entry point
+ //
+ Addr = EntryPoint;
+
+ //
+ // Now clear out our context
+ //
+ ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
+
+ //
+ // Save the image handle so we can track the thunks created for this
image
+ //
+ VmContext.ImageHandle = ImageHandle;
+ VmContext.SystemTable = SystemTable;
+
+ //
+ // Set the VM instruction pointer to the correct location in memory.
+ //
+ VmContext.Ip = (VMIP) Addr;
+
+ //
+ // Initialize the stack pointer for the EBC. Get the current system
stack
+ // pointer and adjust it down by the max needed for the interpreter.
+ //
+
+ Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
+ VmContext.Gpr[0] = (UINT64) ((UINT8*)VmContext.StackPool +
STACK_POOL_SIZE);
+ VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
+ VmContext.Gpr[0] -= sizeof (UINTN);
+
+
+ //
+ // Put a magic value in the stack gap, then adjust down again
+ //
+ *(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) VM_STACK_KEY_VALUE;
+ VmContext.StackMagicPtr = (UINTN *) (UINTN)
VmContext.Gpr[0];
+
+ //
+ // Align the stack on a natural boundary
+ VmContext.Gpr[0] &= ~(VM_REGISTER)(sizeof(UINTN) - 1);
This code is the same as x64. Is this correct alignment for Aarch64?

+ //
+ VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
+
+ //
+ // Simply copy the image handle and system table onto the EBC stack.
+ // Greatly simplifies things by not having to spill the args.
+ //
+ PushU64 (&VmContext, (UINT64) SystemTable);
+ PushU64 (&VmContext, (UINT64) ImageHandle);
+
+ //
+ // VM pushes 16-bytes for return address. Simulate that here.
+ //
+ PushU64 (&VmContext, (UINT64) 0);
+ PushU64 (&VmContext, (UINT64) 0x1234567887654321ULL);
+
+ //
+ // For AArch64, this is where we say our return address is
+ //
+ VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
+
+ //
+ // Entry function needn't access high stack context, simply
+ // put the stack pointer here.
+ //
+
+ //
+ // Begin executing the EBC code
+ //
+ EbcExecute (&VmContext);
+
+ //
+ // Return the value in R[7] unless there was an error
+ //
+ ReturnEBCStack(StackIndex);
+ return (UINT64) VmContext.Gpr[7];
+}
+
+
+/**
+ Create thunks for an EBC image entry point, or an EBC protocol service.
+
+ @param ImageHandle Image handle for the EBC image. If not
null, then
+ we're creating a thunk for an image entry
point.
+ @param EbcEntryPoint Address of the EBC code that the thunk is
to call
+ @param Thunk Returned thunk we create here
+ @param Flags Flags indicating options for creating the
thunk
+
+ @retval EFI_SUCCESS The thunk was created successfully.
+ @retval EFI_INVALID_PARAMETER The parameter of EbcEntryPoint is not
16-bit
+ aligned.
+ @retval EFI_OUT_OF_RESOURCES There is not enough memory to created the
EBC
+ Thunk.
+ @retval EFI_BUFFER_TOO_SMALL EBC_THUNK_SIZE is not larger enough.
+
+**/
+EFI_STATUS
+EbcCreateThunks (
+ IN EFI_HANDLE ImageHandle,
+ IN VOID *EbcEntryPoint,
+ OUT VOID **Thunk,
+ IN UINT32 Flags
+ )
+{
+ UINT8 *Ptr;
+ UINT8 *ThunkBase;
+ UINT32 Index;
+ INT32 ThunkSize;
+
+ //
+ // Check alignment of pointer to EBC code
+ //
+ if ((UINT32) (UINTN) EbcEntryPoint & 0x01) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ThunkSize = sizeof(mInstructionBufferTemplate);
+
+ Ptr = AllocatePool (sizeof(mInstructionBufferTemplate));
+
+ if (Ptr == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Print(L"Allocate TH: 0x%X\n", (UINT32)Ptr);
+ //
+ // Save the start address so we can add a pointer to it to a list
later.
+ //
+ ThunkBase = Ptr;
+
+ //
+ // Give them the address of our buffer we're going to fix up
+ //
+ *Thunk = (VOID *) Ptr;
+
+ //
+ // Copy whole thunk instruction buffer template
+ //
+ CopyMem (Ptr, mInstructionBufferTemplate,
sizeof(mInstructionBufferTemplate));
+
+ //
+ // Patch EbcEntryPoint and EbcLLEbcInterpret
+ //
+ for (Index = 0; Index < sizeof(mInstructionBufferTemplate) -
sizeof(UINTN); Index++) {
+ if (*(UINTN *)&Ptr[Index] == EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcEntryPoint;
+ }
+ if (*(UINTN *)&Ptr[Index] == EBC_LL_EBC_ENTRYPOINT_SIGNATURE) {
+ if ((Flags & FLAG_THUNK_ENTRY_POINT) != 0) {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcLLExecuteEbcImageEntryPoint;
+ } else {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcLLEbcInterpret;
+ }
+ }
+ }
+
+ //
+ // Add the thunk to the list for this image. Do this last since the add
+ // function flushes the cache for us.
+ //
+ EbcAddImageThunk (ImageHandle, (VOID *) ThunkBase, ThunkSize);
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ This function is called to execute an EBC CALLEX instruction.
+ The function check the callee's content to see whether it is common
native
+ code or a thunk to another piece of EBC code.
+ If the callee is common native code, use EbcLLCAllEXASM to manipulate,
+ otherwise, set the VM->IP to target EBC code directly to avoid another
VM
+ be startup which cost time and stack space.
+
+ @param VmPtr Pointer to a VM context.
+ @param FuncAddr Callee's address
+ @param NewStackPointer New stack pointer after the call
+ @param FramePtr New frame pointer after the call
+ @param Size The size of call instruction
+
+**/
+VOID
+EbcLLCALLEX (
+ IN VM_CONTEXT *VmPtr,
+ IN UINTN FuncAddr,
+ IN UINTN NewStackPointer,
+ IN VOID *FramePtr,
+ IN UINT8 Size
+ )
+{
+ UINTN IsThunk;
+ UINTN TargetEbcAddr;
+ UINT8 InstructionBuffer[sizeof(mInstructionBufferTemplate)];
+ UINTN Index;
+ UINTN IndexOfEbcEntrypoint;
+
+ IsThunk = 1;
+ TargetEbcAddr = 0;
+ IndexOfEbcEntrypoint = 0;
+
+ //
+ // Processor specific code to check whether the callee is a thunk to
EBC.
+ //
+ CopyMem (InstructionBuffer, (VOID *)FuncAddr,
sizeof(InstructionBuffer));
+ //
+ // Fill the signature according to mInstructionBufferTemplate
+ //
+ for (Index = 0; Index < sizeof(mInstructionBufferTemplate) -
sizeof(UINTN); Index++) {
+ if (*(UINTN *)&mInstructionBufferTemplate[Index] ==
EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&InstructionBuffer[Index] = EBC_ENTRYPOINT_SIGNATURE;
+ IndexOfEbcEntrypoint = Index;
+ }
+ if (*(UINTN *)&mInstructionBufferTemplate[Index] ==
EBC_LL_EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&InstructionBuffer[Index] =
EBC_LL_EBC_ENTRYPOINT_SIGNATURE;
+ }
+ }
+ //
+ // Check if we need thunk to native
+ //
+ if (CompareMem (InstructionBuffer, mInstructionBufferTemplate,
sizeof(mInstructionBufferTemplate)) != 0) {
+ IsThunk = 0;
+ }
+
+ if (IsThunk == 1){
+ //
+ // The callee is a thunk to EBC, adjust the stack pointer down 16
bytes and
+ // put our return address and frame pointer on the VM stack.
+ // Then set the VM's IP to new EBC code.
+ //
+ VmPtr->Gpr[0] -= 8;
+ VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], (UINTN) FramePtr);
+ VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->Gpr[0];
+ VmPtr->Gpr[0] -= 8;
+ VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], (UINT64) (UINTN)
(VmPtr->Ip + Size));
+
+ CopyMem (&TargetEbcAddr, (UINT8 *)FuncAddr + IndexOfEbcEntrypoint,
sizeof(UINTN));
+ VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
+ } else {
+ //
+ // The callee is not a thunk to EBC, call native code,
+ // and get return value.
+ //
+ VmPtr->Gpr[7] = EbcLLCALLEXNative (FuncAddr, NewStackPointer,
FramePtr);
+
+ //
+ // Advance the IP.
+ //
+ VmPtr->Ip += Size;
+ }
+}
+
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
index 15dc01c..e9a0b28 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
@@ -5,6 +5,7 @@
# platform and processor-independent mechanisms for loading and
executing EFI
# device drivers.
#
+# Copyright (c) 2015, The Linux Foundation. All rights reserved.
# Copyright (c) 2006 - 2014, Intel Corporation. All rights
reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the
BSD License
@@ -28,7 +29,7 @@ [Defines]
#
# The following information is for reference only and not required by
the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF
+# VALID_ARCHITECTURES = IA32 X64 IPF AARCH64
#
[Sources]
@@ -54,6 +55,9 @@ [Sources.IPF]
Ipf/EbcSupport.c
Ipf/EbcLowLevel.s
+[Sources.AARCH64]
+ AArch64/EbcSupport.c
+ AArch64/EbcLowLevel.S
[Packages]
MdePkg/MdePkg.dec

Thanks,
Daniil


Re: [PATCH v2 2/7] BaseTools-GenFw:Add new x86_64 Elf relocation types for PIC/PIE code

Shi, Steven <steven.shi@...>
 

On 1 August 2016 at 09:54, Shi, Steven <steven.shi@intel.com> wrote:
On 1 August 2016 at 09:19, Shi, Steven
<steven.shi@intel.com<mailto:steven.shi@intel.com>> wrote:

The fact that it works does not make it safe. Having multiple fixups
for the same symbol in the .reloc section is a problem, and so is
reapplying GOTPCRELX to places where the original instruction has
been
replaced by the linker.
[Steven]: I still don't understand why there will be multiple fixups for
the
same symbol in the .reloc section?
Remember this example

int n;
int f () { return n; }
int g () { return n; }
int h () { return n; }
If every 'return n' results in a GOTPCREL relocation, how are you
going to make sure that the GOT entry for 'n' is only fixed up a
single time?
[Steven]: the 'return n' will not result in relocation, but the 'int n' will
result
in the relocation in GOT. The three 'return n' will point to the same 'int n'
relocation item. So, we need only fixup 'int n' once, all three 'return n' will
use the correct global 'n' value.

Every 'return n' will result in a GOTPCREL relocation against n. And
your code emits a relocation for the GOT entry every time.
[Steven]: I don't think so. please give a real case and offer its source code
to prove " Every 'return n' will result in a GOTPCREL relocation against n ".
Compiling the code above using

gcc -c -O -fpic /tmp/pie.c -o pie.o

and dumping it using

readelf -r pie.o

gives me

Relocation section '.rela.text' at offset 0x250 contains 3 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000003 000a0000002a R_X86_64_REX_GOTP 0000000000000004 n -
4
00000000000d 000a0000002a R_X86_64_REX_GOTP 0000000000000004 n -
4
000000000017 000a0000002a R_X86_64_REX_GOTP 0000000000000004 n -
4
...
[Steven]: In this example, the pie.o is just the object file which is not linked. And if you link this pie.o file, the linker will solve all these three R_X86_64_REX_GOTP symbol with same 'int n' symbol address, and will create only one relocation item for 'int n' in the linked executable relocation section. So, we only need fixup once for the 'int n' in the linked executable.

Thanks
Steven


Re: [RFC 1/2] MdeModulePkg/EbcDxe: Add AARCH64 EBC VM support

Leif Lindholm <leif.lindholm@...>
 

Hi Feng,

For the record, http://opensource.org/licenses/bsd-license.php is the
same as http://opensource.org/licenses/BSD-2-Clause.

Which is mentioned explicitly under point 5 of the MdeModulePkg
Contributions.txt:
---
5. It is preferred that contributions are submitted using the same
copyright license as the base project. When that is not possible,
then contributions using the following licenses can be accepted:
* BSD (2-clause): http://opensource.org/licenses/BSD-2-Clause
* BSD (3-clause): http://opensource.org/licenses/BSD-3-Clause
* MIT: http://opensource.org/licenses/MIT
* Python-2.0: http://opensource.org/licenses/Python-2.0
* Zlib: http://opensource.org/licenses/Zlib
---

Regards,

Leif

On Mon, Aug 01, 2016 at 01:49:35AM +0000, Tian, Feng wrote:
Hi, Leif

If I understand correctly, EDKII doesn't allow such BSD license.

Correct me if anybody has different opinions.

Thanks
Feng

-----Original Message-----
From: Leif Lindholm [mailto:leif.lindholm@linaro.org]
Sent: Saturday, July 30, 2016 12:06 AM
To: edk2-devel@lists.01.org
Cc: Jeff Brasen <jbrasen@codeaurora.org>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Daniil Egranov <daniil.egranov@linaro.org>; Tian, Feng <feng.tian@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [RFC 1/2] MdeModulePkg/EbcDxe: Add AARCH64 EBC VM support

From: Jeff Brasen <jbrasen@codeaurora.org>

Adds support for the EBC VM for AARCH64 platforms

Submitted on behalf of a third-party: The Linux Foundation This contribution is licensed under the BSD license as found at http://opensource.org/licenses/bsd-license.php

[Taken from https://source.codeaurora.org/external/server/edk2-blue/]
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
.../Universal/EbcDxe/AArch64/EbcLowLevel.S | 135 +++++
MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c | 563 +++++++++++++++++++++
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf | 6 +-
3 files changed, 703 insertions(+), 1 deletion(-) create mode 100644 MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
create mode 100644 MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c

diff --git a/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
new file mode 100644
index 0000000..e858227
--- /dev/null
+++ b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcLowLevel.S
@@ -0,0 +1,135 @@
+#/** @file
+#
+# This code provides low level routines that support the Virtual Machine
+# for option ROMs.
+#
+# Copyright (c) 2015, The Linux Foundation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights
+reserved.<BR> # This program and the accompanying materials # are
+licensed and made available under the terms and conditions of the BSD
+License # which accompanies this distribution. The full text of the
+license may be found at #
+http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
+BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#**/
+
+#----------------------------------------------------------------------
+-----
+# Equate files needed.
+#----------------------------------------------------------------------
+-----
+
+ASM_GLOBAL ASM_PFX(CopyMem);
+ASM_GLOBAL ASM_PFX(EbcInterpret);
+ASM_GLOBAL ASM_PFX(ExecuteEbcImageEntryPoint);
+
+#**********************************************************************
+******
+# EbcLLCALLEX
+#
+# This function is called to execute an EBC CALLEX instruction.
+# This instruction requires that we thunk out to external native #
+code. For AArch64, we copy the VM stack into the main stack and then
+pop # the first 8 arguments off according to the AArch64 Procedure Call
+Standard # On return, we restore the stack pointer to its original location.
+#
+#**********************************************************************
+****** # UINTN EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer,
+VOID *FramePtr) ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative);
+ASM_PFX(EbcLLCALLEXNative):
+ stp x19, x20, [sp, #-16]!
+ stp x29, x30, [sp, #-16]!
+
+ mov x19, x0
+ mov x20, sp
+ sub x2, x2, x1 // Length = NewStackPointer-FramePtr
+ sub sp, sp, x2
+ sub sp, sp, #64 // Make sure there is room for at least 8 args in the new stack
+ mov x0, sp
+
+ bl CopyMem // Sp, NewStackPointer, Length
+
+ ldp x0, x1, [sp], #16
+ ldp x2, x3, [sp], #16
+ ldp x4, x5, [sp], #16
+ ldp x6, x7, [sp], #16
+
+ blr x19
+
+ mov sp, x20
+ ldp x29, x30, [sp], #16
+ ldp x19, x20, [sp], #16
+
+ ret
+
+#**********************************************************************
+******
+# EbcLLEbcInterpret
+#
+# This function is called by the thunk code to handle an Native to EBC
+call # This can handle up to 16 arguments (1-8 on in x0-x7, 9-16 are on
+the stack) # x9 contains the Entry point that will be the first
+argument when # EBCInterpret is called.
+#
+#**********************************************************************
+******
+ASM_GLOBAL ASM_PFX(EbcLLEbcInterpret);
+ASM_PFX(EbcLLEbcInterpret):
+ stp x29, x30, [sp, #-16]!
+
+ // copy the current arguments 9-16 from old location and add arg 7 to stack
+ // keeping 16 byte stack alignment
+ sub sp, sp, #80
+ str x7, [sp]
+ ldr x11, [sp, #96]
+ str x11, [sp, #8]
+ ldr x11, [sp, #104]
+ str x11, [sp, #16]
+ ldr x11, [sp, #112]
+ str x11, [sp, #24]
+ ldr x11, [sp, #120]
+ str x11, [sp, #32]
+ ldr x11, [sp, #128]
+ str x11, [sp, #40]
+ ldr x11, [sp, #136]
+ str x11, [sp, #48]
+ ldr x11, [sp, #144]
+ str x11, [sp, #56]
+ ldr x11, [sp, #152]
+ str x11, [sp, #64]
+
+ // Shift arguments and add entry point and as argument 1
+ mov x7, x6
+ mov x6, x5
+ mov x5, x4
+ mov x4, x3
+ mov x3, x2
+ mov x2, x1
+ mov x1, x0
+ mov x0, x9
+
+ # call C-code
+ bl ASM_PFX(EbcInterpret)
+ add sp, sp, #80
+
+ ldp x29, x30, [sp], #16
+
+ ret
+
+#**********************************************************************
+******
+# EbcLLExecuteEbcImageEntryPoint
+#
+# This function is called by the thunk code to handle the image entry
+point # x9 contains the Entry point that will be the first argument
+when # ExecuteEbcImageEntryPoint is called.
+#
+#**********************************************************************
+****** ASM_GLOBAL ASM_PFX(EbcLLExecuteEbcImageEntryPoint);
+ASM_PFX(EbcLLExecuteEbcImageEntryPoint):
+ stp x29, x30, [sp, #-16]!
+ # build new paramater calling convention
+ mov x2, x1
+ mov x1, x0
+ mov x0, x9
+
+ # call C-code
+ bl ASM_PFX(ExecuteEbcImageEntryPoint)
+ ldp x29, x30, [sp], #16
+ ret
diff --git a/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c
new file mode 100644
index 0000000..23261a0
--- /dev/null
+++ b/MdeModulePkg/Universal/EbcDxe/AArch64/EbcSupport.c
@@ -0,0 +1,563 @@
+/** @file
+ This module contains EBC support routines that are customized based
+on
+ the target AArch64 processor.
+
+Copyright (c) 2015, The Linux Foundation. All rights reserved.
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials are licensed and made
+available under the terms and conditions of the BSD License which
+accompanies this distribution. The full text of the license may be
+found at http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "EbcInt.h"
+#include "EbcExecute.h"
+
+//
+// Amount of space that is not used in the stack // #define
+STACK_REMAIN_SIZE (1024 * 4)
+
+//
+// This is instruction buffer used to create EBC thunk //
+#define EBC_MAGIC_SIGNATURE 0xCA112EBCCA112EBCull
+#define EBC_ENTRYPOINT_SIGNATURE 0xAFAFAFAFAFAFAFAFull
+#define EBC_LL_EBC_ENTRYPOINT_SIGNATURE 0xFAFAFAFAFAFAFAFAull
+UINT8 mInstructionBufferTemplate[] = {
+ 0x03, 0x00, 0x00, 0x14, //b pc+16
+ //
+ // Add a magic code here to help the VM recognize the thunk..
+ //
+ (UINT8)(EBC_MAGIC_SIGNATURE & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_MAGIC_SIGNATURE >> 56) & 0xFF),
+ 0x69, 0x00, 0x00, 0x58, //ldr x9, #32
+ 0x8A, 0x00, 0x00, 0x58, //ldr x10, #40
+ 0x05, 0x00, 0x00, 0x14, //b pc+32
+ (UINT8)(EBC_ENTRYPOINT_SIGNATURE & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_ENTRYPOINT_SIGNATURE >> 56) & 0xFF),
+ (UINT8)(EBC_LL_EBC_ENTRYPOINT_SIGNATURE & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 8) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 16) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 24) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 32) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 40) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 48) & 0xFF),
+ (UINT8)((EBC_LL_EBC_ENTRYPOINT_SIGNATURE >> 56) & 0xFF),
+ 0x40, 0x01, 0x1F, 0xD6 //br x10
+
+};
+
+/**
+ Begin executing an EBC image.
+ This is used for Ebc Thunk call.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcLLEbcInterpret (
+ VOID
+ );
+
+/**
+ Begin executing an EBC image.
+ This is used for Ebc image entrypoint.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcLLExecuteEbcImageEntryPoint (
+ VOID
+ );
+
+/**
+ Pushes a 64 bit unsigned value to the VM stack.
+
+ @param VmPtr The pointer to current VM context.
+ @param Arg The value to be pushed.
+
+**/
+VOID
+PushU64 (
+ IN VM_CONTEXT *VmPtr,
+ IN UINT64 Arg
+ )
+{
+ //
+ // Advance the VM stack down, and then copy the argument to the stack.
+ // Hope it's aligned.
+ //
+ VmPtr->Gpr[0] -= sizeof (UINT64);
+ *(UINT64 *) VmPtr->Gpr[0] = Arg;
+ return;
+}
+
+
+/**
+ Begin executing an EBC image.
+
+ This is a thunk function.
+
+ @param EntryPoint The entrypoint of EBC code.
+ @param Arg1 The 1st argument.
+ @param Arg2 The 2nd argument.
+ @param Arg3 The 3rd argument.
+ @param Arg4 The 4th argument.
+ @param Arg5 The 5th argument.
+ @param Arg6 The 6th argument.
+ @param Arg7 The 7th argument.
+ @param Arg8 The 8th argument.
+ @param Arg9 The 9th argument.
+ @param Arg10 The 10th argument.
+ @param Arg11 The 11th argument.
+ @param Arg12 The 12th argument.
+ @param Arg13 The 13th argument.
+ @param Arg14 The 14th argument.
+ @param Arg15 The 15th argument.
+ @param Arg16 The 16th argument.
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+EbcInterpret (
+ IN UINTN EntryPoint,
+ IN UINTN Arg1,
+ IN UINTN Arg2,
+ IN UINTN Arg3,
+ IN UINTN Arg4,
+ IN UINTN Arg5,
+ IN UINTN Arg6,
+ IN UINTN Arg7,
+ IN UINTN Arg8,
+ IN UINTN Arg9,
+ IN UINTN Arg10,
+ IN UINTN Arg11,
+ IN UINTN Arg12,
+ IN UINTN Arg13,
+ IN UINTN Arg14,
+ IN UINTN Arg15,
+ IN UINTN Arg16
+ )
+{
+ //
+ // Create a new VM context on the stack
+ //
+ VM_CONTEXT VmContext;
+ UINTN Addr;
+ EFI_STATUS Status;
+ UINTN StackIndex;
+
+ //
+ // Get the EBC entry point
+ //
+ Addr = EntryPoint;
+
+ //
+ // Now clear out our context
+ //
+ ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
+
+ //
+ // Set the VM instruction pointer to the correct location in memory.
+ //
+ VmContext.Ip = (VMIP) Addr;
+
+ //
+ // Initialize the stack pointer for the EBC. Get the current system
+ stack // pointer and adjust it down by the max needed for the interpreter.
+ //
+
+ //
+ // Adjust the VM's stack pointer down.
+ //
+
+ Status = GetEBCStack((EFI_HANDLE)(UINTN)-1, &VmContext.StackPool,
+ &StackIndex); if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ VmContext.StackTop = (UINT8*)VmContext.StackPool +
+ (STACK_REMAIN_SIZE); VmContext.Gpr[0] = (UINT64)
+ ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
+ VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
+ VmContext.Gpr[0] -= sizeof (UINTN);
+
+ //
+ // Align the stack on a natural boundary.
+ //
+ VmContext.Gpr[0] &= ~(VM_REGISTER)(sizeof (UINTN) - 1);
+
+ //
+ // Put a magic value in the stack gap, then adjust down again.
+ //
+ *(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) VM_STACK_KEY_VALUE;
+ VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
+
+ //
+ // The stack upper to LowStackTop is belong to the VM.
+ //
+ VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
+
+ //
+ // For the worst case, assume there are 4 arguments passed in
+ registers, store // them to VM's stack.
+ //
+ PushU64 (&VmContext, (UINT64) Arg16);
+ PushU64 (&VmContext, (UINT64) Arg15);
+ PushU64 (&VmContext, (UINT64) Arg14);
+ PushU64 (&VmContext, (UINT64) Arg13);
+ PushU64 (&VmContext, (UINT64) Arg12);
+ PushU64 (&VmContext, (UINT64) Arg11);
+ PushU64 (&VmContext, (UINT64) Arg10);
+ PushU64 (&VmContext, (UINT64) Arg9);
+ PushU64 (&VmContext, (UINT64) Arg8);
+ PushU64 (&VmContext, (UINT64) Arg7);
+ PushU64 (&VmContext, (UINT64) Arg6);
+ PushU64 (&VmContext, (UINT64) Arg5);
+ PushU64 (&VmContext, (UINT64) Arg4);
+ PushU64 (&VmContext, (UINT64) Arg3);
+ PushU64 (&VmContext, (UINT64) Arg2);
+ PushU64 (&VmContext, (UINT64) Arg1);
+
+ //
+ // Interpreter assumes 64-bit return address is pushed on the stack.
+ // AArch64 does not do this so pad the stack accordingly.
+ //
+ PushU64 (&VmContext, (UINT64) 0);
+ PushU64 (&VmContext, (UINT64) 0x1234567887654321ULL);
+
+ //
+ // For AArch64, this is where we say our return address is //
+ VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
+
+ //
+ // We need to keep track of where the EBC stack starts. This way, if
+ the EBC // accesses any stack variables above its initial stack
+ setting, then we know // it's accessing variables passed into it,
+ which means the data is on the // VM's stack.
+ // When we're called, on the stack (high to low) we have the
+ parameters, the // return address, then the saved ebp. Save the pointer to the return address.
+ // EBC code knows that's there, so should look above it for function parameters.
+ // The offset is the size of locals (VMContext + Addr + saved ebp).
+ // Note that the interpreter assumes there is a 16 bytes of return
+ address on // the stack too, so adjust accordingly.
+ // VmContext.HighStackBottom = (UINTN)(Addr + sizeof (VmContext) +
+ sizeof (Addr)); //
+
+ //
+ // Begin executing the EBC code
+ //
+ EbcExecute (&VmContext);
+
+ //
+ // Return the value in R[7] unless there was an error
+ //
+ ReturnEBCStack(StackIndex);
+ return (UINT64) VmContext.Gpr[7];
+}
+
+
+/**
+ Begin executing an EBC image.
+
+ @param EntryPoint The entrypoint of EBC code.
+ @param ImageHandle image handle for the EBC application we're executing
+ @param SystemTable standard system table passed into an driver's entry
+ point
+
+ @return The value returned by the EBC application we're going to run.
+
+**/
+UINT64
+EFIAPI
+ExecuteEbcImageEntryPoint (
+ IN UINTN EntryPoint,
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ //
+ // Create a new VM context on the stack
+ //
+ VM_CONTEXT VmContext;
+ UINTN Addr;
+ EFI_STATUS Status;
+ UINTN StackIndex;
+
+ //
+ // Get the EBC entry point
+ //
+ Addr = EntryPoint;
+
+ //
+ // Now clear out our context
+ //
+ ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
+
+ //
+ // Save the image handle so we can track the thunks created for this
+ image // VmContext.ImageHandle = ImageHandle; VmContext.SystemTable
+ = SystemTable;
+
+ //
+ // Set the VM instruction pointer to the correct location in memory.
+ //
+ VmContext.Ip = (VMIP) Addr;
+
+ //
+ // Initialize the stack pointer for the EBC. Get the current system
+ stack // pointer and adjust it down by the max needed for the interpreter.
+ //
+
+ Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ VmContext.StackTop = (UINT8*)VmContext.StackPool +
+ (STACK_REMAIN_SIZE); VmContext.Gpr[0] = (UINT64)
+ ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
+ VmContext.HighStackBottom = (UINTN) VmContext.Gpr[0];
+ VmContext.Gpr[0] -= sizeof (UINTN);
+
+
+ //
+ // Put a magic value in the stack gap, then adjust down again //
+ *(UINTN *) (UINTN) (VmContext.Gpr[0]) = (UINTN) VM_STACK_KEY_VALUE;
+ VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.Gpr[0];
+
+ //
+ // Align the stack on a natural boundary VmContext.Gpr[0] &=
+ ~(VM_REGISTER)(sizeof(UINTN) - 1); //
+ VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
+
+ //
+ // Simply copy the image handle and system table onto the EBC stack.
+ // Greatly simplifies things by not having to spill the args.
+ //
+ PushU64 (&VmContext, (UINT64) SystemTable);
+ PushU64 (&VmContext, (UINT64) ImageHandle);
+
+ //
+ // VM pushes 16-bytes for return address. Simulate that here.
+ //
+ PushU64 (&VmContext, (UINT64) 0);
+ PushU64 (&VmContext, (UINT64) 0x1234567887654321ULL);
+
+ //
+ // For AArch64, this is where we say our return address is //
+ VmContext.StackRetAddr = (UINT64) VmContext.Gpr[0];
+
+ //
+ // Entry function needn't access high stack context, simply // put
+ the stack pointer here.
+ //
+
+ //
+ // Begin executing the EBC code
+ //
+ EbcExecute (&VmContext);
+
+ //
+ // Return the value in R[7] unless there was an error
+ //
+ ReturnEBCStack(StackIndex);
+ return (UINT64) VmContext.Gpr[7];
+}
+
+
+/**
+ Create thunks for an EBC image entry point, or an EBC protocol service.
+
+ @param ImageHandle Image handle for the EBC image. If not null, then
+ we're creating a thunk for an image entry point.
+ @param EbcEntryPoint Address of the EBC code that the thunk is to call
+ @param Thunk Returned thunk we create here
+ @param Flags Flags indicating options for creating the thunk
+
+ @retval EFI_SUCCESS The thunk was created successfully.
+ @retval EFI_INVALID_PARAMETER The parameter of EbcEntryPoint is not 16-bit
+ aligned.
+ @retval EFI_OUT_OF_RESOURCES There is not enough memory to created the EBC
+ Thunk.
+ @retval EFI_BUFFER_TOO_SMALL EBC_THUNK_SIZE is not larger enough.
+
+**/
+EFI_STATUS
+EbcCreateThunks (
+ IN EFI_HANDLE ImageHandle,
+ IN VOID *EbcEntryPoint,
+ OUT VOID **Thunk,
+ IN UINT32 Flags
+ )
+{
+ UINT8 *Ptr;
+ UINT8 *ThunkBase;
+ UINT32 Index;
+ INT32 ThunkSize;
+
+ //
+ // Check alignment of pointer to EBC code // if ((UINT32) (UINTN)
+ EbcEntryPoint & 0x01) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ThunkSize = sizeof(mInstructionBufferTemplate);
+
+ Ptr = AllocatePool (sizeof(mInstructionBufferTemplate));
+
+ if (Ptr == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Print(L"Allocate TH: 0x%X\n", (UINT32)Ptr); // // Save the
+ start address so we can add a pointer to it to a list later.
+ //
+ ThunkBase = Ptr;
+
+ //
+ // Give them the address of our buffer we're going to fix up //
+ *Thunk = (VOID *) Ptr;
+
+ //
+ // Copy whole thunk instruction buffer template // CopyMem (Ptr,
+ mInstructionBufferTemplate, sizeof(mInstructionBufferTemplate));
+
+ //
+ // Patch EbcEntryPoint and EbcLLEbcInterpret // for (Index = 0;
+ Index < sizeof(mInstructionBufferTemplate) - sizeof(UINTN); Index++) {
+ if (*(UINTN *)&Ptr[Index] == EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcEntryPoint;
+ }
+ if (*(UINTN *)&Ptr[Index] == EBC_LL_EBC_ENTRYPOINT_SIGNATURE) {
+ if ((Flags & FLAG_THUNK_ENTRY_POINT) != 0) {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcLLExecuteEbcImageEntryPoint;
+ } else {
+ *(UINTN *)&Ptr[Index] = (UINTN)EbcLLEbcInterpret;
+ }
+ }
+ }
+
+ //
+ // Add the thunk to the list for this image. Do this last since the
+ add // function flushes the cache for us.
+ //
+ EbcAddImageThunk (ImageHandle, (VOID *) ThunkBase, ThunkSize);
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ This function is called to execute an EBC CALLEX instruction.
+ The function check the callee's content to see whether it is common
+native
+ code or a thunk to another piece of EBC code.
+ If the callee is common native code, use EbcLLCAllEXASM to
+manipulate,
+ otherwise, set the VM->IP to target EBC code directly to avoid
+another VM
+ be startup which cost time and stack space.
+
+ @param VmPtr Pointer to a VM context.
+ @param FuncAddr Callee's address
+ @param NewStackPointer New stack pointer after the call
+ @param FramePtr New frame pointer after the call
+ @param Size The size of call instruction
+
+**/
+VOID
+EbcLLCALLEX (
+ IN VM_CONTEXT *VmPtr,
+ IN UINTN FuncAddr,
+ IN UINTN NewStackPointer,
+ IN VOID *FramePtr,
+ IN UINT8 Size
+ )
+{
+ UINTN IsThunk;
+ UINTN TargetEbcAddr;
+ UINT8 InstructionBuffer[sizeof(mInstructionBufferTemplate)];
+ UINTN Index;
+ UINTN IndexOfEbcEntrypoint;
+
+ IsThunk = 1;
+ TargetEbcAddr = 0;
+ IndexOfEbcEntrypoint = 0;
+
+ //
+ // Processor specific code to check whether the callee is a thunk to EBC.
+ //
+ CopyMem (InstructionBuffer, (VOID *)FuncAddr,
+ sizeof(InstructionBuffer)); // // Fill the signature according to
+ mInstructionBufferTemplate // for (Index = 0; Index <
+ sizeof(mInstructionBufferTemplate) - sizeof(UINTN); Index++) {
+ if (*(UINTN *)&mInstructionBufferTemplate[Index] == EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&InstructionBuffer[Index] = EBC_ENTRYPOINT_SIGNATURE;
+ IndexOfEbcEntrypoint = Index;
+ }
+ if (*(UINTN *)&mInstructionBufferTemplate[Index] == EBC_LL_EBC_ENTRYPOINT_SIGNATURE) {
+ *(UINTN *)&InstructionBuffer[Index] = EBC_LL_EBC_ENTRYPOINT_SIGNATURE;
+ }
+ }
+ //
+ // Check if we need thunk to native
+ //
+ if (CompareMem (InstructionBuffer, mInstructionBufferTemplate, sizeof(mInstructionBufferTemplate)) != 0) {
+ IsThunk = 0;
+ }
+
+ if (IsThunk == 1){
+ //
+ // The callee is a thunk to EBC, adjust the stack pointer down 16 bytes and
+ // put our return address and frame pointer on the VM stack.
+ // Then set the VM's IP to new EBC code.
+ //
+ VmPtr->Gpr[0] -= 8;
+ VmWriteMemN (VmPtr, (UINTN) VmPtr->Gpr[0], (UINTN) FramePtr);
+ VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->Gpr[0];
+ VmPtr->Gpr[0] -= 8;
+ VmWriteMem64 (VmPtr, (UINTN) VmPtr->Gpr[0], (UINT64) (UINTN)
+ (VmPtr->Ip + Size));
+
+ CopyMem (&TargetEbcAddr, (UINT8 *)FuncAddr + IndexOfEbcEntrypoint, sizeof(UINTN));
+ VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr; } else {
+ //
+ // The callee is not a thunk to EBC, call native code,
+ // and get return value.
+ //
+ VmPtr->Gpr[7] = EbcLLCALLEXNative (FuncAddr, NewStackPointer,
+ FramePtr);
+
+ //
+ // Advance the IP.
+ //
+ VmPtr->Ip += Size;
+ }
+}
+
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
index 15dc01c..e9a0b28 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
@@ -5,6 +5,7 @@
# platform and processor-independent mechanisms for loading and executing EFI # device drivers.
#
+# Copyright (c) 2015, The Linux Foundation. All rights reserved.
# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -28,7 +29,7 @@ [Defines] # # The following information is for reference only and not required by the build tools.
#
-# VALID_ARCHITECTURES = IA32 X64 IPF
+# VALID_ARCHITECTURES = IA32 X64 IPF AARCH64
#

[Sources]
@@ -54,6 +55,9 @@ [Sources.IPF]
Ipf/EbcSupport.c
Ipf/EbcLowLevel.s

+[Sources.AARCH64]
+ AArch64/EbcSupport.c
+ AArch64/EbcLowLevel.S

[Packages]
MdePkg/MdePkg.dec
--
2.1.4


Re: [PATCH] add top-level .gitattributes file, dealing with .depex

Leif Lindholm <leif.lindholm@...>
 

On Mon, Aug 01, 2016 at 12:03:06AM -0700, Jordan Justen wrote:
On 2016-07-31 16:52:23, Kinney, Michael D wrote:
Jordan,

UEFI Drivers distributed as binaries do not need depex sections.

PI modules distributed as binaries do require a .depex binary.
They may require a depex, but, as mentioned below, they can also add
it directly in the .fdf. As it stands, apparently we have 1 .depex
file in the tree, and it is unused.

Aside from this, under what conditions would we take such binaries
into the EDK II tree? Today we have the ShellPkg and FatPkg binaries
in the EDK II tree, but we recently discussed removing even those.
While I don't disagree, the PI dependency expression instruction set
(section 10.7, PI spec 1.4 vol2) does not look Turing complete to me.
Meaning it's "binary" in much the same way a .uni file is.

(This is historically where someone pulls out an operating system
kernel written entirely in PI depex binary.)

For an open source project, I think it is best to not have pre-built
binaries, unless there is some very compelling reason. Previously
there was some license funniness on FatPkg, but now that is gone. If
it took an hour to build FatPkg, then that might also be something to
discuss. :)

I don't think adding the .gitattributes is really a problem, aside
from the fact that it implies that we might actually have a reason to
add a .depex file to the source tree.
And I agree it would send that signal.

Regards,

Leif

-Jordan

So I would recommend .depex binary files be treated the same as
binary .efi files by GIT. So it does sound like we need some
minor updates to GIT attributes.

If we have an example of a binary module that is providing more
binary leaf sections than are actually required and/or used, then
yes, the binary module should be cleaned up to remove the unused
content.

Thanks,

Mike

-----Original Message-----
From: Justen, Jordan L
Sent: Sunday, July 31, 2016 3:58 PM
To: Leif Lindholm <leif.lindholm@linaro.org>; Tim Lewis <tim.lewis@insyde.com>
Cc: Laszlo Ersek <lersek@redhat.com>; Kinney, Michael D <michael.d.kinney@intel.com>;
edk2-devel@ml01.01.org <edk2-devel@lists.01.org>; Andrew Fish <afish@apple.com>
Subject: Re: [edk2] [PATCH] add top-level .gitattributes file, dealing with .depex

On 2016-07-30 11:33:43, Leif Lindholm wrote:
Hi Tim,

Thanks for the warning, and investigation.

Does this mean that you think we should ban the inclusion of .depex
files in EDK2, including future platform trees?
I don't know about banning it, but at least we could wait for someone
to make a reasonable argument why they are needed.

Even for binary only modules, it looks like the fdf method outlined
below is preferable to a pre-built .depex.

If (at a future point) the reason for using a .depex is to support a
binary only module in a supposedly open platform under EDK II, then I
guess we can decide if that is a good idea at that point.

Should we delete this one unused .depex from the tree?

-Jordan

(If not, this patch is
still needed for git to work predictably with these files.)

Regards,

Leif

On Fri, Jul 29, 2016 at 05:12:49PM +0000, Tim Lewis wrote:
It appears that this file is not actually used. It is only
referenced in the [Rule.Common.UEFI_DRIVER.NATIVE_BINARY] rule in
PlatformPkg.fdf. A little further research shows that an alternate
method was used for the actual GOP binary (see below). A grep of the
entire tree shows that no one uses this rule NATIVE_BINARY. So it
looks like it can just be cut out.

BTW, the downside of the method used for the binary version of the
GOP driver, is that those drivers cannot use PCDs, since the PCD
database is created based on references in the .inf. GOP works
because it is pure UEFI and (therefore) doesn't use PCDs.

Tim

FILE DRIVER = FF0C8745-3270-4439-B74F-3E45F8C77064 {
SECTION DXE_DEPEX_EXP = {gPlatformGOPPolicyGuid}
SECTION PE32 =
Vlv2MiscBinariesPkg/GOP/7.2.1011/RELEASE_VS2008x86/$(DXE_ARCHITECTURE)/IntelGopDriver.e
fi
SECTION UI = "IntelGopDriver"
}

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Leif
Lindholm
Sent: Friday, July 29, 2016 9:45 AM
To: Laszlo Ersek <lersek@redhat.com>
Cc: michael.d.kinney@intel.com; Jordan Justen <jordan.l.justen@intel.com>; edk2-
devel@ml01.01.org; Andrew Fish <afish@apple.com>
Subject: Re: [edk2] [PATCH] add top-level .gitattributes file, dealing with .depex

On Thu, Jul 07, 2016 at 05:03:13PM +0200, Laszlo Ersek wrote:
On 07/07/16 16:24, Leif Lindholm wrote:
Git tends to see .depex files as text, causing hideous patches being
generated (and breaking PatchCheck.py).

Add a .gitattributes file instructing git to treat them as binary.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
.gitattributes | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .gitattributes

diff --git a/.gitattributes b/.gitattributes new file mode 100644
index 0000000..2d8a45b
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.depex binary
What generates .depex files? I've never seen any.

Also, unless you add .depex files with "git add" to the set of tracked
files, no patches / diffs should cover them. What am I missing? :)

... Hm, after

$ find . -iname "*.depex"

I see .depex files in Build/ (which should be ignored altogether), and

./Vlv2TbltDevicePkg/IntelGopDepex/IntelGopDriver.depex

Why does that file exist in the tree? Let me see... git log says nothing relevant
(the file dates back to commit 3cbfba02fef9, "Upload BSD-licensed Vlv2TbltDevicePkg and
Vlv2DeviceRefCodePkg to").

Grepping the tree for the filename itself leads to:

Vlv2TbltDevicePkg/PlatformPkg.fdf: DXE_DEPEX DXE_DEPEX Optional
$(WORKSPACE)/$(PLATFORM_PACKAGE)/IntelGopDepex/IntelGopDriver.depex
Vlv2TbltDevicePkg/PlatformPkgGcc.fdf: DXE_DEPEX DXE_DEPEX Optional
$(WORKSPACE)/$(PLATFORM_PACKAGE)/IntelGopDepex/IntelGopDriver.depex

Do these rules exist to override the DEPEX sections of binary-only modules? If
so: that's horrible.

Anyway, given that edk2 contains at least one .depex file, and your patch is
correct according to <https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes>:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thanks!

I had hoped for comments from someone else on cc, since we don't have any
Maintainers.txt entry for the top level directory :)

But if I don't hear anything before Monday, I'll push it then.

Regards,

Leif

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[PATCH v5 8/8] BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode

Ard Biesheuvel
 

This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and
AARCH64. Due to the fact that the GCC project switched to a new
numbering scheme where the first digit is now incremented for every
major release, the new toolchain is simply called 'GCC5', and is
intended to support all GCC v5.x releases.

Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG
and RELEASE builds, LTO support is equally enabled for both targets.
On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO
optimizations are only enabled for RELEASE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
---
BaseTools/Conf/tools_def.template | 164 ++++++++++++++++++++
1 file changed, 164 insertions(+)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 10ac21e42c8f..314adaf6bfa8 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -197,6 +197,9 @@ DEFINE GCC48_X64_PREFIX = ENV(GCC48_BIN)
DEFINE GCC49_IA32_PREFIX = ENV(GCC49_BIN)
DEFINE GCC49_X64_PREFIX = ENV(GCC49_BIN)

+DEFINE GCC5_IA32_PREFIX = ENV(GCC5_BIN)
+DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN)
+
DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl
DEFINE WIN_ASL_BIN_DIR = C:\ASL
DEFINE WIN_IASL_BIN = DEF(WIN_ASL_BIN_DIR)\iasl.exe
@@ -366,6 +369,12 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G
# Required to build platforms or ACPI tables:
# Intel(r) ACPI Compiler from
# https://acpica.org/downloads
+# GCC5 -Linux,Windows- Requires:
+# GCC 5 with LTO support, targeting x86_64-linux-gnu, aarch64-linux-gnu, or arm-linux-gnueabi
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
# CLANG35 -Linux,Windows- Requires:
# Clang v3.5 or later, and GNU binutils targeting aarch64-linux-gnu or arm-linux-gnueabi
# Optional:
@@ -4452,6 +4461,27 @@ DEFINE GCC49_AARCH64_DLINK2_FLAGS = DEF(GCC48_AARCH64_DLINK2_FLAGS)
DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS)
DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)

+DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -flto -fno-builtin
+DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto -fno-builtin
+DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON)
+DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS)
+DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -flto
+DEFINE GCC5_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS)
+DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) -flto
+DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
+DEFINE GCC5_ASM_FLAGS = DEF(GCC49_ASM_FLAGS)
+DEFINE GCC5_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS)
+DEFINE GCC5_AARCH64_ASM_FLAGS = DEF(GCC49_AARCH64_ASM_FLAGS)
+DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS)
+DEFINE GCC5_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS)
+DEFINE GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS)
+DEFINE GCC5_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS) -flto
+DEFINE GCC5_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS)
+DEFINE GCC5_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) -flto
+DEFINE GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC49_AARCH64_DLINK2_FLAGS)
+DEFINE GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC49_ARM_ASLDLINK_FLAGS)
+DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS)
+
####################################################################################
#
# Unix GCC And Intel Linux ACPI Compiler
@@ -5186,6 +5216,140 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS)

####################################################################################
#
+# GCC 5 - This configuration is used to compile under Linux to produce
+# PE/COFF binaries using GCC 5
+#
+####################################################################################
+*_GCC5_*_*_FAMILY = GCC
+
+*_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)make
+*_GCC5_*_*_DLL = ENV(GCC5_DLL)
+*_GCC5_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_GCC5_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
+*_GCC5_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_GCC5_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
+*_GCC5_*_APP_FLAGS =
+*_GCC5_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_GCC5_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+
+##################
+# GCC5 IA32 definitions
+##################
+*_GCC5_IA32_OBJCOPY_PATH = DEF(GCC5_IA32_PREFIX)objcopy
+*_GCC5_IA32_CC_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_SLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc-ar
+*_GCC5_IA32_DLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLDLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASM_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_PP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_VFRPP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLCC_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLPP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_RC_PATH = DEF(GCC5_IA32_PREFIX)objcopy
+
+*_GCC5_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto
+*_GCC5_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
+*_GCC5_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386
+*_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os -Wl,-m,elf_i386,--oformat=elf32-i386
+*_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS)
+*_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+*_GCC5_IA32_OBJCOPY_FLAGS =
+*_GCC5_IA32_NASM_FLAGS = -f elf32
+
+ DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os
+RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable
+
+##################
+# GCC5 X64 definitions
+##################
+*_GCC5_X64_OBJCOPY_PATH = DEF(GCC5_X64_PREFIX)objcopy
+*_GCC5_X64_CC_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_SLINK_PATH = DEF(GCC5_X64_PREFIX)gcc-ar
+*_GCC5_X64_DLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLDLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASM_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_PP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_VFRPP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLCC_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLPP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_RC_PATH = DEF(GCC5_X64_PREFIX)objcopy
+
+*_GCC5_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto
+*_GCC5_X64_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
+*_GCC5_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64
+*_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os
+*_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS)
+*_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+*_GCC5_X64_OBJCOPY_FLAGS =
+*_GCC5_X64_NASM_FLAGS = -f elf64
+
+ DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS)
+RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-variable
+
+##################
+# GCC5 ARM definitions
+##################
+*_GCC5_ARM_CC_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_SLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc-ar
+*_GCC5_ARM_DLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLDLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASM_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_PP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_VFRPP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLCC_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLPP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_RC_PATH = ENV(GCC5_ARM_PREFIX)objcopy
+
+*_GCC5_ARM_ARCHCC_FLAGS = -mthumb
+*_GCC5_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto
+*_GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC5_ARM_ASLDLINK_FLAGS)
+*_GCC5_ARM_ASM_FLAGS = DEF(GCC5_ARM_ASM_FLAGS)
+*_GCC5_ARM_DLINK2_FLAGS = DEF(GCC5_ARM_DLINK2_FLAGS)
+*_GCC5_ARM_PLATFORM_FLAGS = -march=armv7-a
+*_GCC5_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC5_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
+*_GCC5_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+
+ DEBUG_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0
+RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable
+
+ DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS)
+RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+
+##################
+# GCC5 AARCH64 definitions
+##################
+*_GCC5_AARCH64_CC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_SLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc-ar
+*_GCC5_AARCH64_DLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLDLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASM_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_PP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_VFRPP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLCC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLPP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_RC_PATH = ENV(GCC5_AARCH64_PREFIX)objcopy
+
+*_GCC5_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto
+*_GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC5_AARCH64_ASLDLINK_FLAGS)
+*_GCC5_AARCH64_ASM_FLAGS = DEF(GCC5_AARCH64_ASM_FLAGS)
+*_GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC5_AARCH64_DLINK2_FLAGS)
+*_GCC5_AARCH64_PLATFORM_FLAGS =
+*_GCC5_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC5_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
+*_GCC5_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC5_AARCH64_CC_XIPFLAGS)
+
+ DEBUG_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -O0 -mcmodel=small
+ DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+
+RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -mcmodel=tiny
+RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
+
+####################################################################################
+#
# CLANG35 - This configuration is used to compile under Linux to produce
# PE/COFF binaries using the clang compiler and assembler (v3.5 and up)
# and GNU linker
--
2.7.4


[PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points

Ard Biesheuvel
 

When building with LTO enabled, the LTO routines infer from the 'hidden'
visibility of the _ModuleEntryPoint symbol that its code only needs to be
retained if it is referenced internally, and disregards the fact that
it is referenced by the entry point field in the ELF metadata.

This is arguably a bug in LTO, but we can work around it by ensuring that
the _ModuleEntryPoint symbol is emitted with protected visibility instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
MdePkg/Include/X64/ProcessorBind.h | 9 ++++++++-
MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 2 ++
MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 2 ++
MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf | 2 ++
MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf | 2 ++
MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf | 2 ++
6 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h
index 666cc8e8bd16..e45b9cba2bb3 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -29,13 +29,20 @@

#if defined(__GNUC__) && defined(__pic__)
//
-// Mark all symbol declarations and references as hidden, meaning they will
+// Mark all symbol declarations and references as hidden*, meaning they will
// not be subject to symbol preemption. This allows the compiler to refer to
// symbols directly using relative references rather than via the GOT, which
// contains absolute symbol addresses that are subject to runtime relocation.
//
+// * Under LTO, the entry point of a module must have protected or default
+// visibility to prevent it from being pruned.
+//
+#ifdef GCC_VISIBILITY_PROTECTED
+#pragma GCC visibility push (protected)
+#else
#pragma GCC visibility push (hidden)
#endif
+#endif

#if defined(__INTEL_COMPILER)
//
diff --git a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
index 01f64c34c7a1..2d6f87ed062e 100644
--- a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+++ b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
@@ -39,3 +39,5 @@ [LibraryClasses]
BaseLib
DebugLib

+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
diff --git a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
index d920306713c5..4e61783b3bd5 100644
--- a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
+++ b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
@@ -37,3 +37,5 @@ [LibraryClasses]
BaseLib
DebugLib

+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
diff --git a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
index a2db9e058bbe..adfd91bdc57e 100644
--- a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+++ b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
@@ -37,3 +37,5 @@ [Packages]
[LibraryClasses]
DebugLib

+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
diff --git a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
index be92b3dc0760..9525c55c2051 100644
--- a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+++ b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
@@ -38,3 +38,5 @@ [LibraryClasses]
DebugLib
BaseLib

+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
diff --git a/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf b/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
index 7a9dcbcd4df2..8d30b1197850 100644
--- a/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+++ b/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
@@ -65,3 +65,5 @@ [Depex.common.UEFI_DRIVER]
gEfiVariableArchProtocolGuid AND
gEfiWatchdogTimerArchProtocolGuid

+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
--
2.7.4


[PATCH v5 6/8] BaseTools GCC: drop GNU notes section from EFI image

Ard Biesheuvel
 

Recent versions of GNU ld automatically emit a .notes section into
the ELF binary containing a build id. Since this is an allocatable
section by default, it will be identified by GenFw as a section
that requires PE/COFF conversion, which may cause sections to be
moved around unexpectedly.

So retain the section, but tag it as INFO, which tells the linker
that it should not be accounted for in the binary's memory layout.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---
BaseTools/Scripts/GccBase.lds | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds
index 7e4cdde9bfea..281af8a9bd33 100644
--- a/BaseTools/Scripts/GccBase.lds
+++ b/BaseTools/Scripts/GccBase.lds
@@ -62,6 +62,12 @@ SECTIONS {
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)
--
2.7.4


[PATCH v5 5/8] ArmPkg: add prebuilt glue binaries for GCC5 LTO support

Ard Biesheuvel
 

GCC in LTO mode interoperates poorly with non-standard libraries that
provide implementations of compiler intrinsics such as memcpy/memset
or the stack protector entry points. Such libraries need to be built
in non-LTO mode, and then referenced explicitly on the linker command
line using a -plugin-opt=-pass-through=-lxxx linker option.

However, if these intrinsics are also referenced directly, the LTO
version of the code will be pulled in, and will happily satisfy all
other references to the same symbol.

So add a pair of glue libraries, for ARM and AARCH64, that reference
the known intrinsics. Since the binaries live under ArmPkg directly,
we can reference them in tools_def.txt. Under LD garbage collection,
the object itself will be pruned, and so will the intrinsics that end
up unused by the module.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---
ArmPkg/Library/GccLto/liblto-aarch64.a | Bin 0 -> 1016 bytes
ArmPkg/Library/GccLto/liblto-aarch64.s | 27 +++++++++
ArmPkg/Library/GccLto/liblto-arm.a | Bin 0 -> 2096 bytes
ArmPkg/Library/GccLto/liblto-arm.s | 61 ++++++++++++++++++++
4 files changed, 88 insertions(+)

diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.a b/ArmPkg/Library/GccLto/liblto-aarch64.a
new file mode 100644
index 0000000000000000000000000000000000000000..2ab00238f0dad882abf08a1fb9623c9cdea9f17b
GIT binary patch
literal 1016
zcmbu7&rZTX5XPqz6oLo!M8btcV>pmaJb3R#Pab@Ovb0qUG$GwJk&}<*)yMErJh~su
zhGA(FBh#ci^V@G{X8(NLKR&dgh`dGgNxR5Xq8|a14Nj;_ot@whUR;}*D0W|+#ne8)
z+crcqtbp?TKuy$d;Fk^js)5sWPGwPMt2G8wSV~i4b+$;e`67MRugg8~@}{d?w$pJf
z%hU2Z13wYMF8ko8f}aWQH5;VNy0m&m%Ghc<&b?O^ORa42Zb{|ZYEm;}M9QPwkz0*h
zki8>ef}gYSE})e*bOFvFk<j^57EYNXKak(^fcXvc@Z~)5d^m*lCr*Hz|6PAkvlcbK
oxX>*EVPSp5Eivz1-~TrQyaBwMaQ{8W!rrlD%!Td{2n*}~0;u;a`v3p{

literal 0
HcmV?d00001

diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.s b/ArmPkg/Library/GccLto/liblto-aarch64.s
new file mode 100644
index 000000000000..45000d327758
--- /dev/null
+++ b/ArmPkg/Library/GccLto/liblto-aarch64.s
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
+//
+// This program and the accompanying materials are licensed and made available under
+// the terms and conditions of the BSD License that accompanies this distribution.
+// The full text of the license may be found at
+// http://opensource.org/licenses/bsd-license.php.
+//
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+//
+
+//
+// GCC in LTO mode interoperates poorly with non-standard libraries that
+// provide implementations of compiler intrinsics such as memcpy/memset
+// or the stack protector entry points.
+//
+// By referencing these functions from a non-LTO object that can be passed
+// to the linker via the -plugin-opt=-pass-through=-lxxx options, the
+// intrinsics are included in the link in a way that allows them to be
+// pruned again if no other references to them exist.
+//
+
+ .long memcpy - .
+ .long memset - .
+ .long __stack_chk_fail - .
+ .long __stack_chk_guard - .
diff --git a/ArmPkg/Library/GccLto/liblto-arm.a b/ArmPkg/Library/GccLto/liblto-arm.a
new file mode 100644
index 0000000000000000000000000000000000000000..d811c09573a35ea87a8002ecf01be18e1c6e7fd3
GIT binary patch
literal 2096
zcmd6o%WKq76vn?XQ*C|Js#WW|YOD1@u(oJH7cHm=wjd(Xg%C3{sS}#eGD-SEunQLz
zT?o1mx)E36&V>ti;!4n^e}Mi6u3h<^n@J{fT<Fp}Ouq9w_nvbfNlqSKoxD~mm5{X(
zhR`D5^G4ItF=}K8T}U0-`2R^Kc5yYX=T>}_x@dNmx{6!*W2si#P63O*VzW?IBihqh
z=)ig*pojKb#bw326`xc*toV}R>x!op&nRA0ysG%I;^&HAD}JZ=gW^w$zbO8u_=n=3
zihn6C7jA)^cemm`#e<4%#TOM%D88Zij$&7Fpm;^`6UFO_-zdgF4UQAVZgtkF)@Pj=
z*ALnp_Y=1vL)@s|sQDwQ6*Mh*7aYIlFNiybaLxo6PTG16rQHlllhBAv-k>#u2@Sol
zI=`G}CPrQiN;tRR(ak(*AdNItn6xb{AamTrttlr6972!~lYGJ?&mg`uh4`8leFjDu
zR1H=l|GXG+(@3h}e9gF`ML(|A$Jm)#Ny{9*kb6fYIz6K#U~GZXiE;<`AQQJZh#Ex*
zvPafpsg(EM+QeEU%F9+!7AJXjt<6BM=oX+)l${4fw*md4-N1n8cCac_8FW^32XIbw
zCm?m%V%-}PWwOhnEHdMwdw?sVdjY8%7AKh$-3Qzh-4EOrJpf1@u{il%(L=yJ(ZfJZ
z^axNF?FRzUqrklAF(4K_4lIdsu@6KCfmP8Hz#~x>xiwL4;;HB<;F;)Y;DzWJUhHT&
zjNJ+~ZlqeztcDlZv9}b%uDP)byAnmP`PA5M95?(*5_=I7{9EHzOij<eVx#1jh0yHv
z<B{-Nm!6|^Pj~Rl*~wdJ;>*-d{<&4d*_Y!hx!AINvPBvHw{hmarpIg2NWNZUrI#!p
wAAvlV^sI41<6<;hHcoUy=A?e-|05l;7C8giM-Tt9*KBPx@rv+1OG3`f-+dwCzyJUM

literal 0
HcmV?d00001

diff --git a/ArmPkg/Library/GccLto/liblto-arm.s b/ArmPkg/Library/GccLto/liblto-arm.s
new file mode 100644
index 000000000000..bc16320a46c0
--- /dev/null
+++ b/ArmPkg/Library/GccLto/liblto-arm.s
@@ -0,0 +1,61 @@
+//
+// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
+//
+// This program and the accompanying materials are licensed and made available under
+// the terms and conditions of the BSD License that accompanies this distribution.
+// The full text of the license may be found at
+// http://opensource.org/licenses/bsd-license.php.
+//
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+//
+
+//
+// GCC in LTO mode interoperates poorly with non-standard libraries that
+// provide implementations of compiler intrinsics such as memcpy/memset
+// or the stack protector entry points.
+//
+// By referencing these functions from a non-LTO object that can be passed
+// to the linker via the -plugin-opt=-pass-through=-lxxx options, the
+// intrinsics are included in the link in a way that allows them to be
+// pruned again if no other references to them exist.
+//
+
+ .long memcpy - .
+ .long memset - .
+ .long __stack_chk_fail - .
+ .long __stack_chk_guard - .
+ .long __ashrdi3 - .
+ .long __ashldi3 - .
+ .long __aeabi_idiv - .
+ .long __aeabi_idivmod - .
+ .long __aeabi_uidiv - .
+ .long __aeabi_uidivmod - .
+ .long __divdi3 - .
+ .long __divsi3 - .
+ .long __lshrdi3 - .
+ .long __aeabi_memcpy - .
+ .long __aeabi_memset - .
+ .long memmove - .
+ .long __modsi3 - .
+ .long __moddi3 - .
+ .long __muldi3 - .
+ .long __aeabi_lmul - .
+ .long __ARM_ll_mullu - .
+ .long __udivsi3 - .
+ .long __umodsi3 - .
+ .long __udivdi3 - .
+ .long __umoddi3 - .
+ .long __udivmoddi4 - .
+ .long __clzsi2 - .
+ .long __ctzsi2 - .
+ .long __ucmpdi2 - .
+ .long __switch8 - .
+ .long __switchu8 - .
+ .long __switch16 - .
+ .long __switch32 - .
+ .long __aeabi_ulcmp - .
+ .long __aeabi_uldivmod - .
+ .long __aeabi_ldivmod - .
+ .long __aeabi_llsr - .
+ .long __aeabi_llsl - .
--
2.7.4


[PATCH v5 4/8] BaseTools GCC: use 'gcc' as the linker command for GCC44 and later

Ard Biesheuvel
 

To accommodate upcoming GCCx toolchain versions that require 'gcc' to
be used as the linker in order to support LTO, switch GCC44 and later
(including CLANG35) to a new DLINK build rule that invokes 'gcc' as the
linker instead of 'ld'. Since gcc expects its command line arguments in
a different format, and expects arguments that it needs to pass to the
linker to be prefixed with '-Wl,', this involves changes to most of the
DLINK_FLAGS definitions in tools_def.template, as well as some changes to
module .INF files that set their own linker options.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
---
ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 2 +-
BaseTools/Conf/build_rule.template | 11 +-
BaseTools/Conf/tools_def.template | 170 ++++++++++----------
EmulatorPkg/Unix/Host/Host.inf | 6 +-
4 files changed, 97 insertions(+), 92 deletions(-)

diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
index a4ea5a05b652..5e706934f69f 100755
--- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
+++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
@@ -107,4 +107,4 @@ [Pcd]
gArmTokenSpaceGuid.PcdFvBaseAddress

[BuildOptions]
- GCC:*_*_*_DLINK_FLAGS = -pie -T $(MODULE_DIR)/Scripts/PrePi-PIE.lds
+ GCC:*_*_*_DLINK_FLAGS = -pie -Wl,-T,$(MODULE_DIR)/Scripts/PrePi-PIE.lds
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index 3fea4f456118..eb4ae749fda5 100644
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -291,7 +291,11 @@
<Command.MSFT, Command.INTEL>
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

- <Command.GCC, Command.GCCLD>
+ <Command.GCC>
+ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)
+ "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
+
+ <Command.GCCLD>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}

@@ -319,7 +323,10 @@
<Command.MSFT, Command.INTEL>
"$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

- <Command.GCC, Command.GCCLD>
+ <Command.GCC>
+ "$(DLINK)" $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)
+
+ <Command.GCCLD>
"$(DLINK)" $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)

<Command.RVCT>
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 8a04e38e1288..10ac21e42c8f 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4329,14 +4329,14 @@ DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi
DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
-DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
+DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
-DEFINE GCC_ARM_AARCH64_DLINK_COMMON= --emit-relocs -nostdlib --gc-sections -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20
DEFINE GCC_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20
DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
-DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) --entry ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
-DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) --entry ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC_IPF_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll -static --entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC_IPF_OBJCOPY_FLAGS = -I elf64-ia64-little -O efi-bsdrv-ia64
@@ -4356,12 +4356,12 @@ DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B aarch64
DEFINE GCC44_ALL_CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -c -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC44_IA32_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables
DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -Os -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables
-DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections -z common-page-size=0x20
-DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry ReferenceAcpiTable -u ReferenceAcpiTable
-DEFINE GCC44_IA32_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
-DEFINE GCC44_IA32_DLINK2_FLAGS = --defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
-DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -melf_x86_64 --oformat=elf64-x86-64
-DEFINE GCC44_X64_DLINK2_FLAGS = --defsym=PECOFF_HEADER_SIZE=0x228 DEF(GCC_DLINK2_FLAGS_COMMON)
+DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
+DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC44_IA32_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC44_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
+DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=elf64-x86-64
+DEFINE GCC44_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF(GCC_DLINK2_FLAGS_COMMON)
DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)

DEFINE GCC45_IA32_CC_FLAGS = DEF(GCC44_IA32_CC_FLAGS)
@@ -4385,9 +4385,9 @@ DEFINE GCC46_X64_DLINK2_FLAGS = DEF(GCC45_X64_DLINK2_FLAGS)
DEFINE GCC46_ASM_FLAGS = DEF(GCC45_ASM_FLAGS)
DEFINE GCC46_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations -save-temps
-DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) --oformat=elf32-littlearm
-DEFINE GCC46_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
-DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) --oformat=elf32-littlearm
+DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--oformat=elf32-littlearm
+DEFINE GCC46_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
+DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) -Wl,--oformat=elf32-littlearm

DEFINE GCC47_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS)
DEFINE GCC47_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS)
@@ -4406,7 +4406,7 @@ DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
DEFINE GCC47_ARM_DLINK2_FLAGS = DEF(GCC46_ARM_DLINK2_FLAGS)
DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
-DEFINE GCC47_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x228
+DEFINE GCC47_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
DEFINE GCC47_ARM_ASLDLINK_FLAGS = DEF(GCC46_ARM_ASLDLINK_FLAGS)
DEFINE GCC47_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_ASLDLINK_FLAGS)

@@ -4433,11 +4433,11 @@ DEFINE GCC48_AARCH64_ASLDLINK_FLAGS = DEF(GCC47_AARCH64_ASLDLINK_FLAGS)

DEFINE GCC49_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS)
DEFINE GCC49_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS)
-DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections -z common-page-size=0x40
-DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) --entry ReferenceAcpiTable -u ReferenceAcpiTable
-DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40
+DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC49_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
-DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -melf_x86_64 --oformat=elf64-x86-64
+DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=elf64-x86-64
DEFINE GCC49_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
DEFINE GCC49_ASM_FLAGS = DEF(GCC48_ASM_FLAGS)
DEFINE GCC49_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
@@ -4567,8 +4567,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_IA32_OBJCOPY_PATH = DEF(GCC44_IA32_PREFIX)objcopy
*_GCC44_IA32_CC_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_SLINK_PATH = DEF(GCC44_IA32_PREFIX)ar
-*_GCC44_IA32_DLINK_PATH = DEF(GCC44_IA32_PREFIX)ld
-*_GCC44_IA32_ASLDLINK_PATH = DEF(GCC44_IA32_PREFIX)ld
+*_GCC44_IA32_DLINK_PATH = DEF(GCC44_IA32_PREFIX)gcc
+*_GCC44_IA32_ASLDLINK_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_ASM_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_PP_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_VFRPP_PATH = DEF(GCC44_IA32_PREFIX)gcc
@@ -4577,10 +4577,10 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_IA32_RC_PATH = DEF(GCC44_IA32_PREFIX)objcopy

*_GCC44_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC44_IA32_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC44_IA32_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC44_IA32_ASM_FLAGS = DEF(GCC44_ASM_FLAGS) -m32 --32 -march=i386
*_GCC44_IA32_CC_FLAGS = DEF(GCC44_IA32_CC_FLAGS) -Os
-*_GCC44_IA32_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC44_IA32_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386
*_GCC44_IA32_DLINK2_FLAGS = DEF(GCC44_IA32_DLINK2_FLAGS)
*_GCC44_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC44_IA32_OBJCOPY_FLAGS =
@@ -4592,8 +4592,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_X64_OBJCOPY_PATH = DEF(GCC44_X64_PREFIX)objcopy
*_GCC44_X64_CC_PATH = DEF(GCC44_X64_PREFIX)gcc
*_GCC44_X64_SLINK_PATH = DEF(GCC44_X64_PREFIX)ar
-*_GCC44_X64_DLINK_PATH = DEF(GCC44_X64_PREFIX)ld
-*_GCC44_X64_ASLDLINK_PATH = DEF(GCC44_X64_PREFIX)ld
+*_GCC44_X64_DLINK_PATH = DEF(GCC44_X64_PREFIX)gcc
+*_GCC44_X64_ASLDLINK_PATH = DEF(GCC44_X64_PREFIX)gcc
*_GCC44_X64_ASM_PATH = DEF(GCC44_X64_PREFIX)gcc
*_GCC44_X64_PP_PATH = DEF(GCC44_X64_PREFIX)gcc
*_GCC44_X64_VFRPP_PATH = DEF(GCC44_X64_PREFIX)gcc
@@ -4602,7 +4602,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_X64_RC_PATH = DEF(GCC44_X64_PREFIX)objcopy

*_GCC44_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC44_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC44_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC44_X64_ASM_FLAGS = DEF(GCC44_ASM_FLAGS) -m64 --64 -melf_x86_64
*_GCC44_X64_CC_FLAGS = DEF(GCC44_X64_CC_FLAGS)
*_GCC44_X64_DLINK_FLAGS = DEF(GCC44_X64_DLINK_FLAGS)
@@ -4637,8 +4637,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_IA32_OBJCOPY_PATH = DEF(GCC45_IA32_PREFIX)objcopy
*_GCC45_IA32_CC_PATH = DEF(GCC45_IA32_PREFIX)gcc
*_GCC45_IA32_SLINK_PATH = DEF(GCC45_IA32_PREFIX)ar
-*_GCC45_IA32_DLINK_PATH = DEF(GCC45_IA32_PREFIX)ld
-*_GCC45_IA32_ASLDLINK_PATH = DEF(GCC45_IA32_PREFIX)ld
+*_GCC45_IA32_DLINK_PATH = DEF(GCC45_IA32_PREFIX)gcc
+*_GCC45_IA32_ASLDLINK_PATH = DEF(GCC45_IA32_PREFIX)gcc
*_GCC45_IA32_ASM_PATH = DEF(GCC45_IA32_PREFIX)gcc
*_GCC45_IA32_PP_PATH = DEF(GCC45_IA32_PREFIX)gcc
*_GCC45_IA32_VFRPP_PATH = DEF(GCC45_IA32_PREFIX)gcc
@@ -4647,10 +4647,10 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_IA32_RC_PATH = DEF(GCC45_IA32_PREFIX)objcopy

*_GCC45_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC45_IA32_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC45_IA32_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC45_IA32_ASM_FLAGS = DEF(GCC45_ASM_FLAGS) -m32 --32 -march=i386
*_GCC45_IA32_CC_FLAGS = DEF(GCC45_IA32_CC_FLAGS) -Os
-*_GCC45_IA32_DLINK_FLAGS = DEF(GCC45_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC45_IA32_DLINK_FLAGS = DEF(GCC45_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386
*_GCC45_IA32_DLINK2_FLAGS = DEF(GCC45_IA32_DLINK2_FLAGS)
*_GCC45_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC45_IA32_OBJCOPY_FLAGS =
@@ -4662,8 +4662,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_X64_OBJCOPY_PATH = DEF(GCC45_X64_PREFIX)objcopy
*_GCC45_X64_CC_PATH = DEF(GCC45_X64_PREFIX)gcc
*_GCC45_X64_SLINK_PATH = DEF(GCC45_X64_PREFIX)ar
-*_GCC45_X64_DLINK_PATH = DEF(GCC45_X64_PREFIX)ld
-*_GCC45_X64_ASLDLINK_PATH = DEF(GCC45_X64_PREFIX)ld
+*_GCC45_X64_DLINK_PATH = DEF(GCC45_X64_PREFIX)gcc
+*_GCC45_X64_ASLDLINK_PATH = DEF(GCC45_X64_PREFIX)gcc
*_GCC45_X64_ASM_PATH = DEF(GCC45_X64_PREFIX)gcc
*_GCC45_X64_PP_PATH = DEF(GCC45_X64_PREFIX)gcc
*_GCC45_X64_VFRPP_PATH = DEF(GCC45_X64_PREFIX)gcc
@@ -4672,7 +4672,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_X64_RC_PATH = DEF(GCC45_X64_PREFIX)objcopy

*_GCC45_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC45_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC45_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC45_X64_ASM_FLAGS = DEF(GCC45_ASM_FLAGS) -m64 --64 -melf_x86_64
*_GCC45_X64_CC_FLAGS = DEF(GCC45_X64_CC_FLAGS)
*_GCC45_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
@@ -4707,8 +4707,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC46_IA32_OBJCOPY_PATH = DEF(GCC46_IA32_PREFIX)objcopy
*_GCC46_IA32_CC_PATH = DEF(GCC46_IA32_PREFIX)gcc
*_GCC46_IA32_SLINK_PATH = DEF(GCC46_IA32_PREFIX)ar
-*_GCC46_IA32_DLINK_PATH = DEF(GCC46_IA32_PREFIX)ld
-*_GCC46_IA32_ASLDLINK_PATH = DEF(GCC46_IA32_PREFIX)ld
+*_GCC46_IA32_DLINK_PATH = DEF(GCC46_IA32_PREFIX)gcc
+*_GCC46_IA32_ASLDLINK_PATH = DEF(GCC46_IA32_PREFIX)gcc
*_GCC46_IA32_ASM_PATH = DEF(GCC46_IA32_PREFIX)gcc
*_GCC46_IA32_PP_PATH = DEF(GCC46_IA32_PREFIX)gcc
*_GCC46_IA32_VFRPP_PATH = DEF(GCC46_IA32_PREFIX)gcc
@@ -4717,9 +4717,9 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC46_IA32_RC_PATH = DEF(GCC46_IA32_PREFIX)objcopy

*_GCC46_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC46_IA32_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC46_IA32_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC46_IA32_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m32 -march=i386
-*_GCC46_IA32_DLINK_FLAGS = DEF(GCC46_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC46_IA32_DLINK_FLAGS = DEF(GCC46_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386
*_GCC46_IA32_DLINK2_FLAGS = DEF(GCC46_IA32_DLINK2_FLAGS)
*_GCC46_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC46_IA32_OBJCOPY_FLAGS =
@@ -4734,8 +4734,8 @@ RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC46_X64_OBJCOPY_PATH = DEF(GCC46_X64_PREFIX)objcopy
*_GCC46_X64_CC_PATH = DEF(GCC46_X64_PREFIX)gcc
*_GCC46_X64_SLINK_PATH = DEF(GCC46_X64_PREFIX)ar
-*_GCC46_X64_DLINK_PATH = DEF(GCC46_X64_PREFIX)ld
-*_GCC46_X64_ASLDLINK_PATH = DEF(GCC46_X64_PREFIX)ld
+*_GCC46_X64_DLINK_PATH = DEF(GCC46_X64_PREFIX)gcc
+*_GCC46_X64_ASLDLINK_PATH = DEF(GCC46_X64_PREFIX)gcc
*_GCC46_X64_ASM_PATH = DEF(GCC46_X64_PREFIX)gcc
*_GCC46_X64_PP_PATH = DEF(GCC46_X64_PREFIX)gcc
*_GCC46_X64_VFRPP_PATH = DEF(GCC46_X64_PREFIX)gcc
@@ -4744,7 +4744,7 @@ RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC46_X64_RC_PATH = DEF(GCC46_X64_PREFIX)objcopy

*_GCC46_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC46_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC46_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC46_X64_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m64 -melf_x86_64
*_GCC46_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
*_GCC46_X64_DLINK2_FLAGS = DEF(GCC46_X64_DLINK2_FLAGS)
@@ -4761,8 +4761,8 @@ RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Wno-unused-but-set-v
*_GCC46_ARM_OBJCOPY_PATH = echo
*_GCC46_ARM_CC_PATH = ENV(GCC46_ARM_PREFIX)gcc
*_GCC46_ARM_SLINK_PATH = ENV(GCC46_ARM_PREFIX)ar
-*_GCC46_ARM_DLINK_PATH = ENV(GCC46_ARM_PREFIX)ld
-*_GCC46_ARM_ASLDLINK_PATH = ENV(GCC46_ARM_PREFIX)ld
+*_GCC46_ARM_DLINK_PATH = ENV(GCC46_ARM_PREFIX)gcc
+*_GCC46_ARM_ASLDLINK_PATH = ENV(GCC46_ARM_PREFIX)gcc
*_GCC46_ARM_ASM_PATH = ENV(GCC46_ARM_PREFIX)gcc
*_GCC46_ARM_PP_PATH = ENV(GCC46_ARM_PREFIX)gcc
*_GCC46_ARM_VFRPP_PATH = ENV(GCC46_ARM_PREFIX)gcc
@@ -4812,8 +4812,8 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALI
*_GCC47_IA32_OBJCOPY_PATH = DEF(GCC47_IA32_PREFIX)objcopy
*_GCC47_IA32_CC_PATH = DEF(GCC47_IA32_PREFIX)gcc
*_GCC47_IA32_SLINK_PATH = DEF(GCC47_IA32_PREFIX)ar
-*_GCC47_IA32_DLINK_PATH = DEF(GCC47_IA32_PREFIX)ld
-*_GCC47_IA32_ASLDLINK_PATH = DEF(GCC47_IA32_PREFIX)ld
+*_GCC47_IA32_DLINK_PATH = DEF(GCC47_IA32_PREFIX)gcc
+*_GCC47_IA32_ASLDLINK_PATH = DEF(GCC47_IA32_PREFIX)gcc
*_GCC47_IA32_ASM_PATH = DEF(GCC47_IA32_PREFIX)gcc
*_GCC47_IA32_PP_PATH = DEF(GCC47_IA32_PREFIX)gcc
*_GCC47_IA32_VFRPP_PATH = DEF(GCC47_IA32_PREFIX)gcc
@@ -4822,9 +4822,9 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALI
*_GCC47_IA32_RC_PATH = DEF(GCC47_IA32_PREFIX)objcopy

*_GCC47_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC47_IA32_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC47_IA32_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC47_IA32_ASM_FLAGS = DEF(GCC47_ASM_FLAGS) -m32 -march=i386
-*_GCC47_IA32_DLINK_FLAGS = DEF(GCC47_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC47_IA32_DLINK_FLAGS = DEF(GCC47_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386
*_GCC47_IA32_DLINK2_FLAGS = DEF(GCC47_IA32_DLINK2_FLAGS)
*_GCC47_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC47_IA32_OBJCOPY_FLAGS =
@@ -4839,8 +4839,8 @@ RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC47_X64_OBJCOPY_PATH = DEF(GCC47_X64_PREFIX)objcopy
*_GCC47_X64_CC_PATH = DEF(GCC47_X64_PREFIX)gcc
*_GCC47_X64_SLINK_PATH = DEF(GCC47_X64_PREFIX)ar
-*_GCC47_X64_DLINK_PATH = DEF(GCC47_X64_PREFIX)ld
-*_GCC47_X64_ASLDLINK_PATH = DEF(GCC47_X64_PREFIX)ld
+*_GCC47_X64_DLINK_PATH = DEF(GCC47_X64_PREFIX)gcc
+*_GCC47_X64_ASLDLINK_PATH = DEF(GCC47_X64_PREFIX)gcc
*_GCC47_X64_ASM_PATH = DEF(GCC47_X64_PREFIX)gcc
*_GCC47_X64_PP_PATH = DEF(GCC47_X64_PREFIX)gcc
*_GCC47_X64_VFRPP_PATH = DEF(GCC47_X64_PREFIX)gcc
@@ -4849,7 +4849,7 @@ RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC47_X64_RC_PATH = DEF(GCC47_X64_PREFIX)objcopy

*_GCC47_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC47_X64_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC47_X64_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC47_X64_ASM_FLAGS = DEF(GCC47_ASM_FLAGS) -m64
*_GCC47_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS)
*_GCC47_X64_DLINK2_FLAGS = DEF(GCC47_X64_DLINK2_FLAGS)
@@ -4865,8 +4865,8 @@ RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC47_ARM_CC_PATH = ENV(GCC47_ARM_PREFIX)gcc
*_GCC47_ARM_SLINK_PATH = ENV(GCC47_ARM_PREFIX)ar
-*_GCC47_ARM_DLINK_PATH = ENV(GCC47_ARM_PREFIX)ld
-*_GCC47_ARM_ASLDLINK_PATH = ENV(GCC47_ARM_PREFIX)ld
+*_GCC47_ARM_DLINK_PATH = ENV(GCC47_ARM_PREFIX)gcc
+*_GCC47_ARM_ASLDLINK_PATH = ENV(GCC47_ARM_PREFIX)gcc
*_GCC47_ARM_ASM_PATH = ENV(GCC47_ARM_PREFIX)gcc
*_GCC47_ARM_PP_PATH = ENV(GCC47_ARM_PREFIX)gcc
*_GCC47_ARM_VFRPP_PATH = ENV(GCC47_ARM_PREFIX)gcc
@@ -4895,8 +4895,8 @@ RELEASE_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC47_AARCH64_CC_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
*_GCC47_AARCH64_SLINK_PATH = ENV(GCC47_AARCH64_PREFIX)ar
-*_GCC47_AARCH64_DLINK_PATH = ENV(GCC47_AARCH64_PREFIX)ld
-*_GCC47_AARCH64_ASLDLINK_PATH = ENV(GCC47_AARCH64_PREFIX)ld
+*_GCC47_AARCH64_DLINK_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
+*_GCC47_AARCH64_ASLDLINK_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
*_GCC47_AARCH64_ASM_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
*_GCC47_AARCH64_PP_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
*_GCC47_AARCH64_VFRPP_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
@@ -4944,8 +4944,8 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC48_IA32_OBJCOPY_PATH = DEF(GCC48_IA32_PREFIX)objcopy
*_GCC48_IA32_CC_PATH = DEF(GCC48_IA32_PREFIX)gcc
*_GCC48_IA32_SLINK_PATH = DEF(GCC48_IA32_PREFIX)ar
-*_GCC48_IA32_DLINK_PATH = DEF(GCC48_IA32_PREFIX)ld
-*_GCC48_IA32_ASLDLINK_PATH = DEF(GCC48_IA32_PREFIX)ld
+*_GCC48_IA32_DLINK_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_ASLDLINK_PATH = DEF(GCC48_IA32_PREFIX)gcc
*_GCC48_IA32_ASM_PATH = DEF(GCC48_IA32_PREFIX)gcc
*_GCC48_IA32_PP_PATH = DEF(GCC48_IA32_PREFIX)gcc
*_GCC48_IA32_VFRPP_PATH = DEF(GCC48_IA32_PREFIX)gcc
@@ -4954,9 +4954,9 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC48_IA32_RC_PATH = DEF(GCC48_IA32_PREFIX)objcopy

*_GCC48_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC48_IA32_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC48_IA32_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC48_IA32_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m32 -march=i386
-*_GCC48_IA32_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC48_IA32_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386
*_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
*_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC48_IA32_OBJCOPY_FLAGS =
@@ -4971,8 +4971,8 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC48_X64_OBJCOPY_PATH = DEF(GCC48_X64_PREFIX)objcopy
*_GCC48_X64_CC_PATH = DEF(GCC48_X64_PREFIX)gcc
*_GCC48_X64_SLINK_PATH = DEF(GCC48_X64_PREFIX)ar
-*_GCC48_X64_DLINK_PATH = DEF(GCC48_X64_PREFIX)ld
-*_GCC48_X64_ASLDLINK_PATH = DEF(GCC48_X64_PREFIX)ld
+*_GCC48_X64_DLINK_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_ASLDLINK_PATH = DEF(GCC48_X64_PREFIX)gcc
*_GCC48_X64_ASM_PATH = DEF(GCC48_X64_PREFIX)gcc
*_GCC48_X64_PP_PATH = DEF(GCC48_X64_PREFIX)gcc
*_GCC48_X64_VFRPP_PATH = DEF(GCC48_X64_PREFIX)gcc
@@ -4981,7 +4981,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC48_X64_RC_PATH = DEF(GCC48_X64_PREFIX)objcopy

*_GCC48_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC48_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC48_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC48_X64_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m64
*_GCC48_X64_DLINK_FLAGS = DEF(GCC48_X64_DLINK_FLAGS)
*_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
@@ -4997,8 +4997,8 @@ RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC48_ARM_CC_PATH = ENV(GCC48_ARM_PREFIX)gcc
*_GCC48_ARM_SLINK_PATH = ENV(GCC48_ARM_PREFIX)ar
-*_GCC48_ARM_DLINK_PATH = ENV(GCC48_ARM_PREFIX)ld
-*_GCC48_ARM_ASLDLINK_PATH = ENV(GCC48_ARM_PREFIX)ld
+*_GCC48_ARM_DLINK_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_ASLDLINK_PATH = ENV(GCC48_ARM_PREFIX)gcc
*_GCC48_ARM_ASM_PATH = ENV(GCC48_ARM_PREFIX)gcc
*_GCC48_ARM_PP_PATH = ENV(GCC48_ARM_PREFIX)gcc
*_GCC48_ARM_VFRPP_PATH = ENV(GCC48_ARM_PREFIX)gcc
@@ -5027,8 +5027,8 @@ RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC48_AARCH64_CC_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
*_GCC48_AARCH64_SLINK_PATH = ENV(GCC48_AARCH64_PREFIX)ar
-*_GCC48_AARCH64_DLINK_PATH = ENV(GCC48_AARCH64_PREFIX)ld
-*_GCC48_AARCH64_ASLDLINK_PATH = ENV(GCC48_AARCH64_PREFIX)ld
+*_GCC48_AARCH64_DLINK_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_ASLDLINK_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
*_GCC48_AARCH64_ASM_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
*_GCC48_AARCH64_PP_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
*_GCC48_AARCH64_VFRPP_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
@@ -5076,8 +5076,8 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC49_IA32_OBJCOPY_PATH = DEF(GCC49_IA32_PREFIX)objcopy
*_GCC49_IA32_CC_PATH = DEF(GCC49_IA32_PREFIX)gcc
*_GCC49_IA32_SLINK_PATH = DEF(GCC49_IA32_PREFIX)ar
-*_GCC49_IA32_DLINK_PATH = DEF(GCC49_IA32_PREFIX)ld
-*_GCC49_IA32_ASLDLINK_PATH = DEF(GCC49_IA32_PREFIX)ld
+*_GCC49_IA32_DLINK_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_ASLDLINK_PATH = DEF(GCC49_IA32_PREFIX)gcc
*_GCC49_IA32_ASM_PATH = DEF(GCC49_IA32_PREFIX)gcc
*_GCC49_IA32_PP_PATH = DEF(GCC49_IA32_PREFIX)gcc
*_GCC49_IA32_VFRPP_PATH = DEF(GCC49_IA32_PREFIX)gcc
@@ -5086,9 +5086,9 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC49_IA32_RC_PATH = DEF(GCC49_IA32_PREFIX)objcopy

*_GCC49_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC49_IA32_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC49_IA32_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC49_IA32_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m32 -march=i386
-*_GCC49_IA32_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC49_IA32_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386
*_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS)
*_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC49_IA32_OBJCOPY_FLAGS =
@@ -5103,8 +5103,8 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC49_X64_OBJCOPY_PATH = DEF(GCC49_X64_PREFIX)objcopy
*_GCC49_X64_CC_PATH = DEF(GCC49_X64_PREFIX)gcc
*_GCC49_X64_SLINK_PATH = DEF(GCC49_X64_PREFIX)ar
-*_GCC49_X64_DLINK_PATH = DEF(GCC49_X64_PREFIX)ld
-*_GCC49_X64_ASLDLINK_PATH = DEF(GCC49_X64_PREFIX)ld
+*_GCC49_X64_DLINK_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_ASLDLINK_PATH = DEF(GCC49_X64_PREFIX)gcc
*_GCC49_X64_ASM_PATH = DEF(GCC49_X64_PREFIX)gcc
*_GCC49_X64_PP_PATH = DEF(GCC49_X64_PREFIX)gcc
*_GCC49_X64_VFRPP_PATH = DEF(GCC49_X64_PREFIX)gcc
@@ -5113,7 +5113,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC49_X64_RC_PATH = DEF(GCC49_X64_PREFIX)objcopy

*_GCC49_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC49_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC49_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC49_X64_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m64
*_GCC49_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS)
*_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
@@ -5129,8 +5129,8 @@ RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC49_ARM_CC_PATH = ENV(GCC49_ARM_PREFIX)gcc
*_GCC49_ARM_SLINK_PATH = ENV(GCC49_ARM_PREFIX)ar
-*_GCC49_ARM_DLINK_PATH = ENV(GCC49_ARM_PREFIX)ld
-*_GCC49_ARM_ASLDLINK_PATH = ENV(GCC49_ARM_PREFIX)ld
+*_GCC49_ARM_DLINK_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_ASLDLINK_PATH = ENV(GCC49_ARM_PREFIX)gcc
*_GCC49_ARM_ASM_PATH = ENV(GCC49_ARM_PREFIX)gcc
*_GCC49_ARM_PP_PATH = ENV(GCC49_ARM_PREFIX)gcc
*_GCC49_ARM_VFRPP_PATH = ENV(GCC49_ARM_PREFIX)gcc
@@ -5159,8 +5159,8 @@ RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC49_AARCH64_CC_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
*_GCC49_AARCH64_SLINK_PATH = ENV(GCC49_AARCH64_PREFIX)ar
-*_GCC49_AARCH64_DLINK_PATH = ENV(GCC49_AARCH64_PREFIX)ld
-*_GCC49_AARCH64_ASLDLINK_PATH = ENV(GCC49_AARCH64_PREFIX)ld
+*_GCC49_AARCH64_DLINK_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_ASLDLINK_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
*_GCC49_AARCH64_ASM_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
*_GCC49_AARCH64_PP_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
*_GCC49_AARCH64_VFRPP_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
@@ -5209,9 +5209,11 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS)
*_CLANG35_*_VFRPP_PATH = ENV(CLANG35_BIN)clang
*_CLANG35_*_ASLCC_PATH = ENV(CLANG35_BIN)clang
*_CLANG35_*_ASLPP_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_DLINK_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_ASLDLINK_PATH = ENV(CLANG35_BIN)clang

-DEFINE CLANG35_ARM_TARGET = -target armv7-none-linux-gnueabi
-DEFINE CLANG35_AARCH64_TARGET = -target aarch64-none-linux-gnu
+DEFINE CLANG35_ARM_TARGET = -target arm-linux-gnueabihf
+DEFINE CLANG35_AARCH64_TARGET = -target aarch64-linux-gnu

DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body
DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) -mstrict-align DEF(CLANG35_WARNING_OVERRIDES)
@@ -5221,15 +5223,13 @@ DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64
# CLANG35 ARM definitions
##################
*_CLANG35_ARM_SLINK_PATH = ENV(CLANG35_ARM_PREFIX)ar
-*_CLANG35_ARM_DLINK_PATH = ENV(CLANG35_ARM_PREFIX)ld
-*_CLANG35_ARM_ASLDLINK_PATH = ENV(CLANG35_ARM_PREFIX)ld
*_CLANG35_ARM_RC_PATH = ENV(CLANG35_ARM_PREFIX)objcopy

*_CLANG35_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
-*_CLANG35_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS)
+*_CLANG35_ARM_ASLDLINK_FLAGS = DEF(CLANG35_ARM_TARGET) DEF(GCC_ARM_ASLDLINK_FLAGS)
*_CLANG35_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
-*_CLANG35_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS)
-*_CLANG35_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
+*_CLANG35_ARM_DLINK_FLAGS = DEF(CLANG35_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
+*_CLANG35_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
*_CLANG35_ARM_PLATFORM_FLAGS =
*_CLANG35_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
*_CLANG35_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
@@ -5243,15 +5243,13 @@ RELEASE_CLANG35_ARM_CC_FLAGS = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(P
# CLANG35 AARCH64 definitions
##################
*_CLANG35_AARCH64_SLINK_PATH = ENV(CLANG35_AARCH64_PREFIX)ar
-*_CLANG35_AARCH64_DLINK_PATH = ENV(CLANG35_AARCH64_PREFIX)ld
-*_CLANG35_AARCH64_ASLDLINK_PATH = ENV(CLANG35_AARCH64_PREFIX)ld
*_CLANG35_AARCH64_RC_PATH = ENV(CLANG35_AARCH64_PREFIX)objcopy

*_CLANG35_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
-*_CLANG35_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
+*_CLANG35_AARCH64_ASLDLINK_FLAGS = DEF(CLANG35_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)
*_CLANG35_AARCH64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG35_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
-*_CLANG35_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
-*_CLANG35_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x228
+*_CLANG35_AARCH64_DLINK_FLAGS = DEF(CLANG35_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+*_CLANG35_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
*_CLANG35_AARCH64_PLATFORM_FLAGS =
*_CLANG35_AARCH64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG35_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
*_CLANG35_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf
index d0b4927d1678..d83857a1fd68 100644
--- a/EmulatorPkg/Unix/Host/Host.inf
+++ b/EmulatorPkg/Unix/Host/Host.inf
@@ -116,12 +116,12 @@ [FeaturePcd]


[BuildOptions]
- GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_i386 -dynamic-linker $(HOST_DLINK_PATHS) -L/usr/lib/i386-linux-gnu -L/usr/X11R6/lib -lXext -lX11
+ GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/Host -m32 -L/usr/X11R6/lib
GCC:*_*_IA32_CC_FLAGS == -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_IA32_ASM_FLAGS == -m32 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h

- GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_x86_64 -dynamic-linker $(HOST_DLINK_PATHS) -L/usr/lib/x86_64-linux-gnu -L/usr/X11R6/lib -lXext -lX11
+ GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -m64 -L/usr/X11R6/lib
GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
GCC:*_GCC44_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
GCC:*_GCC45_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
@@ -132,7 +132,7 @@ [BuildOptions]
GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h

- GCC:*_*_*_DLINK2_FLAGS == -lpthread -lc -ldl
+ GCC:*_*_*_DLINK2_FLAGS == -lpthread -ldl -lXext -lX11

#
# Need to do this link via gcc and not ld as the pathing to libraries changes from OS version to OS version
--
2.7.4


[PATCH v5 3/8] BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into GCCLD

Ard Biesheuvel
 

Before we can make non-backward compatible changes to the GCC build rules
regarding the use of the 'gcc' binary as the linker, clone the existing
GCC build rules into a 'GCCLD' build rule family, and move the legacy
toolchains UNIXGCC, CYGGCC, CYGGCCxASL and ELFGCC over to it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
---
BaseTools/Conf/build_rule.template | 28 ++++++++++----------
BaseTools/Conf/tools_def.template | 4 +++
2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index 91bcc1828cb5..3fea4f456118 100644
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -130,7 +130,7 @@
<Command.MSFT, Command.INTEL>
"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}

- <Command.GCC, Command.RVCT>
+ <Command.GCC, Command.GCCLD, Command.RVCT>
# For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}

@@ -156,7 +156,7 @@
<Command.MSFT, Command.INTEL>
"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}

- <Command.GCC, Command.RVCT>
+ <Command.GCC, Command.GCCLD, Command.RVCT>
# For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
"$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}
@@ -171,7 +171,7 @@
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -o ${dst} $(INC) ${src}

[C-Header-File]
@@ -187,7 +187,7 @@
<InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
?.asm, ?.Asm, ?.ASM

- <InputFile.GCC>
+ <InputFile.GCC, InputFile.GCCLD>
?.S, ?.s

<ExtraDependency>
@@ -201,7 +201,7 @@
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii

- <Command.GCC, Command.RVCT>
+ <Command.GCC, Command.GCCLD, Command.RVCT>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
@@ -265,7 +265,7 @@
<Command.MSFT, Command.INTEL>
"$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)

<Command.RVCT>
@@ -291,7 +291,7 @@
<Command.MSFT, Command.INTEL>
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}

@@ -319,7 +319,7 @@
<Command.MSFT, Command.INTEL>
"$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(DLINK)" $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)

<Command.RVCT>
@@ -346,7 +346,7 @@
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
-$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
$(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
$(OBJCOPY) --strip-unneeded -R .eh_frame ${src}

@@ -402,7 +402,7 @@
Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
"$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
"$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
@@ -423,7 +423,7 @@
"$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
@@ -443,7 +443,7 @@
"$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
@@ -472,7 +472,7 @@
"$(ASM16)" /nologo /c /omf $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
"$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
@@ -596,7 +596,7 @@
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" /Fo${dst} $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc

- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index b36a19314215..8a04e38e1288 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4460,6 +4460,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
# UNIXGCC - UNIX GCC
# ASL - Intel Linux ACPI Source Language Compiler (iasl)
*_UNIXGCC_*_*_FAMILY = GCC
+*_UNIXGCC_*_*_BUILDRULEFAMILY = GCCLD

*_UNIXGCC_*_MAKE_PATH = make
*_UNIXGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
@@ -5268,6 +5269,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
# CYGGCC - CygWin GCC
# ASL - Intel ACPI Source Language Compiler (iasl.exe)
*_CYGGCC_*_*_FAMILY = GCC
+*_CYGGCC_*_*_BUILDRULEFAMILY = GCCLD

*_CYGGCC_*_*_DLL = DEF(CYGWIN_BIN)
*_CYGGCC_*_MAKE_PATH = DEF(MS_VS_BIN)\nmake.exe
@@ -5375,6 +5377,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
# CYGGCCxASL - CygWin GCC
# ASL - Microsoft ACPI Source Language Compiler (asl.exe)
*_CYGGCCxASL_*_*_FAMILY = GCC
+*_CYGGCCxASL_*_*_BUILDRULEFAMILY = GCCLD

*_CYGGCCxASL_*_*_DLL = DEF(CYGWIN_BIN)
*_CYGGCCxASL_*_MAKE_PATH = DEF(MS_VS_BIN)\nmake.exe
@@ -5478,6 +5481,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
####################################################################################
# ELFGCC - Linux ELF GCC
*_ELFGCC_*_*_FAMILY = GCC
+*_ELFGCC_*_*_BUILDRULEFAMILY = GCCLD
*_ELFGCC_*_MAKE_PATH = make

*_ELFGCC_*_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
--
2.7.4


[PATCH v5 2/8] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note sections

Ard Biesheuvel
 

Newer versions of ld automatically emit .gnu.hash and .note.gnu.build-id
sections, which are not listed in the linker script, and will end up
breaking the build with an allocation conflict, e.g.,

/usr/bin/aarch64-linux-gnu-ld: section .note.gnu.build-id loaded at
[0000000000000000,0000000000000023] overlaps section .text loaded at
[0000000000000000,0000000000017dbf]

Since we don't require or care about these sections, update the linker
script so that they are discarded. Note that this involves emitting the
.note.gnu.build-id section into a non-allocatable segment to prevent the
linker from noticing that it is being discarded (and subsequently
complaining about it)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---
ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 3 +++
1 file changed, 3 insertions(+)

diff --git a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
index 832ad1474468..44df7840adfd 100644
--- a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
+++ b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
@@ -30,8 +30,11 @@ SECTIONS
PROVIDE(__reloc_end = .);
}

+ .note (INFO) : { *(.note.gnu.build-id) }
+
/DISCARD/ : {
*(.note.GNU-stack)
+ *(.gnu.hash)
*(.gnu_debuglink)
*(.interp)
*(.dynamic)
--
2.7.4


[PATCH v5 1/8] BaseTools CLANG35: drop problematic use-movt and save-temps options

Ard Biesheuvel
 

Some versions of Clang fail on every input file when using the
-save-temps options, and produces the following heplful error message:

<unknown>:0: error: Undefined temporary symbol

Simply dropping the option for CLANG35 is the simplest way around this,
since the value of storing .i and .s files is dubious anyway.

Also, drop the arm-use-movt option, which does not appear to be
supported anymore by recent versions of clang.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---
BaseTools/Conf/tools_def.template | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 847b9f729f29..b36a19314215 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4325,8 +4325,8 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -
DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
-DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
-DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
+DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
+DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
@@ -4384,7 +4384,7 @@ DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
DEFINE GCC46_X64_DLINK2_FLAGS = DEF(GCC45_X64_DLINK2_FLAGS)
DEFINE GCC46_ASM_FLAGS = DEF(GCC45_ASM_FLAGS)
DEFINE GCC46_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
-DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
+DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations -save-temps
DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) --oformat=elf32-littlearm
DEFINE GCC46_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) --oformat=elf32-littlearm
@@ -4401,7 +4401,7 @@ DEFINE GCC47_ASM_FLAGS = DEF(GCC46_ASM_FLAGS)
DEFINE GCC47_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS)
DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -mno-unaligned-access
-DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
+DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS) -save-temps
DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
DEFINE GCC47_ARM_DLINK2_FLAGS = DEF(GCC46_ARM_DLINK2_FLAGS)
@@ -4443,7 +4443,7 @@ DEFINE GCC49_ASM_FLAGS = DEF(GCC48_ASM_FLAGS)
DEFINE GCC49_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
DEFINE GCC49_AARCH64_ASM_FLAGS = DEF(GCC48_AARCH64_ASM_FLAGS)
DEFINE GCC49_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS)
-DEFINE GCC49_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
+DEFINE GCC49_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -save-temps
DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
DEFINE GCC49_ARM_DLINK2_FLAGS = DEF(GCC48_ARM_DLINK2_FLAGS)
@@ -5213,7 +5213,7 @@ DEFINE CLANG35_ARM_TARGET = -target armv7-none-linux-gnueabi
DEFINE CLANG35_AARCH64_TARGET = -target aarch64-none-linux-gnu

DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body
-DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) -mstrict-align -mllvm -arm-use-movt=0 DEF(CLANG35_WARNING_OVERRIDES)
+DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) -mstrict-align DEF(CLANG35_WARNING_OVERRIDES)
DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES)

##################
--
2.7.4


[PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode

Ard Biesheuvel
 

This v5 to introduce GCC5 is now a 8 piece series, including some
preparatory cleanup patches that allow all GCC4x and CLANG35 toolchains
to switch to using 'gcc' as the linker. This allows us to get rid of
the wrapper script to marshall ld arguments in order to make them
understandable by gcc, which is fragile and likely to cause problems in
the future.

Since there appears to be a natural split between the 'legacy' GCC
toolchains UNIXGCC, ELFGCC, and CYGGCC[xASL], both in term of supported
architectures [IA32, X64, IPF] vs [IA32, X64, ARM, AARCH64], and in
terms of maintenance, these toolchains are not moved to using 'gcc' as
the linker, and instead, a new BUILDRULEFAMILY is introduced called GCCLD
that will retain the old behavior.

The result is that GCC5 can align much more closely with its predecessors,
making the expected maintenance burden of supporting GCC back to v4.4
much lower.

Changes since v4:
- added patch to use 'protected' visibility only for the libraries that
define the module entry points (_ModuleEntryPoint), to prevent them from
being optimized away by the LTO routines
- added Jordan's ack/RBs
- add some extra comments to tools_def.template (#8)

Changes since v3:
- like Steven does in his GCC5LTO patch, add -fno-builtin to IA32 and X64
CC_FLAGS; this addresses a build issue reported by Liming
- add -Os the the linker flags as well, for AARCH64 this does not seem to make
a difference, but it is arguably correct since the LTO processing at link
time involves code generation as well
- add Laszlo's ack to #2
- new patch #6 to omit the autogenerated build-id from the PE/COFF binary

Changes since v2:
- add license headers to LTO glue files for ARM and AARCH64 (#5)
- get rid of lto-ld-wrapper script

Ard Biesheuvel (8):
BaseTools CLANG35: drop problematic use-movt and save-temps options
ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note
sections
BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into
GCCLD
BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
ArmPkg: add prebuilt glue binaries for GCC5 LTO support
BaseTools GCC: drop GNU notes section from EFI image
MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO
mode

ArmPkg/GccLto/liblto-aarch64.a | Bin 0 -> 1016 bytes
ArmPkg/GccLto/liblto-aarch64.s | 27 ++
ArmPkg/GccLto/liblto-arm.a | Bin 0 -> 2096 bytes
ArmPkg/GccLto/liblto-arm.s | 61 ++++
ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 2 +-
ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 3 +
BaseTools/Conf/build_rule.template | 31 +-
BaseTools/Conf/tools_def.template | 350 +++++++++++++++-----
BaseTools/Scripts/GccBase.lds | 6 +
EmulatorPkg/Unix/Host/Host.inf | 6 +-
MdePkg/Include/X64/ProcessorBind.h | 9 +-
MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 2 +
MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 2 +
MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf | 2 +
MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf | 2 +
MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf | 2 +
16 files changed, 396 insertions(+), 109 deletions(-)
create mode 100644 ArmPkg/GccLto/liblto-aarch64.a
create mode 100644 ArmPkg/GccLto/liblto-aarch64.s
create mode 100644 ArmPkg/GccLto/liblto-arm.a
create mode 100644 ArmPkg/GccLto/liblto-arm.s

--
2.7.4