[edk2,1/2] StdLib/LibC: avoid LTO code for compiler intrinsics

Message ID 1470654741-24203-1-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel Aug. 8, 2016, 11:12 a.m.
The softfloat routines and some other routines supplied by LibC
will satisfy references to compiler intrinsics that are emitted
by the compiler backend, which under LTO means that the link-time
code generation may emit references to symbols that have been
optimized away already.

Work around this by building the ARM and AARCH64 versions of LibC
and the softfloat library without LTO.

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

---
 StdLib/LibC/LibC.inf                | 1 +
 StdLib/LibC/Softfloat/Softfloat.inf | 2 +-
 2 files changed, 2 insertions(+), 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. 9, 2016, 8:13 a.m. | #1
On 8 August 2016 at 16:56, Carsey, Jaben <jaben.carsey@intel.com> wrote:
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

>


Pushed as

78d706e23512 StdLib/LibC: avoid LTO code for compiler intrinsics
1fbd0ca16a99 StdLib/LibC ARM AARCH64: do not redefine compiler intrinsics

Thanks all


>> -----Original Message-----

>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of

>> Michael Zimmermann

>> Sent: Monday, August 08, 2016 4:24 AM

>> To: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> Cc: Carsey, Jaben <jaben.carsey@intel.com>; edk2-devel@lists.01.org; Leif

>> Lindholm <leif.lindholm@linaro.org>; Daryl McDaniel <edk2-

>> lists@mc2research.org>

>> Subject: Re: [edk2] [PATCH 1/2] StdLib/LibC: avoid LTO code for compiler

>> intrinsics

>> Importance: High

>>

>> Reviewed-by: Michael Zimmermann <sigmaepsilon92@gmail.com>

>>

>> On Mon, Aug 8, 2016 at 1:12 PM, Ard Biesheuvel

>> <ard.biesheuvel@linaro.org>

>> wrote:

>>

>> > The softfloat routines and some other routines supplied by LibC

>> > will satisfy references to compiler intrinsics that are emitted

>> > by the compiler backend, which under LTO means that the link-time

>> > code generation may emit references to symbols that have been

>> > optimized away already.

>> >

>> > Work around this by building the ARM and AARCH64 versions of LibC

>> > and the softfloat library without LTO.

>> >

>> > Contributed-under: TianoCore Contribution Agreement 1.0

>> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> > ---

>> >  StdLib/LibC/LibC.inf                | 1 +

>> >  StdLib/LibC/Softfloat/Softfloat.inf | 2 +-

>> >  2 files changed, 2 insertions(+), 1 deletion(-)

>> >

>> > diff --git a/StdLib/LibC/LibC.inf b/StdLib/LibC/LibC.inf

>> > index f13630648555..6039bb81c7dd 100644

>> > --- a/StdLib/LibC/LibC.inf

>> > +++ b/StdLib/LibC/LibC.inf

>> > @@ -120,3 +120,4 @@ [LibraryClasses]

>> >  #

>> >  [BuildOptions]

>> >    MSFT:*_*_IA32_CC_FLAGS = /GL-

>> > +  GCC:*_*_ARM_CC_FLAGS = -fno-lto

>> > diff --git a/StdLib/LibC/Softfloat/Softfloat.inf b/StdLib/LibC/Softfloat/

>> > Softfloat.inf

>> > index 99763bcb57ba..460406c38fa4 100644

>> > --- a/StdLib/LibC/Softfloat/Softfloat.inf

>> > +++ b/StdLib/LibC/Softfloat/Softfloat.inf

>> > @@ -71,4 +71,4 @@ [Packages]

>> >  # Nasty things could happen if you do.

>> >

>> >  [BuildOptions]

>> > -  GCC:*_*_*_CC_FLAGS  = -DSOFTFLOAT_FOR_GCC -Wno-enum-compare

>> > -fno-tree-vrp

>> > +  GCC:*_*_*_CC_FLAGS  = -DSOFTFLOAT_FOR_GCC -Wno-enum-

>> compare

>> > -fno-tree-vrp -fno-lto

>> > --

>> > 2.7.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

Patch

diff --git a/StdLib/LibC/LibC.inf b/StdLib/LibC/LibC.inf
index f13630648555..6039bb81c7dd 100644
--- a/StdLib/LibC/LibC.inf
+++ b/StdLib/LibC/LibC.inf
@@ -120,3 +120,4 @@  [LibraryClasses]
 #
 [BuildOptions]
   MSFT:*_*_IA32_CC_FLAGS = /GL-
+  GCC:*_*_ARM_CC_FLAGS = -fno-lto
diff --git a/StdLib/LibC/Softfloat/Softfloat.inf b/StdLib/LibC/Softfloat/Softfloat.inf
index 99763bcb57ba..460406c38fa4 100644
--- a/StdLib/LibC/Softfloat/Softfloat.inf
+++ b/StdLib/LibC/Softfloat/Softfloat.inf
@@ -71,4 +71,4 @@  [Packages]
 # Nasty things could happen if you do.
 
 [BuildOptions]
-  GCC:*_*_*_CC_FLAGS  = -DSOFTFLOAT_FOR_GCC -Wno-enum-compare -fno-tree-vrp
+  GCC:*_*_*_CC_FLAGS  = -DSOFTFLOAT_FOR_GCC -Wno-enum-compare -fno-tree-vrp -fno-lto