ext-toolchain: Automatically set -m64 if the architecture is x86_64
PATCH 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>
Without the -m64, choosing the x86_64 architecture with a Sourcery external toolchain will result in a 32-bit rootfs.
---
This patch comes on top of ThomasP's external toolchain updates
http://free-electrons.com/~thomas/buildroot.git for-2012.02/ext-toolchain-updates (Without those updates, the Sourcery x86 toolchain simply doesn't work, because it creates 32-bit executables but the libc installed on the target is 64-bit.)
Thomas, it would be great if you could add this patch to your branch.
Regards,
Arnout
--- toolchain/toolchain-external/Config.in | 24 +++---------------- toolchain/toolchain-external/ext-tool.mk | 4 +++ .../toolchain-external/ext-toolchain-wrapper.c | 3 ++ 3 files changed, 11 insertions(+), 20 deletions(-)
toolchain/toolchain-external/Config.in +4 -20
@@ -341,16 +341,8 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109 Sourcery CodeBench toolchain for the x86/x86_64 architectures, from Mentor Graphics. It uses gcc 4.6.1, binutils 2.21.53, glibc 2.13, gdb 7.2.50 and kernel headers - 3.0.1. It has support for the following variants: - - Intel Pentium 4, glibc, 32 bits - Default, nothing special to do. - - Intel Atom, glibc, 32 bits - Select an Atom core - - Intel Xeon, glibc, 64 bits - Set BR2_TARGET_OPTIMIZATION to -m64 - - Intel Core 2, glibc, 64 bits - Select a Core 2 core - Set BR2_TARGET_OPTIMIZATION to -m64 + 3.0.1. It has support for all the i386 and x86_64 variants + mentioned in the Target Architecture Variant menu. config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201009 bool "Sourcery CodeBench x86/x86_64 2010.09"
@@ -361,16 +353,8 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201009 Sourcery CodeBench toolchain for the x86/x86_64 architectures, from Mentor Graphics. It uses gcc 4.5.1, binutils 2.20, glibc 2.11, gdb 7.2.50 and kernel headers - 2.6.35.2. It has support for the following variants: - - Intel Pentium 4, glibc, 32 bits - Default, nothing special to do. - - Intel Atom, glibc, 32 bits - Select an Atom core - - Intel Xeon, glibc, 64 bits - Set BR2_TARGET_OPTIMIZATION to -m64 - - Intel Core 2, glibc, 64 bits - Select a Core 2 core - Set BR2_TARGET_OPTIMIZATION to -m64 + 2.6.35.2. It has support for all the i386 and x86_64 variants + mentioned in the Target Architecture Variant menu. config BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1 bool "Blackfin.uclinux.org 2011R1-RC4"
toolchain/toolchain-external/ext-tool.mk +4 -0
@@ -133,6 +133,10 @@ CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI)) # march/mtune/floating point mode needs to be passed to the external toolchain # to select the right multilib variant +ifeq ($(call qstrip,$(BR2_ARCH_IS_64)),y) +TOOLCHAIN_EXTERNAL_CFLAGS += -m64 +TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_64 +endif ifneq ($(CC_TARGET_TUNE_),) TOOLCHAIN_EXTERNAL_CFLAGS += -mtune=$(CC_TARGET_TUNE_) TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_TUNE='"$(CC_TARGET_TUNE_)"'
toolchain/toolchain-external/ext-toolchain-wrapper.c +3 -0
@@ -40,6 +40,9 @@ static char *predef_args[] = {#ifdef BR_VFPFLOAT "-mfpu=vfp",#endif /* BR_VFPFLOAT */ +#ifdef BR_64 + "-m64", +#endif #ifdef BR_ADDITIONAL_CFLAGS BR_ADDITIONAL_CFLAGS#endif
Signature · 1 line
1.7.8.3
PATCH 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
Le Sat, 21 Jan 2012 19:04:43 +0100,
"Arnout Vandecappelle (Essensium/Mind)" <[email protected]> a ?crit :
Quoted 6 lines
From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>
Without the -m64, choosing the
x86_64architecture with a Sourcery external toolchain will result in a 32-bit rootfs.
Quoted 8 lines
---
This patch comes on top of ThomasP's external toolchain updates
http://free-electrons.com/~thomas/buildroot.git
for-2012.02/ext-toolchain-updates (Without those updates, the Sourcery x86 toolchain simply doesn't work, because it creates 32-bit executables but the libc installed on the target is 64-bit.)Thomas, it would be great if you could add this patch to your branch.
Looks good. I'll integrate it in my branch and repost the whole branch soon.
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
In reply to Arnout Vandecappelle (Essensium/Mind)Hello Arnout,
Coming back to this patch, I had a closer look this week-end as I wanted to integrate it, but I have some comments.
Quoted 9 lines
toolchain/toolchain-external/Config.in +0
-0@@ -341,16 +341,8 @@ config
BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109Sourcery CodeBench toolchain for the x86/x86_64 architectures, from Mentor Graphics. It uses gcc 4.6.1, binutils 2.21.53, glibc 2.13, gdb 7.2.50 and kernel headerstoolchain/toolchain-external/Config.in +0
-2- 3.0.1. It has support for the following variants: - - Intel Pentium 4, glibc, 32 bits
toolchain/toolchain-external/Config.in config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109 · line 345
Quoted 10 lines
toolchain/toolchain-external/Config.in +2
-8- Default, nothing special to do. - - Intel Atom, glibc, 32 bits - Select an Atom core - - Intel Xeon, glibc, 64 bits - Set BR2_TARGET_OPTIMIZATION to -m64 - - Intel Core 2, glibc, 64 bits - Select a Core 2 core - Set BR2_TARGET_OPTIMIZATION to -m64 + 3.0.1. It has support for all the i386 and x86_64 variants + mentioned in the Target Architecture Variant menu.
I disagree with this change. If you select "i386" or "i486" as the Target Architecture Variant, then this Sourcery CodeBench toolchain will not work: it only has libc variants for Pentium 4, Atom, Xeon and Core 2, so if you try to use it on something older than Pentium 4, it might use nonexistent instructions.
Can you explain why you made this change, or revert it?
toolchain/toolchain-external/Config.in
Quoted 4 lines
toolchain/toolchain-external/Config.in +4
-0+ifeq ($(call qstrip,$(BR2_ARCH_IS_64)),y) +TOOLCHAIN_EXTERNAL_CFLAGS += -m64 +TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_64 +endif
I don't agree here. -m64 is not an option that exists for all 64-bits architectures. For example, it does not exist on MIPS. -m64 is part of the architecture-specific options of gcc, so your change should rather be:
ifeq ($(BR2_x86_64),y)TOOLCHAIN_EXTERNAL_CFLAGS += -m64TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_64
endif
(The 'qstrip' is useless)
Regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
Quoted 4 lines · On Monday 05 March 2012 11:12:46 Thomas Petazzoni wrote:
Hello Arnout,
Coming back to this patch, I had a closer look this week-end as I wanted to integrate it, but I have some comments.
This mail slipped through the cracks somehow...
Quoted 17 lines
Quoted 17 lines
toolchain/toolchain-external/Config.in +0
-0@@ -341,16 +341,8 @@ config
BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109Sourcery CodeBench toolchain for the x86/x86_64 architectures, from Mentor Graphics. It uses gcc 4.6.1, binutils 2.21.53, glibc 2.13, gdb 7.2.50 and kernel headerstoolchain/toolchain-external/Config.in +0
-10- 3.0.1. It has support for the following variants: - - Intel Pentium 4, glibc, 32 bits - Default, nothing special to do. - - Intel Atom, glibc, 32 bits - Select an Atom core - - Intel Xeon, glibc, 64 bits - Set BR2_TARGET_OPTIMIZATION to -m64 - - Intel Core 2, glibc, 64 bits - Select a Core 2 core - Set BR2_TARGET_OPTIMIZATION to -m64
Quoted 8 lines
toolchain/toolchain-external/Config.in config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109 · line 345
Quoted 2 lines
toolchain/toolchain-external/Config.in +2
-0+ 3.0.1. It has support for all the i386 and x86_64 variants + mentioned in the Target Architecture Variant menu.I disagree with this change. If you select "i386" or "i486" as the Target Architecture Variant, then this Sourcery CodeBench toolchain will not work: it only has libc variants for Pentium 4, Atom, Xeon and Core 2, so if you try to use it on something older than Pentium 4, it might use nonexistent instructions.
Ah, I hadn't thought of the pre-P4 variants.
Quoted 1 line
Can you explain why you made this change, or revert it?
My customer, after reading this help text, thought that it wouldn't work
on his Athlon processor. And the same would go for Celerons and whatnot. So instead of enumerating all of them, I thought I'd simplify the help text. And the second part of the patch removed the necessity of the -m64 option so that didn't need to be mentioned anymore either.
Quoted 10 lines
toolchain/toolchain-external/Config.in
Quoted 4 lines
toolchain/toolchain-external/Config.in +4
-0+ifeq ($(call qstrip,$(BR2_ARCH_IS_64)),y) +TOOLCHAIN_EXTERNAL_CFLAGS += -m64 +TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_64 +endifI don't agree here. -m64 is not an option that exists for all 64-bits architectures. For example, it does not exist on MIPS. -m64 is part of the architecture-specific options of gcc, so your change should rather be:
Quoted 4 lines
ifeq ($(BR2_x86_64),y)
TOOLCHAIN_EXTERNAL_CFLAGS+= -m64TOOLCHAIN_EXTERNAL_WRAPPER_ARGS+= -DBR_64
endif
OK.
Quoted 1 line
(The 'qstrip' is useless)
Didn't know that then, but I know it now :-)
Regards,
Arnout
Signature · 9 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120313/0cdc179f/attachment-0001.html>
PATCH 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
Le Tue, 13 Mar 2012 22:55:08 +0100,
Arnout Vandecappelle <[email protected]> a ?crit :
Quoted 6 lines
Quoted 5 lines
I disagree with this change. If you select "i386" or "i486" as the Target Architecture Variant, then this Sourcery CodeBench toolchain will not work: it only has libc variants for Pentium 4, Atom, Xeon and Core 2, so if you try to use it on something older than Pentium 4, it might use nonexistent instructions.
Quoted 8 lines
Ah, I hadn't thought of the pre-P4 variants.
Quoted 1 line
Can you explain why you made this change, or revert it?
My customer, after reading this help text, thought that it wouldn't work
on his Athlon processor. And the same would go for Celerons and whatnot. So instead of enumerating all of them, I thought I'd simplify the help text.
Well, I think it's quite important to know which multilib variants are available. Maybe we could make the wording a bit different by saying that such and such multilib variant is for processor XXX or later ?
Quoted 2 lines
And the second part of the patch removed the necessity of the
-m64 option so that didn't need to be mentioned anymore either.
Maybe, but we have the same text for other multilib variants of all toolchains, many of which require special options.
Quoted 11 lines
Quoted 9 lines
I don't agree here. -m64 is not an option that exists for all 64-bits architectures. For example, it does not exist on MIPS. -m64 is part of the architecture-specific options of gcc, so your change should rather be:
ifeq ($(BR2_x86_64),y)
TOOLCHAIN_EXTERNAL_CFLAGS+= -m64TOOLCHAIN_EXTERNAL_WRAPPER_ARGS+= -DBR_64
endifOK.
Can you respin the patch with this?
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v2 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
In reply to Thomas PetazzoniWithout the -m64, choosing the x86_64 architecture with a Sourcery external toolchain will result in a 32-bit rootfs.
Also simplified the help text to reflect this change.
---
v2: Feedback from Thomas
* Less aggressive modification of the help text.
* Make -m64 flag specific for x86_64.
Build-tested only.
toolchain/toolchain-external/Config.in | 35 +++++++++++--------- toolchain/toolchain-external/ext-tool.mk | 4 ++ .../toolchain-external/ext-toolchain-wrapper.c | 3 ++ 3 files changed, 26 insertions(+), 16 deletions(-)
toolchain/toolchain-external/Config.in +19 -16
@@ -371,14 +371,16 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109 binutils 2.21.53, glibc 2.13, gdb 7.2.50 and kernel headers 3.0.1. It has support for the following variants: - Intel Pentium 4, glibc, 32 bits - Default, nothing special to do. - - Intel Atom, glibc, 32 bits - Select an Atom core - - Intel Xeon, glibc, 64 bits - Set BR2_TARGET_OPTIMIZATION to -m64 - - Intel Core 2, glibc, 64 bits - Select a Core 2 core - Set BR2_TARGET_OPTIMIZATION to -m64 + Default for x86, nothing special to do. + - Intel Atom, glibc, 32 bits + Select an Atom core + - Intel Xeon, glibc, 64 bits + Default for x86_64, nothing special to do. + - Intel Core 2, glibc, 64 bits + Select a Core 2 core + Other architecture variants (beyond Pentium-4/Xeon) are + supported as well, but glibc is not optimised for it. + config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201009 bool "Sourcery CodeBench x86/x86_64 2010.09"
@@ -391,14 +393,15 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201009 binutils 2.20, glibc 2.11, gdb 7.2.50 and kernel headers 2.6.35.2. It has support for the following variants: - Intel Pentium 4, glibc, 32 bits - Default, nothing special to do. - - Intel Atom, glibc, 32 bits - Select an Atom core - - Intel Xeon, glibc, 64 bits - Set BR2_TARGET_OPTIMIZATION to -m64 - - Intel Core 2, glibc, 64 bits - Select a Core 2 core - Set BR2_TARGET_OPTIMIZATION to -m64 + Default for x86, nothing special to do. + - Intel Atom, glibc, 32 bits + Select an Atom core + - Intel Xeon, glibc, 64 bits + Default for x86_64, nothing special to do. + - Intel Core 2, glibc, 64 bits + Select a Core 2 core + Other architecture variants (beyond Pentium-4/Xeon) are + supported as well, but glibc is not optimised for it. config BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1 bool "Blackfin.uclinux.org 2011R1-RC4"
toolchain/toolchain-external/ext-tool.mk +4 -0
@@ -133,6 +133,10 @@ CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI)) # march/mtune/floating point mode needs to be passed to the external toolchain # to select the right multilib variant +ifeq ($(BR2_x86_64),y) +TOOLCHAIN_EXTERNAL_CFLAGS += -m64 +TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_64 +endif ifneq ($(CC_TARGET_TUNE_),) TOOLCHAIN_EXTERNAL_CFLAGS += -mtune=$(CC_TARGET_TUNE_) TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_TUNE='"$(CC_TARGET_TUNE_)"'
toolchain/toolchain-external/ext-toolchain-wrapper.c +3 -0
@@ -40,6 +40,9 @@ static char *predef_args[] = {#ifdef BR_VFPFLOAT "-mfpu=vfp",#endif /* BR_VFPFLOAT */ +#ifdef BR_64 + "-m64", +#endif #ifdef BR_ADDITIONAL_CFLAGS BR_ADDITIONAL_CFLAGS#endif
Signature · 1 line
tg: (e687bb7..) t/sourcery-x86_64 (depends on: master)
PATCH v2 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
Le Tue, 13 Mar 2012 23:30:00 +0100,
"Arnout Vandecappelle (Essensium/Mind)" <[email protected]> a ?crit :
Quoted 6 lines
Without the -m64, choosing the
x86_64architecture with a Sourcery external toolchain will result in a 32-bit rootfs.Also simplified the help text to reflect this change.
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v2 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
In reply to Arnout Vandecappelle (Essensium/Mind)Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:
Arnout> Without the -m64, choosing the x86_64 architecture with a Sourcery external Arnout> toolchain will result in a 32-bit rootfs.
Arnout> Also simplified the help text to reflect this change.
Arnout> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]> Arnout> ---
Arnout> v2: Feedback from Thomas
Arnout> * Less aggressive modification of the help text.
Arnout> * Make -m64 flag specific for x86_64.
Arnout> Build-tested only.
Arnout> toolchain/toolchain-external/Config.in | 35 +++++++++++--------- Arnout> toolchain/toolchain-external/ext-tool.mk | 4 ++ Arnout> .../toolchain-external/ext-toolchain-wrapper.c | 3 ++
Arnout> 3 files changed, 26 insertions(+), 16 deletions(-)
Arnout> diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in Arnout> index 7f57952..8c20661 100644
Arnout> --- a/toolchain/toolchain-external/Config.in
Arnout> +++ b/toolchain/toolchain-external/Config.in
Arnout> @@ -371,14 +371,16 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109
Arnout> binutils 2.21.53, glibc 2.13, gdb 7.2.50 and kernel headers Arnout> 3.0.1. It has support for the following variants: Arnout> - Intel Pentium 4, glibc, 32 bits
Arnout> - Default, nothing special to do.
Arnout> - - Intel Atom, glibc, 32 bits
Arnout> - Select an Atom core
Arnout> - - Intel Xeon, glibc, 64 bits
Arnout> - Set BR2_TARGET_OPTIMIZATION to -m64
Arnout> - - Intel Core 2, glibc, 64 bits
Arnout> - Select a Core 2 core
Arnout> - Set BR2_TARGET_OPTIMIZATION to -m64
Arnout> + Default for x86, nothing special to do.
Arnout> + - Intel Atom, glibc, 32 bits
Arnout> + Select an Atom core
Arnout> + - Intel Xeon, glibc, 64 bits
Arnout> + Default for x86_64, nothing special to do.
Arnout> + - Intel Core 2, glibc, 64 bits
Arnout> + Select a Core 2 core
Arnout> + Other architecture variants (beyond Pentium-4/Xeon) are
Arnout> + supported as well, but glibc is not optimised for it.
Arnout> +
You have some whitespace damage here, but otherwise it looks good - Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH v2 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
Quoted 1 line · On Thursday 15 March 2012 00:01:46 Peter Korsgaard wrote:
You have some whitespace damage here, but otherwise it looks good
Those were supposed to be whitespace fixes - tab + 2 spaces, right?
But I forgot to mention that in the commit message.
Regards,
Arnout
Signature · 9 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120315/7f7e4370/attachment-0001.html>
PATCH v2 1/1 ext-toolchain: Automatically set -m64 if the architecture is x86_64
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
You have some whitespace damage here, but otherwise it looks good
Arnout> Those were supposed to be whitespace fixes - tab + 2 spaces, Arnout> right?
Yes, but you also had:
+ Other architecture variants (beyond Pentium-4/Xeon) are
+ supported as well, but glibc is not optimised for it.
+
(13 spaces on the last empty line).
Signature · 1 line
Bye, Peter Korsgaard