@@ -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,13 +39,10 @@ static char *predef_args[] = {
#ifdef BR_ABI
"-mabi=" BR_ABI,
#endif
-#ifdef BR_FLOAT_ABI
- "-mfloat-abi=" BR_FLOAT_ABI,
-#endif
#ifdef BR2_FPU
"-mfpu=" BR_FPU,
#endif
-#ifdef BR_SOFTFLOAT
+#ifdef BR2_SOFTFLOAT
"-msoft-float",
#endif /* BR_SOFTFLOAT */
#ifdef BR_MODE
@@ -61,6 +59,24 @@ static char *predef_args[] = {
#endif
};
+/* use_default_float_abi - determine if the user is not 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 ) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
int main(int argc, char **argv)
{
char **args, **cur;
@@ -68,6 +84,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 +140,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 +151,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;
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-floatt, -mhard-float or -mfloat-abi are specified by the user. Signed-off-by: Spenser Gilliland <spenser@gillilanding.com> Cc: Peter Korsgaard <jacmet@sunsite.dk> Cc: Yann E. MORIN <yann.morin.1998@free.fr> --- .../toolchain-external/ext-toolchain-wrapper.c | 38 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-)