Web lists-archives.com

RE: Regression for OCaml introduced by rebase 4.4.4




Corinna Vinschen wrote:
> On Feb  8 11:47, David Allsopp wrote:
> > TL;DR flexlink-compiled DLLs (i.e. ocaml libraries) are broken by the
> > 0x200000000 base address requirement added in rebase 4.4.4. Possible
> > fixes for this at the bottom.
> >
> > Commit bfd383 in the rebase sources introduces a new minimum base
> > address requirement of 0x200000000 for Cygwin64. This is a problem for
> > the correct operation of the flexdll package and affects ocaml. On a
> > fresh up-to-date
> > Cygwin64 installation, install the ocaml package:
> >
> >   $ rebase -i /usr/lib/ocaml/stublibs/*
> >   /usr/lib/ocaml/stublibs/dllbigarray.so    base 0x000000010000 size
> > 0x00015000 *
> >   /usr/lib/ocaml/stublibs/dllcamlstr.so     base 0x000000010000 size
> > 0x00014000 *
> >   /usr/lib/ocaml/stublibs/dllgraphics.so    base 0x000000010000 size
> > 0x00038000 *
> > [...]
> > Here you can see a problem we already know about with flexlink - all
> > libraries have a base address of 0x10000
> > (https://github.com/alainfrisch/flexdll/issues/50).
> >
> > However, this allows you to load libraries dynamically:
> >
> >   $ ocaml
> >           OCaml version 4.04.2
> >
> >   # #load "unix.cma";;
> >   # #directory "+threads";;
> >   # #load "threads.cma";;
> >
> > but not fork (we know about this problem):
> >
> >   # Unix.fork ();;
> >         0 [main] ocamlrun 5688 child_info_fork::abort: address space
> > needed by 'dllunix.so' (0x400000) is already occupied
> >   Exception: Unix.Unix_error (Unix.EAGAIN, "fork", "").
> >
> > Now do a rebaseall.
> >
> >   $ rebase -i /usr/lib/ocaml/stublibs/*
> >   /usr/lib/ocaml/stublibs/dllvmthreads.so   base 0x0003fec20000 size
> > 0x0001f000
> >   /usr/lib/ocaml/stublibs/dllunix.so        base 0x0003fec40000 size
> > 0x0004c000
> > [...]
> >
> > So forking should now be fine. However:
> >
> >   $ ocaml
> >           OCaml version 4.04.2
> >
> >   # #load "unix.cma";;
> >   Cannot load required shared library dllunix.
> >   Reason: /usr/lib/ocaml/stublibs/dllunix.so: flexdll error: cannot
> > relocate RELOC_REL32, target is too far: 0xfffffffc013d8b5f
> 0x13d8b5f.
> 
> The problem is this:  Given that the lib is in a safe space anyway, why
> do you still try to relocate it?  That's exactly what you don't have to
> do anymore and you shouldn't do this.  The DLL is loaded where it
> belongs, end of story.  What should another relocation gain?  So, just
> wwitch it off for 64 bit Cygwin, no?

See other message, but we're not relocating the DLL, we're performing COFF relocations on specific symbols which were deferred from link time.


David

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple