public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x
@ 2018-12-20 11:03 Ard Biesheuvel
  2018-12-21 11:02 ` Ard Biesheuvel
  2018-12-22 12:03 ` Leif Lindholm
  0 siblings, 2 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2018-12-20 11:03 UTC (permalink / raw)
  To: edk2-devel; +Cc: leif.lindholm, liming.gao, Ard Biesheuvel

The 'arm-linux-gnueabihf' target triplet we use for CLANG35 and
CLANG38 specifies a hardfloat target, and so the binaries that are
emitted are annotated as using VFP registers for passing floating
point arguments, even though no VFP is used anywhere in the code.

This works fine as long as we don't try to link against code
that uses software floating point, but combining object files
with different floating point calling conventions is not permitted.

So switch to the softfloat arm-linux-gnueabi triplet instead.
This affects both the name Clang uses when invoking the linker,
and the arguments it passes to it, and we are mostly interested
in the latter (since any version of GNU ld.bfd will do the right
thing as long as it targets EABI ARM)

For native builds, this change has no effect, since the unprefixed
system linker will take priority, and so Clang will pass the right
arguments to whichever linker happens to be the system linker.

For cross builds, the fact that Clang composes the name of the
linker by prefixing '-ld' with the target triplet implies that
users will have to switch to a version of binutils that targets
arm-linux-gnueabi rather than arm-linux-gnueabihf. Note that the
GCCx toolchain targets can use either when building for ARM so this
does not create a need to install two versions of the ARM cross
toolchain. Also, note that all ARM toolchains in the GCC family
are already documented as requiring a toolchain that targets
arm-linux-gnueabi and not arm-linux-gnueabihf.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
v2: improve commit log

 BaseTools/Conf/tools_def.template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 902680c24c85..f7eb87af14c2 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -5231,7 +5231,7 @@ RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 *_CLANG35_*_DLINK_PATH           = ENV(CLANG35_BIN)clang
 *_CLANG35_*_ASLDLINK_PATH        = ENV(CLANG35_BIN)clang
 
-DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabihf
+DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabi
 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 -Wno-unknown-warning-option
@@ -5384,7 +5384,7 @@ NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -O0
 ##################
 # CLANG38 ARM definitions
 ##################
-DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf
+DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabi
 DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt
 DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
 
-- 
2.19.2



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

