[Ur] Don't repeat arguments to linker

Edward Z. Yang ezyang at MIT.EDU
Mon Sep 17 04:04:27 EDT 2012


Oops, this is slightly wrong.  Here is a better patch:

diff -r d2383ffc18ab -r 89d30c4359bf src/compiler.sml
--- a/src/compiler.sml  Fri Aug 03 12:39:04 2012 -0400
+++ b/src/compiler.sml  Mon Sep 17 10:02:34 2012 +0200
@@ -1434,6 +1434,11 @@
 
 val beforeC = ref (fn () => ())
 
+structure StringSet = BinarySetFn(struct
+                                  type ord_key = string
+                                  val compare = String.compare
+                                  end)
+
 fun compileC {cname, oname, ename, libs, profile, debug, linker, link = link'} =
     let
         val proto = Settings.currentProtocol ()
@@ -1470,7 +1475,14 @@
             else
                 (compile, link)
 
-        val link = foldl (fn (s, link) => link ^ " " ^ s) link link'
+        val link = #1 (foldl
+            (fn (s, (link, set)) =>
+              if StringSet.member (set, s) then
+                (link, set)
+              else
+                ((link ^ " " ^ s), StringSet.add (set, s)))
+            (link, StringSet.empty)
+            link')
 
         fun system s =
             (if debug then



More information about the Ur mailing list