Hi ports@,

Currently, some trivial SML programs segfault when compiled with polyc:

openbsd$ cat test.sml
fun main () =
  let val name = CommandLine.name () in
  case CommandLine.arguments() of
    [] => print "no args\n"
  | (x::xs) => print ("first arg is: " ^ x ^ "\n")
  end
openbsd$ polyc -o test test.sml
openbsd$ ./test
Segmentation fault (core dumped)

We already set USE_NOEXECONLY to build polyml itself, but polyc
also needs to link programs with --no-execute-only.

Thanks for reviving the port Daniel :)

diff /usr/ports
path + /usr/ports
commit - ef9d6a4198761f9080bf5d2498b167c1d86af09a
blob - /dev/null
file + lang/polyml/patches/patch-polyc_in (mode 644)
--- /dev/null
+++ lang/polyml/patches/patch-polyc_in
@@ -0,0 +1,14 @@
+Binaries built with polyc also need to be linked with --no-execute-only.
+
+Index: polyc.in
+--- polyc.in.orig
++++ polyc.in
+@@ -19,6 +19,8 @@ COMPILER="${DEFAULT_COMPILER}"
+ @NATIVE_WINDOWS_TRUE@@WINDOWSGUI_TRUE@EXTRALDFLAGS+=" -mwindows"
+ @NATIVE_WINDOWS_TRUE@@WINDOWSGUI_FALSE@EXTRALDFLAGS+=" -mconsole"
+
++EXTRALDFLAGS="-Wl,--no-execute-only"
++
+ @NATIVE_WINDOWS_TRUE@SUFFIX="obj"
+ @NATIVE_WINDOWS_FALSE@SUFFIX="o"
+

Reply via email to