File Info

Rev. efeab20e689880041b1ce76d479bb22c776d3f74
Size 3,112 bytes
Time 2020-07-04 19:41:12
Author simphone
Log Message

simphone 0.8.1

Content

diff -urb build/rlink/launcher.py build/rlink/launcher.py
--- build/rlink/launcher.py
+++ build/rlink/launcher.py
@@ -67,12 +67,12 @@
 import os
 import sys
 
-buildRoot = os.environ.get('BUILD_ROOT')
-if not buildRoot:
-    print ('You must set BUILD_ROOT in your environment.')
-    sys.exit(1)
-sys.path.insert(0, os.path.join(buildRoot, 'lib'))
-sys.path.insert(1, os.path.join(buildRoot, 'umake'))
+#buildRoot = os.environ.get('BUILD_ROOT')
+#if not buildRoot:
+#    print ('You must set BUILD_ROOT in your environment.')
+#    sys.exit(1)
+#sys.path.insert(0, os.path.join(buildRoot, 'lib'))
+#sys.path.insert(1, os.path.join(buildRoot, 'umake'))
 
 import log
 
diff -urb build/rlink/rlink_exe.py build/rlink/rlink_exe.py
--- build/rlink/rlink_exe.py
+++ build/rlink/rlink_exe.py
@@ -128,7 +128,7 @@
     maxcmdlen=4000
 
     def quote(s):
-        if re.match("^[-a-zA-Z0-9./_=$\\\\]+$", s):
+        if re.match("^[-a-zA-Z0-9.,\+/_=$\\\\]+$", s):
             return s
         return '"' + s + '"'
 
@@ -189,7 +189,7 @@
         from_to=' %s %s' % (quote(self.name),quote(to))
         mlen=maxcmdlen - len(from_to)
         for x in self.sections:
-            if not x.mark:
+            if not x.mark and x.name[:7] != ".debug_" and x.name != ".rsrc":
                 ncmd=cmd+' %s' % quote("-R"+x.name)
                 if len(ncmd) >= mlen:
                     tmp='%s.%d.o' % (to, cnt)
@@ -432,12 +432,18 @@
     archives = []
     expfiles = []
     ofiles = []
-    symbols = [ "_start", "E32Dll__F10TDllReason","main","__init","__exit" ]
+    symbols = [ "_start", "E32Dll__F10TDllReason","main","__init","__exit","_main","__main","WinMain","_WinMain","WinMain@16","_WinMain@16" ]
+    paths = []
+    libraries = []
     newargs = args[:1]
 
     state = None
 
     for a in args[1:]:
+        if a[:2] == '-L':
+            paths.append(a[2:])
+
+    for a in args[1:]:
         if state:
             if state == "SYMBOL":
                 symbols.append(a)
@@ -467,6 +473,27 @@
             if a[:12] == '--undefined=':
                 symbols.append(a[12:])
 
+            if a[:2] == '-l':
+                for path in paths:
+                    if os.path.exists(path + "/lib" + a[2:] + ".a"):
+                        a = path + "/lib" + a[2:] + ".a"
+                        archives.append(a)
+                        xa="rlink/@OUTPUT_NAME@_archives.a"
+                        try:
+                            newargs.remove(xa)
+                        except ValueError:
+                            ofiles.append(xa)
+                            pass
+                        newargs.append(xa)
+                        a = 0
+                        break
+                if a != 0:
+                    if len(archives):
+                        libraries.append(a)
+                    else:
+                        newargs.append(a)
+                continue
+
             newargs.append(a)
             continue
 
@@ -508,6 +535,8 @@
 
         newargs.append(a)
 
+    newargs.extend(libraries)
+
     print "RLINK: Reading objects..."
 
     for a in expfiles:
Show on old repository browser