[MLton-commit] r6864

Wesley Terpstra wesley at mlton.org
Wed Sep 17 21:05:06 PDT 2008


ELF format requires PLT for public symbols too.
----------------------------------------------------------------------

U   mlton/trunk/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun
U   mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun

----------------------------------------------------------------------

Modified: mlton/trunk/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun
===================================================================
--- mlton/trunk/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun	2008-09-18 03:50:18 UTC (rev 6863)
+++ mlton/trunk/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun	2008-09-18 04:05:02 UTC (rev 6864)
@@ -1534,11 +1534,13 @@
                                     * with a direct (rip-relative) call.
                                     *)
                                    (Private, _, _) => direct
-                                   (* Even though it is not safe to take the
-                                    * address of a public function, it is ok
-                                    * to call it directly.
-                                    *)
-                                 | (Public, _, _) => direct
+                                   (* Call at the point of definition. *)
+                                 | (Public, MinGW, _) => direct
+                                 | (Public, Cygwin, _) => direct
+                                 | (Public, Darwin, _) => direct
+                                   (* ELF requires PLT even for public fns. *)
+                                 | (Public, _, true) => plt
+                                 | (Public, _, false) => direct
                                    (* Windows always does indirect calls to
                                     * imported functions. The importLabel has
                                     * the function address written to it.

Modified: mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun
===================================================================
--- mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun	2008-09-18 03:50:18 UTC (rev 6863)
+++ mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun	2008-09-18 04:05:02 UTC (rev 6864)
@@ -1410,11 +1410,13 @@
                                     * with a direct (eip-relative) call.
                                     *)
                                    (Private, _, _) => direct ()
-                                   (* Even though it is not safe to take the
-                                    * address of a public function, it is ok
-                                    * to call it directly.
-                                    *)
-                                 | (Public, _, _) => direct ()
+                                   (* Call at the point of definition. *)
+                                 | (Public, MinGW, _) => direct ()
+                                 | (Public, Cygwin, _) => direct ()
+                                 | (Public, Darwin, _) => direct ()
+                                   (* ELF requires PLT even for public fns. *)
+                                 | (Public, _, true) => plt ()
+                                 | (Public, _, false) => direct ()
                                    (* Windows always does indirect calls to
                                     * imported functions. The importLabel has
                                     * the function address written to it.




More information about the MLton-commit mailing list