public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] Build fixes for ARM/OpenSSL
@ 2016-08-04 14:42 Ard Biesheuvel
  2016-08-04 14:42 ` [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC Ard Biesheuvel
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2016-08-04 14:42 UTC (permalink / raw)
  To: yonghong.zhu, liming.gao, edk2-devel
  Cc: leif.lindholm, eugene, Ard Biesheuvel

This series addresses some issues that cause the build to be broken
for ARM GCC5 at the moment when including OpensslLib in the build.

Ard Biesheuvel (3):
  ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
  ArmPkg/CompilerIntrinsicsLib: make the default memset() weak
  BaseTools GCC/ARM: add -fno-builtin to CC flags

 ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf | 2 +-
 ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S  | 8 ++++++++
 BaseTools/Conf/tools_def.template                  | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
  2016-08-04 14:42 [PATCH 0/3] Build fixes for ARM/OpenSSL Ard Biesheuvel
@ 2016-08-04 14:42 ` Ard Biesheuvel
  2016-08-06 14:18   ` Michael Zimmermann
  2016-08-04 14:42 ` [PATCH 2/3] ArmPkg/CompilerIntrinsicsLib: make the default memset() weak Ard Biesheuvel
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Ard Biesheuvel @ 2016-08-04 14:42 UTC (permalink / raw)
  To: yonghong.zhu, liming.gao, edk2-devel
  Cc: leif.lindholm, eugene, Ard Biesheuvel

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(-)

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
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] ArmPkg/CompilerIntrinsicsLib: make the default memset() weak
  2016-08-04 14:42 [PATCH 0/3] Build fixes for ARM/OpenSSL Ard Biesheuvel
  2016-08-04 14:42 ` [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC Ard Biesheuvel
@ 2016-08-04 14:42 ` Ard Biesheuvel
  2016-08-04 14:42 ` [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags Ard Biesheuvel
  2016-08-05 12:53 ` [PATCH 0/3] Build fixes for ARM/OpenSSL Leif Lindholm
  3 siblings, 0 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2016-08-04 14:42 UTC (permalink / raw)
  To: yonghong.zhu, liming.gao, edk2-devel
  Cc: leif.lindholm, eugene, Ard Biesheuvel

The ARM compiler intrinsics library defines __aeabi_memset() and
memset() in the same object, which means that both will be pulled
in if either is referenced.

The IntrinsicLib in CryptoPkg defines its own, preferred memset(),
which may clash with our memset(). So make our version weak.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S
index bb75d7a70b80..65f6289b410b 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S
@@ -40,6 +40,14 @@ ASM_PFX(__aeabi_memset):
 #  IN  UINT32  Character,
 #  IN  UINT32  Size
 #  );
+  //
+  // This object may be pulled in to satisfy an undefined reference to
+  // __aeabi_memset above, but in some cases, memset() is already provided
+  // by another library (i.e., CryptoPkg/IntrinsicLib), in which case we
+  // prefer the other version. So allow this one to be overridden by
+  // giving it weak linkage.
+  //
+  .weak   memset
 ASM_PFX(memset):
   subs ip, r2, #0
   bxeq lr
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags
  2016-08-04 14:42 [PATCH 0/3] Build fixes for ARM/OpenSSL Ard Biesheuvel
  2016-08-04 14:42 ` [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC Ard Biesheuvel
  2016-08-04 14:42 ` [PATCH 2/3] ArmPkg/CompilerIntrinsicsLib: make the default memset() weak Ard Biesheuvel
@ 2016-08-04 14:42 ` Ard Biesheuvel
  2016-08-04 16:01   ` Michael Zimmermann
  2016-08-05 14:26   ` Gao, Liming
  2016-08-05 12:53 ` [PATCH 0/3] Build fixes for ARM/OpenSSL Leif Lindholm
  3 siblings, 2 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2016-08-04 14:42 UTC (permalink / raw)
  To: yonghong.zhu, liming.gao, edk2-devel
  Cc: leif.lindholm, eugene, Ard Biesheuvel

