* [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/
@ 2013-07-19 23:31 Spenser Gilliland
2013-07-19 23:31 ` [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp Spenser Gilliland
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Spenser Gilliland @ 2013-07-19 23:31 UTC (permalink / raw)
To: buildroot
Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
---
toolchain/toolchain-external/ext-toolchain-wrapper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-external/ext-toolchain-wrapper.c
index 460f255..dc473be 100644
--- a/toolchain/toolchain-external/ext-toolchain-wrapper.c
+++ b/toolchain/toolchain-external/ext-toolchain-wrapper.c
@@ -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
--
1.8.1.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp 2013-07-19 23:31 [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ Spenser Gilliland @ 2013-07-19 23:31 ` Spenser Gilliland 2013-07-20 10:36 ` Yann E. MORIN 2013-07-20 22:59 ` Peter Korsgaard 2013-07-20 9:58 ` [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ Yann E. MORIN 2013-07-20 22:14 ` Peter Korsgaard 2 siblings, 2 replies; 6+ messages in thread From: Spenser Gilliland @ 2013-07-19 23:31 UTC (permalink / raw) To: buildroot 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. Signed-off-by: Spenser Gilliland <spenser@gillilanding.com> --- .../toolchain-external/ext-toolchain-wrapper.c | 37 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-external/ext-toolchain-wrapper.c index dc473be..3b70610 100644 --- a/toolchain/toolchain-external/ext-toolchain-wrapper.c +++ b/toolchain/toolchain-external/ext-toolchain-wrapper.c @@ -8,6 +8,7 @@ * (C) 2011 Peter Korsgaard <jacmet@sunsite.dk> * (C) 2011 Daniel Nystr?m <daniel.nystrom@timeterminal.se> * (C) 2012 Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> + * (C) 2013 Spenser Gilliland <spenser@gillilanding.com> * * 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; -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp 2013-07-19 23:31 ` [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp Spenser Gilliland @ 2013-07-20 10:36 ` Yann E. MORIN 2013-07-20 22:59 ` Peter Korsgaard 1 sibling, 0 replies; 6+ messages in thread From: Yann E. MORIN @ 2013-07-20 10:36 UTC (permalink / raw) To: buildroot Spenser, All, On 2013-07-19 18:31 -0500, Spenser Gilliland spake thusly: > 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. > > Signed-off-by: Spenser Gilliland <spenser@gillilanding.com> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Yet a few minor nits below. Regards, Yann E. MORIN. > --- > .../toolchain-external/ext-toolchain-wrapper.c | 37 +++++++++++++++++++--- > 1 file changed, 33 insertions(+), 4 deletions(-) > > diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-external/ext-toolchain-wrapper.c > index dc473be..3b70610 100644 > --- a/toolchain/toolchain-external/ext-toolchain-wrapper.c > +++ b/toolchain/toolchain-external/ext-toolchain-wrapper.c [--SNIP--] > @@ -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 > + */ > +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? ;-) > + 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. -- .-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp 2013-07-19 23:31 ` [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp Spenser Gilliland 2013-07-20 10:36 ` Yann E. MORIN @ 2013-07-20 22:59 ` Peter Korsgaard 1 sibling, 0 replies; 6+ messages in thread From: Peter Korsgaard @ 2013-07-20 22:59 UTC (permalink / raw) To: buildroot >>>>> "Spenser" == Spenser Gilliland <spenser@gillilanding.com> 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 the use_default_float_abi() function inline here. -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ 2013-07-19 23:31 [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ Spenser Gilliland 2013-07-19 23:31 ` [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp Spenser Gilliland @ 2013-07-20 9:58 ` Yann E. MORIN 2013-07-20 22:14 ` Peter Korsgaard 2 siblings, 0 replies; 6+ messages in thread From: Yann E. MORIN @ 2013-07-20 9:58 UTC (permalink / raw) To: buildroot On 2013-07-19 18:31 -0500, Spenser Gilliland spake thusly: > > Signed-off-by: Spenser Gilliland <spenser@gillilanding.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> > --- > toolchain/toolchain-external/ext-toolchain-wrapper.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-external/ext-toolchain-wrapper.c > index 460f255..dc473be 100644 > --- a/toolchain/toolchain-external/ext-toolchain-wrapper.c > +++ b/toolchain/toolchain-external/ext-toolchain-wrapper.c > @@ -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 > -- > 1.8.1.2 > > _______________________________________________ > buildroot mailing list > buildroot at busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot -- .-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ 2013-07-19 23:31 [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ Spenser Gilliland 2013-07-19 23:31 ` [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp Spenser Gilliland 2013-07-20 9:58 ` [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ Yann E. MORIN @ 2013-07-20 22:14 ` Peter Korsgaard 2 siblings, 0 replies; 6+ messages in thread From: Peter Korsgaard @ 2013-07-20 22:14 UTC (permalink / raw) To: buildroot >>>>> "Spenser" == Spenser Gilliland <spenser@gillilanding.com> writes: Spenser> Signed-off-by: Spenser Gilliland <spenser@gillilanding.com> Committed, thanks. -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-07-20 22:59 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-07-19 23:31 [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ Spenser Gilliland 2013-07-19 23:31 ` [Buildroot] [PATCH v3 2/2] ext-toolchain-wrapper: fix uboot/linux with hardfp Spenser Gilliland 2013-07-20 10:36 ` Yann E. MORIN 2013-07-20 22:59 ` Peter Korsgaard 2013-07-20 9:58 ` [Buildroot] [PATCH v3 1/2] ext-toolchain-wrapper: fix typo on s/BR2_FPU/BR_FPU/ Yann E. MORIN 2013-07-20 22:14 ` Peter Korsgaard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox