Linker complaints if linked modules have conflicting options.
[fw/sdcc] / as / mcs51 / lkmain.c
index 842bcb33f8427e0e7a288c9dd0922cb1800e6e44..548a44fdf53ba6e222c337bba8c1681192fff450 100644 (file)
@@ -465,6 +465,29 @@ link_main()
        if ((c=endline()) == 0) { return; }
        switch (c) {
 
+    case 'O': /*For some important sdcc options*/
+        if (pass == 0)
+        {
+            if(strlen(sdccopt)==0)
+            {
+                strcpy(sdccopt, &ip[1]);
+                strcpy(sdccopt_module, curr_module);
+            }
+            else
+            {
+                if(strcmp(sdccopt, &ip[1])!=0)
+                {
+                                   fprintf(stderr,
+                                   "?ASlink-Warning-Conflicting sdcc options:\n"
+                    "   \"%s\" in module \"%s\" and\n"
+                    "   \"%s\" in module \"%s\".\n",
+                    sdccopt, sdccopt_module, &ip[1], curr_module);
+                                   lkerr++;
+                }
+            }
+        }
+               break;
+
        case 'X':
                radix = 16;
                break;
@@ -494,7 +517,10 @@ link_main()
 
        case 'M':
                if (pass == 0)
+        {
+            strcpy(curr_module, &ip[1]);
                        module();
+        }
                break;
 
        case 'A':