ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/
PATCH v3 1/2 ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/
--- toolchain/toolchain-external/ext-toolchain-wrapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/toolchain-external/ext-toolchain-wrapper.c +1 -1
@@ -41,7 +41,7 @@ static char *predef_args[] = {#ifdef BR_FLOAT_ABI "-mfloat-abi=" BR_FLOAT_ABI,#endif -#ifdef BR2_FPU +#ifdef BR_FPU "-mfpu=" BR_FPU,#endif #ifdef BR_SOFTFLOAT
Signature · 1 line
1.8.1.2
PATCH v3 2/2 ext-toolchain-wrapper: fix uboot/linux with hardfp
The linux kernel and uboot specify -msoft-float in order to prevent floating
point code from being generated. This causes a conflict when -mfloat-abi=hard
or -mfloat-abi options are specified in the wrapper. This patch removes the
-mfloat-abi option from the options generated by the wrapper only when -msoft-float, -mhard-float or -mfloat-abi are specified by the user.
--- .../toolchain-external/ext-toolchain-wrapper.c | 37 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-)
toolchain/toolchain-external/ext-toolchain-wrapper.c +33 -4
@@ -8,6 +8,7 @@* (C) 2011 Peter Korsgaard <[email protected]> * (C) 2011 Daniel Nystr?m <[email protected]> * (C) 2012 Arnout Vandecappelle (Essensium/Mind) <[email protected]> +* (C) 2013 Spenser Gilliland <[email protected]> * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any
@@ -38,9 +39,6 @@ static char *predef_args[] = {#ifdef BR_ABI "-mabi=" BR_ABI,#endif -#ifdef BR_FLOAT_ABI - "-mfloat-abi=" BR_FLOAT_ABI, -#endif #ifdef BR_FPU "-mfpu=" BR_FPU,#endif
@@ -61,6 +59,25 @@ static char *predef_args[] = {#endif }; +/* use_default_float_abi - determine if the user is trying to override the +* floating point abi. +* return 0 if the user is attempting to override the float abi +* otherwise return 1 +*/ +int use_default_float_abi (int argc,char **argv) { +int arg; +for (arg =1 ; arg < argc; arg++) { +if (strncmp (argv[arg],"-mfloat-abi=" ,sizeof ("-mfloat-abi=" )/sizeof (char )-1 ) ==0 || +strcmp (argv[arg],"-msoft-float" ) ==0 || +strcmp (argv[arg],"-mhard-float" ) ==0 ) { +printf ("DETECTED FLOAT ABI\n" ); +return 0 ; + } + } + +return 1 ; +} +int main (int argc,char **argv) {char **args, **cur;
@@ -68,6 +85,11 @@ int main(int argc, char **argv)char *progpath = argv[0 ];char *basename;int ret, i, count =0 ; +int set_float_abi =0 ; + +#ifdef BR_FLOAT_ABI + set_float_abi =use_default_float_abi (argc,argv); +#endif /* Calculate the relative paths */ basename =strrchr (progpath,'/' );
@@ -119,7 +141,8 @@ int main(int argc, char **argv)return 3 ; } - cur = args =malloc (sizeof (predef_args) + (sizeof (char *) * argc)); + cur = args =malloc (sizeof (predef_args) + + (sizeof (char *) * (argc + set_float_abi)));if (args ==NULL ) {perror (__FILE__": malloc" );return 2 ;
@@ -129,6 +152,12 @@ int main(int argc, char **argv)memcpy (cur, predef_args,sizeof (predef_args)); cur +=sizeof (predef_args) /sizeof (predef_args[0 ]); +/* add float abi if neccessary */ +if (set_float_abi) { + *cur ="-mfloat-abi=" BR_FLOAT_ABI ; + cur++; + } +/* append forward args */ memcpy (cur, &argv[1 ],sizeof (char *) * (argc -1 )); cur += argc -1 ;
Signature · 1 line
1.8.1.2
PATCH v3 2/2 ext-toolchain-wrapper: fix uboot/linux with hardfp
Spenser, All,
On 2013-07-19 18:31 -0500, Spenser Gilliland spake thusly:
Quoted 4 lines
The linux kernel and uboot specify -msoft-float in order to prevent floating
point code from being generated. This causes a conflict when -mfloat-abi=hard
or -mfloat-abi options are specified in the wrapper. This patch removes the
-mfloat-abi option from the options generated by the wrapper only when -msoft-float, -mhard-float or -mfloat-abi are specified by the user.
Please, wrap your commit log at <80 chars.
Quoted 2 lines
Signed-off-by Spenser Gilliland <[email protected]>
Yet a few minor nits below.
Regards,
Yann E. MORIN.
toolchain/toolchain-external/ext-toolchain-wrapper.c
Quoted 8 lines
--- .../toolchain-external/ext-toolchain-wrapper.c | 37 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-)toolchain/toolchain-external/ext-toolchain-wrapper.c +0
-0
[--SNIP--]
toolchain/toolchain-external/ext-toolchain-wrapper.c static char *predef_args[] = { · line 65
Quoted 8 lines
toolchain/toolchain-external/ext-toolchain-wrapper.c +4
-0@@ -61,6 +59,25 @@ static char *predef_args[] = {#endif }; +/* use_default_float_abi - determine if the user is trying to override the +* floating point abi. +* return 0 if the user is attempting to override the float abi +* otherwise return 1
I'd state it differently:
use_default_float_abi - check whether we should pass our own float ABI flags, or use the ones provided on the command line Returns:
0: do not add our -float-abi= flag
1: do add our -mfloat-abi= flags
toolchain/toolchain-external/ext-toolchain-wrapper.c static char *predef_args[] = { · line 70
Quoted 5 lines
toolchain/toolchain-external/ext-toolchain-wrapper.c +5
-0+*/ +int use_default_float_abi (int argc,char **argv) { +int arg; +for (arg =1 ; arg < argc; arg++) { + if (strncmp(argv[arg],"-mfloat-abi=", sizeof("-mfloat-abi=")/sizeof(char)-1) == 0 ||
I think that we can assume that sizeof(char) == 1 everywhere Buildroot is expected to run, no? ;-)
toolchain/toolchain-external/ext-toolchain-wrapper.c static char *predef_args[] = { · line 77
Quoted 7 lines
toolchain/toolchain-external/ext-toolchain-wrapper.c +7
-0+ strcmp(argv[arg],"-msoft-float") == 0 || + strcmp(argv[arg],"-mhard-float") == 0 ) { +printf ("DETECTED FLOAT ABI\n" ); +return 0 ; + } + } +
No spaces/tabs on empty lines.
Otherwise, loogs good, and most importantly, fixes my kernel build! Hurray! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v3 2/2 ext-toolchain-wrapper: fix uboot/linux with hardfp
In reply to Spenser GillilandQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Spenser" == Spenser Gilliland <[email protected]> writes:
Spenser> The linux kernel and uboot specify -msoft-float in order to Spenser> prevent floating point code from being generated. This causes Spenser> a conflict when -mfloat-abi=hard or -mfloat-abi options are Spenser> specified in the wrapper. This patch removes the -mfloat-abi Spenser> option from the options generated by the wrapper only when Spenser> -msoft-float, -mhard-float or -mfloat-abi are specified by the Spenser> user.
Committed with some changes (see below) - Thanks.
Spenser> +/* use_default_float_abi - determine if the user is trying to override the Spenser> + * floating point abi.
Spenser> + * return 0 if the user is attempting to override the float abi Spenser> + * otherwise return 1
Spenser> + */
Spenser> +int use_default_float_abi(int argc, char **argv) {
Spenser> + int arg;
Spenser> + for (arg = 1; arg < argc; arg++) {
Spenser> + if (strncmp(argv[arg],"-mfloat-abi=", sizeof("-mfloat-abi=")/sizeof(char)-1) == 0 ||
Spenser> + strcmp(argv[arg],"-msoft-float") == 0 ||
Spenser> + strcmp(argv[arg],"-mhard-float") == 0 ) {
Spenser> + printf("DETECTED FLOAT ABI\n");
This debug line shouldn't be here.
The entire function should be inside an #ifdef BR_FLOAT_ABI so we don't get warnings about unused functions on !arm.
Spenser> + return 0;
Spenser> + }
Spenser> + }
Spenser> +
Spenser> + return 1;
Spenser> +}
Spenser> +
Spenser> int main(int argc, char **argv)
Spenser> {
Spenser> char **args, **cur;
Spenser> @@ -68,6 +85,11 @@ int main(int argc, char **argv)
Spenser> char *progpath = argv[0];
Spenser> char *basename;
Spenser> int ret, i, count = 0; Spenser> + int set_float_abi = 0;
Spenser> +
Spenser> +#ifdef BR_FLOAT_ABI
Spenser> + set_float_abi = use_default_float_abi(argc,argv);
Spenser> +#endif
Spenser> /* Calculate the relative paths */
Spenser> basename = strrchr(progpath, '/');
Spenser> @@ -119,7 +141,8 @@ int main(int argc, char **argv)
Spenser> return 3;
Spenser> }
Spenser> - cur = args = malloc(sizeof(predef_args) + (sizeof(char *) * argc));
Spenser> + cur = args = malloc(sizeof(predef_args) +
Spenser> + (sizeof(char *) * (argc + set_float_abi)));
Spenser> if (args == NULL) {
Spenser> perror(__FILE__ ": malloc");
Spenser> return 2; Spenser> @@ -129,6 +152,12 @@ int main(int argc, char **argv)
Spenser> memcpy(cur, predef_args, sizeof(predef_args));
Spenser> cur += sizeof(predef_args) / sizeof(predef_args[0]);
Spenser> + /* add float abi if neccessary */
It's more 'if not overridden by the wrapper arguments'
Spenser> + if (set_float_abi) {
Spenser> + *cur = "-mfloat-abi=" BR_FLOAT_ABI;
Spenser> + cur++;
Spenser> + }
This should also have been inside an #ifdef BR_FLOAT_ABI, because now it won't build on archs not using BR_FLOAT_ABI.
To limit the number of ifdefs, I simply moved theuse_default_float_abi() function inline here.
Signature · 1 line
Bye, Peter Korsgaard
PATCH v3 1/2 ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/
In reply to Spenser GillilandOn 2013-07-19 18:31 -0500, Spenser Gilliland spake thusly:
Quoted 2 lines
Signed-off-by Spenser Gilliland <[email protected]>
Quoted 24 lines
--- toolchain/toolchain-external/ext-toolchain-wrapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)toolchain/toolchain-external/ext-toolchain-wrapper.c +1
-1@@ -41,7 +41,7 @@ static char *predef_args[] = {#ifdef BR_FLOAT_ABI "-mfloat-abi=" BR_FLOAT_ABI,#endif -#ifdef BR2_FPU +#ifdef BR_FPU "-mfpu=" BR_FPU,#endif #ifdef BR_SOFTFLOAT Signature · 6 lines
1.8.1.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v3 1/2 ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/
In reply to Spenser GillilandQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Spenser" == Spenser Gilliland <[email protected]> writes:
Spenser> Signed-off-by: Spenser Gilliland <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard