This patch gives OpenBIOS users the ability to specify their own compiler prefix. It can be used by just adding PREFIX=<your prefix> right before the switch-arch command. Example: PREFIX=ppc-elf- ./switch-arch ppc
Signed-off-by: John Arbuckle programmingkidx@gmail.com
Index: config/scripts/switch-arch =================================================================== --- config/scripts/switch-arch (revision 1335) +++ config/scripts/switch-arch (working copy) @@ -99,6 +99,13 @@
select_prefix() { + # if the user specified the prefix like this: PREFIX=ppc-elf- ./switch-arch ppc + if [ $PREFIX ] + then + TARGET=$PREFIX + return + fi + for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi- do if type ${TARGET}gcc > /dev/null 2>&1
On 29/04/15 14:57, Programmingkid wrote:
This patch gives OpenBIOS users the ability to specify their own compiler prefix. It can be used by just adding PREFIX=<your prefix> right before the switch-arch command. Example: PREFIX=ppc-elf- ./switch-arch ppc
Signed-off-by: John Arbuckle <programmingkidx@gmail.com mailto:programmingkidx@gmail.com>
Index: config/scripts/switch-arch
--- config/scripts/switch-arch(revision 1335) +++ config/scripts/switch-arch(working copy) @@ -99,6 +99,13 @@
select_prefix() {
- # if the user specified the prefix like this: PREFIX=ppc-elf-
./switch-arch ppc
- if [ $PREFIX ]
- then
TARGET=$PREFIX
return
- fi
- for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux-
${1}-elf- ${1}-eabi- do if type ${TARGET}gcc > /dev/null 2>&1
Any reason why you couldn't simply just add $PREFIX to the end of the "for TARGET in ...." line? And thinking about it further, the name PREFIX itself could be a bit vague so maybe CCPREFIX is a better name?
ATB,
Mark. (also it looks as if your mail has switched to HTML again?)
On Thu, Apr 30, 2015 at 12:14:10PM +0100, Mark Cave-Ayland wrote:
On 29/04/15 14:57, Programmingkid wrote:
This patch gives OpenBIOS users the ability to specify their own compiler prefix. It can be used by just adding PREFIX=<your prefix> right before the switch-arch command. Example: PREFIX=ppc-elf- ./switch-arch ppc
Signed-off-by: John Arbuckle <programmingkidx@gmail.com mailto:programmingkidx@gmail.com>
Index: config/scripts/switch-arch
--- config/scripts/switch-arch(revision 1335) +++ config/scripts/switch-arch(working copy) @@ -99,6 +99,13 @@
select_prefix() {
- # if the user specified the prefix like this: PREFIX=ppc-elf-
./switch-arch ppc
- if [ $PREFIX ]
- then
TARGET=$PREFIX
return
- fi
- for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux-
${1}-elf- ${1}-eabi- do if type ${TARGET}gcc > /dev/null 2>&1
Any reason why you couldn't simply just add $PREFIX to the end of the "for TARGET in ...." line? And thinking about it further, the name PREFIX itself could be a bit vague so maybe CCPREFIX is a better name?
PREFIX sure could be confused with the installation path prefix.
I like the CROSS_COMPILER variable that the linux kernel and some other projects use.
I do find it inconvinient that it always seems that whatever prefix you specify has gcc appended to it given all my cross compilers have gcc-version at the end of their name. That's just how Debian has generated them for years.
On Apr 30, 2015, at 8:22 AM, Lennart Sorensen wrote:
On Thu, Apr 30, 2015 at 12:14:10PM +0100, Mark Cave-Ayland wrote:
On 29/04/15 14:57, Programmingkid wrote:
This patch gives OpenBIOS users the ability to specify their own compiler prefix. It can be used by just adding PREFIX=<your prefix> right before the switch-arch command. Example: PREFIX=ppc-elf- ./switch-arch ppc
Signed-off-by: John Arbuckle <programmingkidx@gmail.com mailto:programmingkidx@gmail.com>
Index: config/scripts/switch-arch
--- config/scripts/switch-arch(revision 1335) +++ config/scripts/switch-arch(working copy) @@ -99,6 +99,13 @@
select_prefix() {
- # if the user specified the prefix like this: PREFIX=ppc-elf-
./switch-arch ppc
- if [ $PREFIX ]
- then
TARGET=$PREFIX
return
- fi
- for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux-
${1}-elf- ${1}-eabi- do if type ${TARGET}gcc > /dev/null 2>&1
Any reason why you couldn't simply just add $PREFIX to the end of the "for TARGET in ...." line? And thinking about it further, the name PREFIX itself could be a bit vague so maybe CCPREFIX is a better name?
PREFIX sure could be confused with the installation path prefix.
I like the CROSS_COMPILER variable that the linux kernel and some other projects use.
I do find it inconvinient that it always seems that whatever prefix you specify has gcc appended to it given all my cross compilers have gcc-version at the end of their name. That's just how Debian has generated them for years.
Apple does the same thing. If it were up to me, I would just use an option like -compiler_name and be done with it. It would be used like this:
./switch-arch ppc -compiler_name powerpc-apple-darwin10-gcc-4.0.1
It's almost too easy.
[ I didn't see this part of the thread before, sorry... Well, this separate thread of the thread, heh. ]
On Thu, Apr 30, 2015 at 08:22:46AM -0400, Lennart Sorensen wrote:
PREFIX sure could be confused with the installation path prefix.
I like the CROSS_COMPILER variable that the linux kernel and some other projects use.
I do find it inconvinient that it always seems that whatever prefix you specify has gcc appended to it given all my cross compilers have gcc-version at the end of their name. That's just how Debian has generated them for years.
GCC itself generates *both* e.g. powerpc-linux-gcc-4.9.0 and powerpc-linux-gcc. Debian has no way to set that to the version you want to use? How inconvenient. You can make an alias of course ;-)
Segher
On Thu, Apr 30, 2015 at 05:26:50PM -0500, Segher Boessenkool wrote:
[ I didn't see this part of the thread before, sorry... Well, this separate thread of the thread, heh. ]
On Thu, Apr 30, 2015 at 08:22:46AM -0400, Lennart Sorensen wrote:
PREFIX sure could be confused with the installation path prefix.
I like the CROSS_COMPILER variable that the linux kernel and some other projects use.
I do find it inconvinient that it always seems that whatever prefix you specify has gcc appended to it given all my cross compilers have gcc-version at the end of their name. That's just how Debian has generated them for years.
GCC itself generates *both* e.g. powerpc-linux-gcc-4.9.0 and powerpc-linux-gcc. Debian has no way to set that to the version you want to use? How inconvenient. You can make an alias of course ;-)
Well I can make a symlink, but certainly in the past (wheezy and older), when you build the cross compiler from the debian gcc source package, you get architecture-gcc-version as the binary. It used to be they used alternatives to setup a symlink to one of the versions installed for the cross compiler, but they got rid of that (which I don't really miss because I found it always picked the wrong one by default somehow).
But I don't expect any build scripts to deal with that (certainly the linux kernel doesn't), and there are perfectly simple ways around the problem.
On 01/05/15 14:38, Lennart Sorensen wrote:
On Thu, Apr 30, 2015 at 05:26:50PM -0500, Segher Boessenkool wrote:
[ I didn't see this part of the thread before, sorry... Well, this separate thread of the thread, heh. ]
On Thu, Apr 30, 2015 at 08:22:46AM -0400, Lennart Sorensen wrote:
PREFIX sure could be confused with the installation path prefix.
I like the CROSS_COMPILER variable that the linux kernel and some other projects use.
I do find it inconvinient that it always seems that whatever prefix you specify has gcc appended to it given all my cross compilers have gcc-version at the end of their name. That's just how Debian has generated them for years.
GCC itself generates *both* e.g. powerpc-linux-gcc-4.9.0 and powerpc-linux-gcc. Debian has no way to set that to the version you want to use? How inconvenient. You can make an alias of course ;-)
Well I can make a symlink, but certainly in the past (wheezy and older), when you build the cross compiler from the debian gcc source package, you get architecture-gcc-version as the binary. It used to be they used alternatives to setup a symlink to one of the versions installed for the cross compiler, but they got rid of that (which I don't really miss because I found it always picked the wrong one by default somehow).
But I don't expect any build scripts to deal with that (certainly the linux kernel doesn't), and there are perfectly simple ways around the problem.
Just to recap then - if we use CROSS_COMPILE rather than CROSS_COMPILER and add it to the start of the list then everyone is in agreement?
ATB,
Mark.
On Fri, May 08, 2015 at 02:09:16PM +0100, Mark Cave-Ayland wrote:
On 01/05/15 14:38, Lennart Sorensen wrote:
On Thu, Apr 30, 2015 at 05:26:50PM -0500, Segher Boessenkool wrote:
[ I didn't see this part of the thread before, sorry... Well, this separate thread of the thread, heh. ]
On Thu, Apr 30, 2015 at 08:22:46AM -0400, Lennart Sorensen wrote:
PREFIX sure could be confused with the installation path prefix.
I like the CROSS_COMPILER variable that the linux kernel and some other projects use.
I do find it inconvinient that it always seems that whatever prefix you specify has gcc appended to it given all my cross compilers have gcc-version at the end of their name. That's just how Debian has generated them for years.
GCC itself generates *both* e.g. powerpc-linux-gcc-4.9.0 and powerpc-linux-gcc. Debian has no way to set that to the version you want to use? How inconvenient. You can make an alias of course ;-)
Well I can make a symlink, but certainly in the past (wheezy and older), when you build the cross compiler from the debian gcc source package, you get architecture-gcc-version as the binary. It used to be they used alternatives to setup a symlink to one of the versions installed for the cross compiler, but they got rid of that (which I don't really miss because I found it always picked the wrong one by default somehow).
But I don't expect any build scripts to deal with that (certainly the linux kernel doesn't), and there are perfectly simple ways around the problem.
Just to recap then - if we use CROSS_COMPILE rather than CROSS_COMPILER and add it to the start of the list then everyone is in agreement?
I think people can legitimately argue that if someone specifies CROSS_COMPILE then that is what they want to use, and you should NOT go looking at other options at all that might exist in that case.
After all if I make a typo in my CROSS_COMPILE line I would rather get an error that it can't find that compiler, than have it run of and find some other cross compiler I have installed and use that.
So probably the correct thing would be:
if CROSS_COMPILE is set then use CROSS_COMPILE else do the list search instead.
On May 8, 2015, at 9:57 AM, Lennart Sorensen wrote:
On Fri, May 08, 2015 at 02:09:16PM +0100, Mark Cave-Ayland wrote:
On 01/05/15 14:38, Lennart Sorensen wrote:
On Thu, Apr 30, 2015 at 05:26:50PM -0500, Segher Boessenkool wrote:
[ I didn't see this part of the thread before, sorry... Well, this separate thread of the thread, heh. ]
On Thu, Apr 30, 2015 at 08:22:46AM -0400, Lennart Sorensen wrote:
PREFIX sure could be confused with the installation path prefix.
I like the CROSS_COMPILER variable that the linux kernel and some other projects use.
I do find it inconvinient that it always seems that whatever prefix you specify has gcc appended to it given all my cross compilers have gcc-version at the end of their name. That's just how Debian has generated them for years.
GCC itself generates *both* e.g. powerpc-linux-gcc-4.9.0 and powerpc-linux-gcc. Debian has no way to set that to the version you want to use? How inconvenient. You can make an alias of course ;-)
Well I can make a symlink, but certainly in the past (wheezy and older), when you build the cross compiler from the debian gcc source package, you get architecture-gcc-version as the binary. It used to be they used alternatives to setup a symlink to one of the versions installed for the cross compiler, but they got rid of that (which I don't really miss because I found it always picked the wrong one by default somehow).
But I don't expect any build scripts to deal with that (certainly the linux kernel doesn't), and there are perfectly simple ways around the problem.
Just to recap then - if we use CROSS_COMPILE rather than CROSS_COMPILER and add it to the start of the list then everyone is in agreement?
I think people can legitimately argue that if someone specifies CROSS_COMPILE then that is what they want to use, and you should NOT go looking at other options at all that might exist in that case.
After all if I make a typo in my CROSS_COMPILE line I would rather get an error that it can't find that compiler, than have it run of and find some other cross compiler I have installed and use that.
So probably the correct thing would be:
if CROSS_COMPILE is set then use CROSS_COMPILE else do the list search instead.
That could work.
Using CROSS_COMPILE instead of CROSS_COMPILER doesn't seem right. CROSS_COMPILER refers to a program. CROSS_COMPILE seems to refer to a process. It seems better and more accurate to say CROSS_COMPILER.
Thank you for your comments.
On Fri, May 08, 2015 at 11:18:24AM -0400, Programmingkid wrote:
On May 8, 2015, at 9:57 AM, Lennart Sorensen wrote:
On Fri, May 08, 2015 at 02:09:16PM +0100, Mark Cave-Ayland wrote:
On 01/05/15 14:38, Lennart Sorensen wrote:
On Thu, Apr 30, 2015 at 05:26:50PM -0500, Segher Boessenkool wrote:
[ I didn't see this part of the thread before, sorry... Well, this separate thread of the thread, heh. ]
On Thu, Apr 30, 2015 at 08:22:46AM -0400, Lennart Sorensen wrote:
PREFIX sure could be confused with the installation path prefix.
I like the CROSS_COMPILER variable that the linux kernel and some other projects use.
I do find it inconvinient that it always seems that whatever prefix you specify has gcc appended to it given all my cross compilers have gcc-version at the end of their name. That's just how Debian has generated them for years.
GCC itself generates *both* e.g. powerpc-linux-gcc-4.9.0 and powerpc-linux-gcc. Debian has no way to set that to the version you want to use? How inconvenient. You can make an alias of course ;-)
Well I can make a symlink, but certainly in the past (wheezy and older), when you build the cross compiler from the debian gcc source package, you get architecture-gcc-version as the binary. It used to be they used alternatives to setup a symlink to one of the versions installed for the cross compiler, but they got rid of that (which I don't really miss because I found it always picked the wrong one by default somehow).
But I don't expect any build scripts to deal with that (certainly the linux kernel doesn't), and there are perfectly simple ways around the problem.
Just to recap then - if we use CROSS_COMPILE rather than CROSS_COMPILER and add it to the start of the list then everyone is in agreement?
I think people can legitimately argue that if someone specifies CROSS_COMPILE then that is what they want to use, and you should NOT go looking at other options at all that might exist in that case.
After all if I make a typo in my CROSS_COMPILE line I would rather get an error that it can't find that compiler, than have it run of and find some other cross compiler I have installed and use that.
So probably the correct thing would be:
if CROSS_COMPILE is set then use CROSS_COMPILE else do the list search instead.
That could work.
Using CROSS_COMPILE instead of CROSS_COMPILER doesn't seem right. CROSS_COMPILER refers to a program. CROSS_COMPILE seems to refer to a process. It seems better and more accurate to say CROSS_COMPILER.
Thank you for your comments.
CROSS_COMPILE is the prefix, NOT the compiler.
Ie:
CROSS_COMPILE=arm-linux-gnueabihf- make foo
That gives you CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld AS=arm-linux-gnueabihf-as and so on.
This is used in _many_ other projects and makes sense.
So it is a cross compile tool chain prefix, not the compiler itself.
And of course if not set to anything, then you are native compiling and CC=gcc since CC=$(CROSS_COMPILE)gcc becomes just gcc in that case.
On Fri, May 08, 2015 at 09:57:45AM -0400, Lennart Sorensen wrote:
I think people can legitimately argue that if someone specifies CROSS_COMPILE then that is what they want to use, and you should NOT go looking at other options at all that might exist in that case.
After all if I make a typo in my CROSS_COMPILE line I would rather get an error that it can't find that compiler, than have it run of and find some other cross compiler I have installed and use that.
So probably the correct thing would be:
if CROSS_COMPILE is set then use CROSS_COMPILE else do the list search instead.
Yes, that is the no-surprises user-in-control way of doing things. Which is my recommendation as well.
Segher
On 08/05/15 16:57, Segher Boessenkool wrote:
On Fri, May 08, 2015 at 09:57:45AM -0400, Lennart Sorensen wrote:
I think people can legitimately argue that if someone specifies CROSS_COMPILE then that is what they want to use, and you should NOT go looking at other options at all that might exist in that case.
After all if I make a typo in my CROSS_COMPILE line I would rather get an error that it can't find that compiler, than have it run of and find some other cross compiler I have installed and use that.
So probably the correct thing would be:
if CROSS_COMPILE is set then use CROSS_COMPILE else do the list search instead.
Yes, that is the no-surprises user-in-control way of doing things. Which is my recommendation as well.
Thanks for the review guys. I'll send an updated version of the patch to the list shortly.
ATB,
Mark.