Avoid build errors when including OpensslLib, which may throw
undefined reference errors for builtin functions if -fno-builtin
is not specified (and it is already set for IA32, X64 and AARCH64)
So set it for ARM as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 88af82a683d9..4f1dd4be378e 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4334,7 +4334,7 @@ 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 -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
+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 -fno-builtin -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
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags
  2016-08-04 14:42 ` [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags Ard Biesheuvel
@ 2016-08-04 16:01   ` Michael Zimmermann
  2016-08-05 14:34     ` Ard Biesheuvel
  2016-08-05 14:26   ` Gao, Liming
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Zimmermann @ 2016-08-04 16:01 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Yonghong Zhu, Gao, Liming, edk2-devel@lists.01.org, Leif Lindholm,
	eugene

not directly related but could we add nostdinc too? At least for my
platform that works perfectly and it prevents you from accidentally
including any libc/libgcc/whatever headers from your toolchain.(nostdlib is
already enabled)

Thanks
Michael

On Thu, Aug 4, 2016 at 4:42 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
wrote:

> Avoid build errors when including OpensslLib, which may throw
> undefined reference errors for builtin functions if -fno-builtin
> is not specified (and it is already set for IA32, X64 and AARCH64)
> So set it for ARM as well.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  BaseTools/Conf/tools_def.template | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.
> template
> index 88af82a683d9..4f1dd4be378e 100644
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -4334,7 +4334,7 @@ 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 -funsigned-char
> -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address
> -mthumb -mfloat-abi=soft
> +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 -fno-builtin
> -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
> --
> 2.7.4
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] Build fixes for ARM/OpenSSL
  2016-08-04 14:42 [PATCH 0/3] Build fixes for ARM/OpenSSL Ard Biesheuvel
                   ` (2 preceding siblings ...)
  2016-08-04 14:42 ` [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags Ard Biesheuvel
@ 2016-08-05 12:53 ` Leif Lindholm
  3 siblings, 0 replies; 14+ messages in thread
From: Leif Lindholm @ 2016-08-05 12:53 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Yonghong Zhu, Gao, Liming, edk2-devel (edk2-devel@lists.01.org),
	Cohen, Eugene

I'm happy with these changes.
For the series:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

On 4 August 2016 at 15:42, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> This series addresses some issues that cause the build to be broken
> for ARM GCC5 at the moment when including OpensslLib in the build.
>
> Ard Biesheuvel (3):
>   ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
>   ArmPkg/CompilerIntrinsicsLib: make the default memset() weak
>   BaseTools GCC/ARM: add -fno-builtin to CC flags
>
>  ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf | 2 +-
>  ArmPkg/Library/CompilerIntrinsicsLib/Arm/memset.S  | 8 ++++++++
>  BaseTools/Conf/tools_def.template                  | 2 +-
>  3 files changed, 10 insertions(+), 2 deletions(-)
>
> --
> 2.7.4
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags
  2016-08-04 14:42 ` [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags Ard Biesheuvel
  2016-08-04 16:01   ` Michael Zimmermann
@ 2016-08-05 14:26   ` Gao, Liming
  2016-08-05 14:33     ` Ard Biesheuvel
  1 sibling, 1 reply; 14+ messages in thread
From: Gao, Liming @ 2016-08-05 14:26 UTC (permalink / raw)
  To: Ard Biesheuvel, Zhu, Yonghong, edk2-devel@lists.01.org
  Cc: leif.lindholm@linaro.org, eugene@hp.com

Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] 
Sent: Thursday, August 4, 2016 10:43 PM
To: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>; edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org; eugene@hp.com; Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags

Avoid build errors when including OpensslLib, which may throw
undefined reference errors for builtin functions if -fno-builtin
is not specified (and it is already set for IA32, X64 and AARCH64)
So set it for ARM as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 88af82a683d9..4f1dd4be378e 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4334,7 +4334,7 @@ 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 -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
+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 -fno-builtin -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
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags
  2016-08-05 14:26   ` Gao, Liming
@ 2016-08-05 14:33     ` Ard Biesheuvel
  0 siblings, 0 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2016-08-05 14:33 UTC (permalink / raw)
  To: Gao, Liming
  Cc: Zhu, Yonghong, edk2-devel@lists.01.org, leif.lindholm@linaro.org,
	eugene@hp.com

On 5 August 2016 at 16:26, Gao, Liming <liming.gao@intel.com> wrote:
> Reviewed-by: Liming Gao <liming.gao@intel.com>
>

Thanks all

Pushed as

59ceaa0a871d ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
f8c51389c6db ArmPkg/CompilerIntrinsicsLib: make the default memset() weak
0667e985270b BaseTools GCC/ARM: add -fno-builtin to CC flags


> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Thursday, August 4, 2016 10:43 PM
> To: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>; edk2-devel@lists.01.org
> Cc: leif.lindholm@linaro.org; eugene@hp.com; Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Subject: [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags
>
> Avoid build errors when including OpensslLib, which may throw
> undefined reference errors for builtin functions if -fno-builtin
> is not specified (and it is already set for IA32, X64 and AARCH64)
> So set it for ARM as well.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  BaseTools/Conf/tools_def.template | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
> index 88af82a683d9..4f1dd4be378e 100644
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -4334,7 +4334,7 @@ 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 -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
> +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 -fno-builtin -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
> --
> 2.7.4
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags
  2016-08-04 16:01   ` Michael Zimmermann
@ 2016-08-05 14:34     ` Ard Biesheuvel
  0 siblings, 0 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2016-08-05 14:34 UTC (permalink / raw)
  To: Michael Zimmermann
  Cc: Yonghong Zhu, Gao, Liming, edk2-devel@lists.01.org, Leif Lindholm,
	Cohen, Eugene

On 4 August 2016 at 18:01, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
> not directly related but could we add nostdinc too? At least for my platform
> that works perfectly and it prevents you from accidentally including any
> libc/libgcc/whatever headers from your toolchain.(nostdlib is already
> enabled)
>

That sounds like a sensible idea, yes.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
  2016-08-04 14:42 ` [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC Ard Biesheuvel
@ 2016-08-06 14:18   ` Michael Zimmermann
  2016-08-06 14:42     ` Ard Biesheuvel
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Zimmermann @ 2016-08-06 14:18 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Yonghong Zhu, Gao, Liming, edk2-devel@lists.01.org, Leif Lindholm,
	eugene

StdLib/LibC/Softfloat/Softfloat.inf and StdLib/LibC/LibC.inf need this
flags too.

Thanks
Michael

On Thu, Aug 4, 2016 at 4:42 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
wrote:

> 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(-)
>
> 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
> --
> 2.7.4
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
  2016-08-06 14:18   ` Michael Zimmermann
@ 2016-08-06 14:42     ` Ard Biesheuvel
  2016-08-06 14:53       ` Michael Zimmermann
  0 siblings, 1 reply; 14+ messages in thread
From: Ard Biesheuvel @ 2016-08-06 14:42 UTC (permalink / raw)
  To: Michael Zimmermann
  Cc: Yonghong Zhu, Gao, Liming, edk2-devel@lists.01.org, Leif Lindholm,
	Cohen, Eugene

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?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
  2016-08-06 14:42     ` Ard Biesheuvel
@ 2016-08-06 14:53       ` Michael Zimmermann
  2016-08-07  9:28         ` Michael Zimmermann
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Zimmermann @ 2016-08-06 14:53 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Yonghong Zhu, Gao, Liming, edk2-devel@lists.01.org, Leif Lindholm,
	Cohen, Eugene

not sure since I only tested it for ARM this time.
these are the failing objects:
SoftFloat:
ld: __aeabi_dcmpeq.obj: plugin needed to handle lto object
ld: __aeabi_fcmpeq.obj: plugin needed to handle lto object
ld: __aeabi_dcmpge.obj: plugin needed to handle lto object
ld: __aeabi_fcmpge.obj: plugin needed to handle lto object
ld: __aeabi_dcmpgt.obj: plugin needed to handle lto object
ld: __aeabi_fcmpgt.obj: plugin needed to handle lto object
ld: __aeabi_dcmple.obj: plugin needed to handle lto object
ld: __aeabi_fcmple.obj: plugin needed to handle lto object
ld: __aeabi_dcmplt.obj: plugin needed to handle lto object
ld: __aeabi_fcmplt.obj: plugin needed to handle lto object

LibC:
ld: fixunsdfsi.obj: plugin needed to handle lto object
ld: fixunssfsi.obj: plugin needed to handle lto object
ld: floatunsidf.obj: plugin needed to handle lto object
ld: floatunsisf.obj: plugin needed to handle lto object

Thanks
Michael

On Sat, Aug 6, 2016 at 4:42 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
wrote:

> 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?
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
  2016-08-06 14:53       ` Michael Zimmermann
@ 2016-08-07  9:28         ` Michael Zimmermann
  2016-08-07 10:29           ` Ard Biesheuvel
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Zimmermann @ 2016-08-07  9:28 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Yonghong Zhu, Gao, Liming, edk2-devel@lists.01.org, Leif Lindholm,
	Cohen, Eugene

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 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?

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.

Thanks
Michael

On Sat, Aug 6, 2016 at 4:53 PM, Michael Zimmermann <sigmaepsilon92@gmail.com
> wrote:

> not sure since I only tested it for ARM this time.
> these are the failing objects:
> SoftFloat:
> ld: __aeabi_dcmpeq.obj: plugin needed to handle lto object
> ld: __aeabi_fcmpeq.obj: plugin needed to handle lto object
> ld: __aeabi_dcmpge.obj: plugin needed to handle lto object
> ld: __aeabi_fcmpge.obj: plugin needed to handle lto object
> ld: __aeabi_dcmpgt.obj: plugin needed to handle lto object
> ld: __aeabi_fcmpgt.obj: plugin needed to handle lto object
> ld: __aeabi_dcmple.obj: plugin needed to handle lto object
> ld: __aeabi_fcmple.obj: plugin needed to handle lto object
> ld: __aeabi_dcmplt.obj: plugin needed to handle lto object
> ld: __aeabi_fcmplt.obj: plugin needed to handle lto object
>
> LibC:
> ld: fixunsdfsi.obj: plugin needed to handle lto object
> ld: fixunssfsi.obj: plugin needed to handle lto object
> ld: floatunsidf.obj: plugin needed to handle lto object
> ld: floatunsisf.obj: plugin needed to handle lto object
>
> Thanks
> Michael
>
> On Sat, Aug 6, 2016 at 4:42 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> wrote:
>
>> 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?
>>
>
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC
  2016-08-07  9:28         ` Michael Zimmermann
@ 2016-08-07 10:29           ` Ard Biesheuvel
  0 siblings, 0 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2016-08-07 10:29 UTC (permalink / raw)
  To: Michael Zimmermann
  Cc: Yonghong Zhu, Gao, Liming, edk2-devel@lists.01.org, Leif Lindholm,
	Cohen, Eugene

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.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-08-07 10:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-04 14:42 [PATCH 0/3] Build fixes for ARM/OpenSSL Ard Biesheuvel
2016-08-04 14:42 ` [PATCH 1/3] ArmPkg/ArmSoftFloatLib: disable LTO build for GCC Ard Biesheuvel
2016-08-06 14:18   ` Michael Zimmermann
2016-08-06 14:42     ` Ard Biesheuvel
2016-08-06 14:53       ` Michael Zimmermann
2016-08-07  9:28         ` Michael Zimmermann
2016-08-07 10:29           ` Ard Biesheuvel
2016-08-04 14:42 ` [PATCH 2/3] ArmPkg/CompilerIntrinsicsLib: make the default memset() weak Ard Biesheuvel
2016-08-04 14:42 ` [PATCH 3/3] BaseTools GCC/ARM: add -fno-builtin to CC flags Ard Biesheuvel
2016-08-04 16:01   ` Michael Zimmermann
2016-08-05 14:34     ` Ard Biesheuvel
2016-08-05 14:26   ` Gao, Liming
2016-08-05 14:33     ` Ard Biesheuvel
2016-08-05 12:53 ` [PATCH 0/3] Build fixes for ARM/OpenSSL Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox