-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop passing --image-base on Cygwin64 #89
Conversation
Cygwin64 has a memory layout which the attempt to place DLLs at 0x10000 violates. flexlink must either generate jump islands or the symbols must be declared in the consuming library with __declspec(dllimport) to ensure that they don't generate RIP-relative offsets.
@alainfrisch - what do you think about this one? It will completely break shared library compilation of OCaml < 4.12 for Cygwin64, but equally it is broken at the moment, just more subtly ( An alternative would be to add a new flag which disables this automatic passing of |
Yes, I agree with your plan. Breaking "more" OCaml < 4.12 for Cygwin64 is ok. |
Ta - I'll cut a release in the next couple of days and ping the Cygwin maintainer (although I think that may involve offering to become the Cygwin maintainer......) |
With my CompCert hat on, I would like to use OCaml under Cygwin64. How could we make progress with the new release of FlexDLL and the updated Cygwin64 package? |
I'm just testing 0.39 on my fork - assuming that's fine, I'll do the release later today. |
It's released, and I've proposed adopting the Cygwin package to push the release downstream as well. |
Previously: - -base applied to MSVC64 - Cygwin64 had -base 0x10000 hard-coded until ocaml#89 - mingw64 didn't specify -base at all Now: - The default is not to change the base address at all - All 3 64-bit ports support -base - For now, still ignored for 32-bit ports
On Cygwin64,
--image-base 0x10000
is always passed to the linker. This generates invalid DLLs for Cygwin64. This has never worked reliably, as DLLs need unique base addresses on Cygwin to survive fork. However, since version 4.4.4 Cygwin's rebase forces DLLs to the correct base address in 0x2:00000000-0x4:00000000. Since Cygwin64 executables load in 0x1:00000000-0x1:80000000, DLLs are always too far RELOC_REL32.Rather than dynamically generating branch islands, the new approach on the OCaml-side is to return to using
__declspec(dllimport)
only, which will cause the linker to do that work for us, as it should.Regardless of the solution,
--image-base
should cease being passed to the linker on Cygwin64.