diff mbox

[edk2,1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC

Message ID 1470321767-26921-2-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 59ceaa0a871d0d14bd54caa8cb9ca24a5314b223
Headers show

Commit Message

Ard Biesheuvel Aug. 4, 2016, 2:42 p.m. UTC
Building ArmSoftFloatLib with LTO results in errors like

  .../bin/ld: softfloat.obj: plugin needed to handle lto object
  .../bin/ld: __aeabi_dcmpge.obj: plugin needed to handle lto object
  .../bin/ld: __aeabi_dcmplt.obj: plugin needed to handle lto object
  .../bin/ld: internal error ../../ld/ldlang.c 6299

This library is only linked by OpensslLib at the moment, and only
marginally used at runtime, so just disable LTO for it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

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

Comments

Ard Biesheuvel Aug. 6, 2016, 2:42 p.m. UTC | #1
On 6 August 2016 at 16:18, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
> StdLib/LibC/Softfloat/Softfloat.inf and StdLib/LibC/LibC.inf need this flags

> too.

>


Just for ARM?
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Aug. 7, 2016, 10:29 a.m. UTC | #2
On 7 August 2016 at 11:28, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
> Hi,

>

> I researched a little bit on this topic and it seems that you have to add

> fuse-linker-plugin to the build options to enable lto plugins.

>


I think that is no longer needed.

> I did that and unfortunately it had no effect. After running gcc through

> strace I could see that liblto_plugin.so does get loaded from the

> cross-toolchains libexec directory though.

>

> Does that mean that the toolchain I use (GCC5 from releases.linaro.org and

> GCC6 from git.linaro.org) generates lto objects which it can't process with

> the shipped plugin?

>


The LTO works fine except for these particular objects. The reason is
that the compiler backend generates the function calls, so they are
not visible to the LTO routines. For this exact reason, I added
liblto-arm.a and liblto-aarch64.a to the normal GCC5 builds

> btw, if I compile using my hosts native GCC(x64) but for IA32 I get lto

> errors even for MdePkg. It looks like the fno-lto option is a very bad

> workaround and can break any time using specific configurations.

>


It shouldn't be. In a normal environment (i.e., building glibc apps),
things like libgcc and anything that is implemented in assembler is
included in the build as  non-LTO objects. The problems specific to
ARM and AARCH64 are the intrinsics, due to the issue mentioned above.
Perhaps we have some of those for IA32 as well? Which entry points
does the build complain about?

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

Patch

diff --git a/ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf b/ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
index f090b3f288ce..3c76381b25dc 100644
--- a/ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
+++ b/ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
@@ -48,7 +48,7 @@  [Packages]
   MdePkg/MdePkg.dec
 
 [BuildOptions]
-  GCC:*_*_*_CC_FLAGS = -DSOFTFLOAT_FOR_GCC -Wno-enum-compare
+  GCC:*_*_*_CC_FLAGS = -DSOFTFLOAT_FOR_GCC -Wno-enum-compare -fno-lto
   *_GCC46_*_CC_FLAGS = -fno-tree-vrp
   *_GCC47_*_CC_FLAGS = -fno-tree-vrp
   RVCT:*_*_*_CC_FLAGS = -DSOFTFLOAT_FOR_GCC