[edk2,v4,0/7] BaseTools: add support for GCC5 in LTO mode

Message ID CAKv+Gu9s4WJbM72OhFCHtqQnmHr91_nuo4fc7PSrXR6m83aXLw@mail.gmail.com
State New
Headers show

Commit Message

Ard Biesheuvel July 31, 2016, 7:04 p.m.
On 30 July 2016 at 16:34, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 29 July 2016 at 17:18, Gao, Liming <liming.gao@intel.com> wrote:

>> Ard:

>>

>>   My gcc version 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04). I will try

>> GCC54.

>>

>

> I cannot reproduce this with  5.3.1-14ubuntu2.1 either.


@Liming: is the issue still reproducible with this change?

"""
"""

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

Comments

Ard Biesheuvel Aug. 1, 2016, 6:03 a.m. | #1
On 1 August 2016 at 04:26, Gao, Liming <liming.gao@intel.com> wrote:
> Ard:

>  My GNU ld (GNU Binutils for Ubuntu) 2.24. Which version you use?

>

> 1. #pragma GCC visibility push (hidden) , GCC5 with GCC49 tool chain pass. GCC5 with GCC5 tool chain failure. Here is failure message.

> GenFw: Elf64Convert.c:424: ScanSections64: Assertion `((BOOLEAN)(0==1))' failed.

> GenFw: ERROR 3000: Invalid

>   Did not find any '.text' section.

> Aborted (core dumped)

>

> 2. #pragma GCC visibility push (protected), GCC5 with GCC49 tool chain failure, GCC5 with GCC5 tool chain pass. Failure message is below.

>


Thanks for checking. The problem with GCC5 is that the fact that
'_ModuleEntryPoint' is also hidden, which confuses the LTO code and
makes it eliminate all input objects. I think this is a bug in LTO,
since the entry point is passed explicitly to the linker using the -e
option. But we still need to work around it.

Since the current issue (#2) is a problem with GCC49, I will propose a
separate patch to fix it by changing the 'protected' to 'hidden'. I
will then add a patch to my GCC5 series as well to work around the LTO
problem.

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

Patch

diff --git a/MdePkg/Include/X64/ProcessorBind.h
b/MdePkg/Include/X64/ProcessorBind.h
index a4aad3e..73cf799 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -34,7 +34,7 @@ 
 // symbols directly using relative references rather than via the GOT, which
 // contains absolute symbol addresses that are subject to runtime relocation.
 //
-#pragma GCC visibility push (protected)
+#pragma GCC visibility push (hidden)
 #endif

 #if defined(__INTEL_COMPILER)