Просмотр исходного кода

Fix multiple uses of -Wa or -WA in the tigcc frontend (fixes pedrom-ld-tigcc build).

git-svn-id: file:///var/svn/tigccpp/trunk@675 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 18 лет назад
Родитель
Сommit
15ecbcaf8a

+ 2 - 0
tigcc-linux/CHANGELOG

@@ -15,6 +15,8 @@ Changelog for TIGCC For Linux
           same.)
         * Fixed external data variable support for compressed programs in tigcc
           (now uses the new ld-tigcc --outputbin-main-only switch).
+        * Fixed multiple uses of -Wa or -WA in the tigcc frontend (fixes
+          pedrom-ld-tigcc build).
 
 - 2005-10-02, version 0.96 beta 6 r1 (Kevin Kofler)
         * Synced Win32 TIGCC 0.96 Beta 6 source tree.

+ 1 - 0
tigcc-linux/sources/tigcc/ChangeLog

@@ -3,6 +3,7 @@ Changelog for TIGCC-FrontEnd For Linux
 - 2006-07-16, version 1.3.2 (Kevin Kofler)
         * Pass --no-names to ar-tigcc to match Win32 tigcc.exe behavior.
         * Use --outputbin-main-only, not --outputbin, when linking a PPG.
+        * Fixed multiple uses of -Wa or -WA (fixes pedrom-ld-tigcc build).
 
 - 2005-10-02, version 1.3.1 (Kevin Kofler)
         * Now handling -isystem correctly.

+ 28 - 8
tigcc-linux/sources/tigcc/src/tigcc.c

@@ -181,16 +181,36 @@ short int process_arg(short int arg, char *argv[], int argc)
     freopen (REDIRECT, "wt", stdout);
     dup2 (STDOUT_FILENO, STDERR_FILENO);
   } else if (!strncmp("-Wa,", cur_arg, 4)) {
-    as_args = strdup (cur_arg);
-    if (!as_args) {
-      fputs ("Fatal error: not enough free memory\n", stderr);
-      exit (-1);
+    if (as_args) {
+      as_args = realloc(as_args, strlen(as_args)+strlen(cur_arg)+2);
+      if (!as_args) {
+        fputs("Fatal error: not enough free memory\n", stderr);
+        exit(-1);
+      }
+      strcat(as_args, ",");
+      strcat(as_args, cur_arg);
+    } else {
+      as_args = strdup(cur_arg);
+      if (!as_args) {
+        fputs("Fatal error: not enough free memory\n", stderr);
+        exit(-1);
+      }
     }
   } else if (!strncmp("-WA,", cur_arg, 4)) {
-    a68k_args = strdup (cur_arg);
-    if (!a68k_args) {
-      fputs ("Fatal error: not enough free memory\n", stderr);
-      exit (-1);
+    if (a68k_args) {
+      a68k_args = realloc(a68k_args, strlen(a68k_args)+strlen(cur_arg)+2);
+      if (!a68k_args) {
+        fputs("Fatal error: not enough free memory\n", stderr);
+        exit(-1);
+      }
+      strcat(a68k_args, ",");
+      strcat(a68k_args, cur_arg);
+    } else {
+      a68k_args = strdup(cur_arg);
+      if (!a68k_args) {
+        fputs("Fatal error: not enough free memory\n", stderr);
+        exit(-1);
+      }
     }
   } else if (!strcmp("-np", cur_arg)) {
     printf("Developer option: no patching enabled !\n");