# HG changeset patch # User Adam Chlipala # Date 1348078847 14400 # Node ID 8bc16ff91d320a74fb78c4209579b6e873f4aaaa # Parent 148203744882648b0d25ae2e493e57749bcd3f59 Edward Z. Yang's patch to avoid repeating linker arguments diff -r 148203744882 -r 8bc16ff91d32 src/compiler.sml --- a/src/compiler.sml Sun Aug 05 14:55:28 2012 -0400 +++ b/src/compiler.sml Wed Sep 19 14:20:47 2012 -0400 @@ -1442,6 +1442,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 () @@ -1478,7 +1483,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