mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-08-03 00:17:43 +00:00
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. [Peter: fix !BR_FLOAT_ABI case, simplify] 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> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
parent
27c9370344
commit
aa86b52ca3
@ -8,6 +8,7 @@
|
|||||||
* (C) 2011 Peter Korsgaard <jacmet@sunsite.dk>
|
* (C) 2011 Peter Korsgaard <jacmet@sunsite.dk>
|
||||||
* (C) 2011 Daniel Nyström <daniel.nystrom@timeterminal.se>
|
* (C) 2011 Daniel Nyström <daniel.nystrom@timeterminal.se>
|
||||||
* (C) 2012 Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
|
* (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
|
* 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
|
* version 2. This program is licensed "as is" without any warranty of any
|
||||||
@ -23,6 +24,15 @@
|
|||||||
static char path[PATH_MAX];
|
static char path[PATH_MAX];
|
||||||
static char sysroot[PATH_MAX];
|
static char sysroot[PATH_MAX];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GCC errors out with certain combinations of arguments (examples are
|
||||||
|
* -mabi-float={hard|soft} and -m{little|big}-endian), so we have to ensure
|
||||||
|
* that we only pass the predefined one to the real compiler if the inverse
|
||||||
|
* option isn't in the argument list.
|
||||||
|
* This specifies the worst case number of extra arguments we might pass
|
||||||
|
*/
|
||||||
|
#define EXCLUSIVE_ARGS 1
|
||||||
|
|
||||||
static char *predef_args[] = {
|
static char *predef_args[] = {
|
||||||
path,
|
path,
|
||||||
"--sysroot", sysroot,
|
"--sysroot", sysroot,
|
||||||
@ -38,9 +48,6 @@ static char *predef_args[] = {
|
|||||||
#ifdef BR_ABI
|
#ifdef BR_ABI
|
||||||
"-mabi=" BR_ABI,
|
"-mabi=" BR_ABI,
|
||||||
#endif
|
#endif
|
||||||
#ifdef BR_FLOAT_ABI
|
|
||||||
"-mfloat-abi=" BR_FLOAT_ABI,
|
|
||||||
#endif
|
|
||||||
#ifdef BR_FPU
|
#ifdef BR_FPU
|
||||||
"-mfpu=" BR_FPU,
|
"-mfpu=" BR_FPU,
|
||||||
#endif
|
#endif
|
||||||
@ -119,7 +126,8 @@ int main(int argc, char **argv)
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur = args = malloc(sizeof(predef_args) + (sizeof(char *) * argc));
|
cur = args = malloc(sizeof(predef_args) +
|
||||||
|
(sizeof(char *) * (argc + EXCLUSIVE_ARGS)));
|
||||||
if (args == NULL) {
|
if (args == NULL) {
|
||||||
perror(__FILE__ ": malloc");
|
perror(__FILE__ ": malloc");
|
||||||
return 2;
|
return 2;
|
||||||
@ -129,6 +137,19 @@ int main(int argc, char **argv)
|
|||||||
memcpy(cur, predef_args, sizeof(predef_args));
|
memcpy(cur, predef_args, sizeof(predef_args));
|
||||||
cur += sizeof(predef_args) / sizeof(predef_args[0]);
|
cur += sizeof(predef_args) / sizeof(predef_args[0]);
|
||||||
|
|
||||||
|
#ifdef BR_FLOAT_ABI
|
||||||
|
/* add float abi if not overridden in args */
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (!strncmp(argv[i], "-mfloat-abi=", strlen("-mfloat-abi=")) ||
|
||||||
|
!strcmp(argv[i], "-msoft-float") ||
|
||||||
|
!strcmp(argv[i], "-mhard-float"))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == argc)
|
||||||
|
*cur++ = "-mfloat-abi=" BR_FLOAT_ABI;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* append forward args */
|
/* append forward args */
|
||||||
memcpy(cur, &argv[1], sizeof(char *) * (argc - 1));
|
memcpy(cur, &argv[1], sizeof(char *) * (argc - 1));
|
||||||
cur += argc - 1;
|
cur += argc - 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user