You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 6950 Reporter: tianyicui Assigned to:@mshinwell Status: resolved (set by @mshinwell on 2017-06-09T17:01:10Z) Resolution: duplicate Priority: normal Severity: minor Platform: Linux Version: 4.02.3 Target version: later Category: otherlibs Related to:#4229#4231#4839#6462#6957 Monitored by:@hhugo@gasche@rixed@diml@hcarty
Bug description
I found a bug in dynlink, which sometimes resolve symbols incorrectly.
Steps to reproduce
$ cat b.ml
let () = Printf.printf "%s\n%s\n" Config.foo Config.bar
$ cat config.ml
let foo = "foo"
let bar = "bar"
$ cat loader.ml
let () =
Dynlink.loadfile Sys.argv.(1)
$ cat test.sh
#!/bin/bash
./loader.exe b.cmxs
$ sh test.sh
/home/tcui/.opam/4.02.3/lib/ocaml
bar
Additional information
Note that if I didn't link ocamlcommon.cmxa this bug won't be reproduced. This because both ocamlcommon.cmxa and b.cmxs contain the symbol camlConfig__1 and dynlink/dlopen somehow chose to resolve to the one linked into loader.exe.
On Linux with glibc, this can be fixed by adding RTLD_DEEPBIND to the dlopen call. Not sure if this is the right fix though.
Original bug ID: 6950
Reporter: tianyicui
Assigned to: @mshinwell
Status: resolved (set by @mshinwell on 2017-06-09T17:01:10Z)
Resolution: duplicate
Priority: normal
Severity: minor
Platform: Linux
Version: 4.02.3
Target version: later
Category: otherlibs
Related to: #4229 #4231 #4839 #6462 #6957
Monitored by: @hhugo @gasche @rixed @diml @hcarty
Bug description
I found a bug in dynlink, which sometimes resolve symbols incorrectly.
Steps to reproduce
$ cat b.ml
let () = Printf.printf "%s\n%s\n" Config.foo Config.bar
$ cat config.ml
let foo = "foo"
let bar = "bar"
$ cat loader.ml
let () =
Dynlink.loadfile Sys.argv.(1)
$ cat test.sh
#!/bin/bash
rm -f *.{cmi,cmx,o,cmxs}
ocamlopt.opt
-I +compiler-libs ocamlcommon.cmxa dynlink.cmxa -linkall
loader.ml -o loader.exe
ocamlopt.opt
-I .
-shared -o b.cmxs
config.ml b.ml
./loader.exe b.cmxs
$ sh test.sh
/home/tcui/.opam/4.02.3/lib/ocaml
bar
Additional information
Note that if I didn't link ocamlcommon.cmxa this bug won't be reproduced. This because both ocamlcommon.cmxa and b.cmxs contain the symbol camlConfig__1 and dynlink/dlopen somehow chose to resolve to the one linked into loader.exe.
On Linux with glibc, this can be fixed by adding RTLD_DEEPBIND to the dlopen call. Not sure if this is the right fix though.
Possibly related (or duplicate) issues:
#4839
yallop/ocaml-ctypes#251
The text was updated successfully, but these errors were encountered: