Fixed GCC ld issue
authorjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 9 Jul 2006 05:14:01 +0000 (05:14 +0000)
committerjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 9 Jul 2006 05:14:01 +0000 (05:14 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@842 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java

index b77f2db..1e4c0ce 100644 (file)
@@ -39,6 +39,7 @@ public class CommandLineUserDefine {
     String outputDelimiter = null;\r
     \r
     public void command(CCTask cctask, UserDefineDef userdefine){\r
+        boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC");\r
         File workdir;\r
         Project project = cctask.getProject();\r
         if(userdefine.getWorkdir() == null) {\r
@@ -117,6 +118,9 @@ public class CommandLineUserDefine {
         String[] libSet = userdefine.get_libset();\r
         if (libSet != null && libSet.length > 0){\r
             cmdLen = cmdLen + libSet.length;\r
+            if (isGccCommand) {\r
+                cmdLen += 2;    // we need -( and -) to group libs for GCC\r
+            }\r
         }\r
 \r
         //\r
@@ -190,9 +194,15 @@ public class CommandLineUserDefine {
         }\r
         \r
         if (libSet != null && libSet.length > 0){\r
+            if (isGccCommand) {\r
+                cmd[index++] = "-(";\r
+            }\r
             for (int k = 0; k < libSet.length ; k++){\r
                 cmd[index++] = libSet[k];\r
             }\r
+            if (isGccCommand) {\r
+                cmd[index++] = "-)";\r
+            }\r
         }\r
         for (int j = 0; j < fileNames.length; j++){\r
             // execute the command\r