* Re: [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x
  2018-12-20 11:03 [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x Ard Biesheuvel
@ 2018-12-21 11:02 ` Ard Biesheuvel
  2018-12-21 12:51   ` Gao, Liming
  2018-12-22 12:03 ` Leif Lindholm
  1 sibling, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2018-12-21 11:02 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Leif Lindholm, Gao, Liming

On Thu, 20 Dec 2018 at 12:03, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>
> The 'arm-linux-gnueabihf' target triplet we use for CLANG35 and
> CLANG38 specifies a hardfloat target, and so the binaries that are
> emitted are annotated as using VFP registers for passing floating
> point arguments, even though no VFP is used anywhere in the code.
>
> This works fine as long as we don't try to link against code
> that uses software floating point, but combining object files
> with different floating point calling conventions is not permitted.
>
> So switch to the softfloat arm-linux-gnueabi triplet instead.
> This affects both the name Clang uses when invoking the linker,
> and the arguments it passes to it, and we are mostly interested
> in the latter (since any version of GNU ld.bfd will do the right
> thing as long as it targets EABI ARM)
>
> For native builds, this change has no effect, since the unprefixed
> system linker will take priority, and so Clang will pass the right
> arguments to whichever linker happens to be the system linker.
>
> For cross builds, the fact that Clang composes the name of the
> linker by prefixing '-ld' with the target triplet implies that
> users will have to switch to a version of binutils that targets
> arm-linux-gnueabi rather than arm-linux-gnueabihf. Note that the
> GCCx toolchain targets can use either when building for ARM so this
> does not create a need to install two versions of the ARM cross
> toolchain. Also, note that all ARM toolchains in the GCC family
> are already documented as requiring a toolchain that targets
> arm-linux-gnueabi and not arm-linux-gnueabihf.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> v2: improve commit log
>

Liming, Leif: are there any remaining concerns with this patch?


>  BaseTools/Conf/tools_def.template | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
> index 902680c24c85..f7eb87af14c2 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -5231,7 +5231,7 @@ RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>  *_CLANG35_*_DLINK_PATH           = ENV(CLANG35_BIN)clang
>  *_CLANG35_*_ASLDLINK_PATH        = ENV(CLANG35_BIN)clang
>
> -DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabihf
> +DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabi
>  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 -Wno-unknown-warning-option
> @@ -5384,7 +5384,7 @@ NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -O0
>  ##################
>  # CLANG38 ARM definitions
>  ##################
> -DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf
> +DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabi
>  DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt
>  DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
>
> --
> 2.19.2
>


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

* Re: [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x
  2018-12-21 11:02 ` Ard Biesheuvel
@ 2018-12-21 12:51   ` Gao, Liming
  0 siblings, 0 replies; 5+ messages in thread
From: Gao, Liming @ 2018-12-21 12:51 UTC (permalink / raw)
  To: Ard Biesheuvel, edk2-devel@lists.01.org

I have no other comments. Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Friday, December 21, 2018 7:02 PM
> To: edk2-devel@lists.01.org
> Cc: Leif Lindholm <leif.lindholm@linaro.org>; Gao, Liming <liming.gao@intel.com>
> Subject: Re: [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x
> 
> On Thu, 20 Dec 2018 at 12:03, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> >
> > The 'arm-linux-gnueabihf' target triplet we use for CLANG35 and
> > CLANG38 specifies a hardfloat target, and so the binaries that are
> > emitted are annotated as using VFP registers for passing floating
> > point arguments, even though no VFP is used anywhere in the code.
> >
> > This works fine as long as we don't try to link against code
> > that uses software floating point, but combining object files
> > with different floating point calling conventions is not permitted.
> >
> > So switch to the softfloat arm-linux-gnueabi triplet instead.
> > This affects both the name Clang uses when invoking the linker,
> > and the arguments it passes to it, and we are mostly interested
> > in the latter (since any version of GNU ld.bfd will do the right
> > thing as long as it targets EABI ARM)
> >
> > For native builds, this change has no effect, since the unprefixed
> > system linker will take priority, and so Clang will pass the right
> > arguments to whichever linker happens to be the system linker.
> >
> > For cross builds, the fact that Clang composes the name of the
> > linker by prefixing '-ld' with the target triplet implies that
> > users will have to switch to a version of binutils that targets
> > arm-linux-gnueabi rather than arm-linux-gnueabihf. Note that the
> > GCCx toolchain targets can use either when building for ARM so this
> > does not create a need to install two versions of the ARM cross
> > toolchain. Also, note that all ARM toolchains in the GCC family
> > are already documented as requiring a toolchain that targets
> > arm-linux-gnueabi and not arm-linux-gnueabihf.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> > v2: improve commit log
> >
> 
> Liming, Leif: are there any remaining concerns with this patch?
> 
> 
> >  BaseTools/Conf/tools_def.template | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
> > index 902680c24c85..f7eb87af14c2 100755
> > --- a/BaseTools/Conf/tools_def.template
> > +++ b/BaseTools/Conf/tools_def.template
> > @@ -5231,7 +5231,7 @@ RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
> >  *_CLANG35_*_DLINK_PATH           = ENV(CLANG35_BIN)clang
> >  *_CLANG35_*_ASLDLINK_PATH        = ENV(CLANG35_BIN)clang
> >
> > -DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabihf
> > +DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabi
> >  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 -Wno-unknown-warning-option
> > @@ -5384,7 +5384,7 @@ NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -O0
> >  ##################
> >  # CLANG38 ARM definitions
> >  ##################
> > -DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf
> > +DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabi
> >  DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET)
> DEF(CLANG38_WARNING_OVERRIDES) -mno-movt
> >  DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
> >
> > --
> > 2.19.2
> >

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

* Re: [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x
  2018-12-20 11:03 [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x Ard Biesheuvel
  2018-12-21 11:02 ` Ard Biesheuvel
@ 2018-12-22 12:03 ` Leif Lindholm
  2018-12-23 14:56   ` Ard Biesheuvel
  1 sibling, 1 reply; 5+ messages in thread
From: Leif Lindholm @ 2018-12-22 12:03 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel, liming.gao

On Thu, Dec 20, 2018 at 12:03:32PM +0100, Ard Biesheuvel wrote:
> The 'arm-linux-gnueabihf' target triplet we use for CLANG35 and
> CLANG38 specifies a hardfloat target, and so the binaries that are
> emitted are annotated as using VFP registers for passing floating
> point arguments, even though no VFP is used anywhere in the code.
> 
> This works fine as long as we don't try to link against code
> that uses software floating point, but combining object files
> with different floating point calling conventions is not permitted.
> 
> So switch to the softfloat arm-linux-gnueabi triplet instead.
> This affects both the name Clang uses when invoking the linker,
> and the arguments it passes to it, and we are mostly interested
> in the latter (since any version of GNU ld.bfd will do the right
> thing as long as it targets EABI ARM)
> 
> For native builds, this change has no effect, since the unprefixed
> system linker will take priority, and so Clang will pass the right
> arguments to whichever linker happens to be the system linker.
> 
> For cross builds, the fact that Clang composes the name of the
> linker by prefixing '-ld' with the target triplet implies that
> users will have to switch to a version of binutils that targets
> arm-linux-gnueabi rather than arm-linux-gnueabihf. Note that the
> GCCx toolchain targets can use either when building for ARM so this
> does not create a need to install two versions of the ARM cross
> toolchain. Also, note that all ARM toolchains in the GCC family
> are already documented as requiring a toolchain that targets
> arm-linux-gnueabi and not arm-linux-gnueabihf.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
> v2: improve commit log
> 
>  BaseTools/Conf/tools_def.template | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
> index 902680c24c85..f7eb87af14c2 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -5231,7 +5231,7 @@ RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
>  *_CLANG35_*_DLINK_PATH           = ENV(CLANG35_BIN)clang
>  *_CLANG35_*_ASLDLINK_PATH        = ENV(CLANG35_BIN)clang
>  
> -DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabihf
> +DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabi
>  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 -Wno-unknown-warning-option
> @@ -5384,7 +5384,7 @@ NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -O0
>  ##################
>  # CLANG38 ARM definitions
>  ##################
> -DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf
> +DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabi
>  DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt
>  DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
>  
> -- 
> 2.19.2
> 


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

* Re: [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x
  2018-12-22 12:03 ` Leif Lindholm
@ 2018-12-23 14:56   ` Ard Biesheuvel
  0 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2018-12-23 14:56 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel@lists.01.org, Gao, Liming

On Sat, 22 Dec 2018 at 13:03, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>
> On Thu, Dec 20, 2018 at 12:03:32PM +0100, Ard Biesheuvel wrote:
> > The 'arm-linux-gnueabihf' target triplet we use for CLANG35 and
> > CLANG38 specifies a hardfloat target, and so the binaries that are
> > emitted are annotated as using VFP registers for passing floating
> > point arguments, even though no VFP is used anywhere in the code.
> >
> > This works fine as long as we don't try to link against code
> > that uses software floating point, but combining object files
> > with different floating point calling conventions is not permitted.
> >
> > So switch to the softfloat arm-linux-gnueabi triplet instead.
> > This affects both the name Clang uses when invoking the linker,
> > and the arguments it passes to it, and we are mostly interested
> > in the latter (since any version of GNU ld.bfd will do the right
> > thing as long as it targets EABI ARM)
> >
> > For native builds, this change has no effect, since the unprefixed
> > system linker will take priority, and so Clang will pass the right
> > arguments to whichever linker happens to be the system linker.
> >
> > For cross builds, the fact that Clang composes the name of the
> > linker by prefixing '-ld' with the target triplet implies that
> > users will have to switch to a version of binutils that targets
> > arm-linux-gnueabi rather than arm-linux-gnueabihf. Note that the
> > GCCx toolchain targets can use either when building for ARM so this
> > does not create a need to install two versions of the ARM cross
> > toolchain. Also, note that all ARM toolchains in the GCC family
> > are already documented as requiring a toolchain that targets
> > arm-linux-gnueabi and not arm-linux-gnueabihf.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>

Thanks all

Pushed as 559a07d84e5a..41203b9ab5d4


> > ---
> > v2: improve commit log
> >
> >  BaseTools/Conf/tools_def.template | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
> > index 902680c24c85..f7eb87af14c2 100755
> > --- a/BaseTools/Conf/tools_def.template
> > +++ b/BaseTools/Conf/tools_def.template
> > @@ -5231,7 +5231,7 @@ RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
> >  *_CLANG35_*_DLINK_PATH           = ENV(CLANG35_BIN)clang
> >  *_CLANG35_*_ASLDLINK_PATH        = ENV(CLANG35_BIN)clang
> >
> > -DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabihf
> > +DEFINE CLANG35_ARM_TARGET        = -target arm-linux-gnueabi
> >  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 -Wno-unknown-warning-option
> > @@ -5384,7 +5384,7 @@ NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -O0
> >  ##################
> >  # CLANG38 ARM definitions
> >  ##################
> > -DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf
> > +DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabi
> >  DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt
> >  DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
> >
> > --
> > 2.19.2
> >


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

end of thread, other threads:[~2018-12-23 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20 11:03 [PATCH v2] BaseTools/tools_def ARM: use softfloat target for CLANG3x Ard Biesheuvel
2018-12-21 11:02 ` Ard Biesheuvel
2018-12-21 12:51   ` Gao, Liming
2018-12-22 12:03 ` Leif Lindholm
2018-12-23 14:56   ` Ard Biesheuvel

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