Skip to content
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

configure: optimistically enable native dynlink on recent 32bit darwin hosts #692

Closed
wants to merge 1 commit into from

Conversation

gasche
Copy link
Member

@gasche gasche commented Jul 15, 2016

See camlp4/camlp4#108: native dynlink seems to work correctly on recent
OSX machines (Darwin15, OSX 10.11), even on 32 bit setups. 32bit
setups were broken by OSX toolchain changes on darwin{10,11} (10.6,
10.7) so all 32bit darwin versions above darwin9 were pessimistically
disabled.

(Apparently the user demand for 32bit darwin host support is that
core_kernel assumes 32bit machines, at least when used in combination
with js_of_ocaml).

…n hosts

See camlp4/camlp4#108: native dynlink seems to work correctly on recent
OSX machines (Darwin15, OSX 10.11), even on 32 bit setups. 32bit
setups were broken by OSX toolchain changes on darwin{10,11} (10.6,
10.7) so all 32bit darwin versions above darwin9 were pessimistically
disabled.

(Apparently the user demand for 32bit darwin host support is that
core_kernel assumes 32bit machines, at least when used in combination
with js_of_ocaml).
@damiendoligez
Copy link
Member

There is no need to be optimistic, I have virtual machines running under Darwin1[234]. Let me test and report here.

@damiendoligez
Copy link
Member

I've tried on Darwin12 to Darwin15 and they all failed with this error:

ld: illegal text-relocoation (direct reference) to (global,weak) _caml_gc_regs in roots.pic.o from _caml_call_gc in i386.pic.o for architecture i386

@xavierleroy
Copy link
Contributor

Something weird is going on. At what point of the build does this error occur?

@damiendoligez
Copy link
Member

In make opt when trying to build libasmrun_shared.so.

@gasche
Copy link
Member Author

gasche commented Nov 11, 2016

Gentle ping: the camlp4 users are discussing applying the patch on their opam switches, so it would be interesting to find out whether it is actually safe.

@xavierleroy
Copy link
Contributor

I'm still surprised that @damiendoligez observed an error on caml_gc_regs but not on other global variables that are also accessed in asmrun/i386.S such as caml_last_return_address. The only difference I can see is that caml_gc_regs is declared in C without initialization, making it a "common" variable, while the other are explicitly initialized. An experiment would be to change line 226 of asmrun/roots.c into:

value * caml_gc_regs = NULL;

@xavierleroy
Copy link
Contributor

Concerning the need to avoid "common" variables in MacOS X, see https://caml.inria.fr/mantis/view.php?id=5693#c7798

@mshinwell
Copy link
Contributor

@damiendoligez Could you try the suggested change?

@damiendoligez
Copy link
Member

The error message is slightly different:

ld: illegal text-relocation to '_caml_gc_regs' in roots.pic.o from '_caml_call_gc' in i386.pic.o for architecture i386

Then, if I comment out line 156 of i386.S:

        movl    %esp, G(caml_gc_regs)

I get this error instead:

ld: illegal text-relocation to '_caml_bottom_of_stack' in roots.pic.o from '_caml_call_gc' in i386.pic.o for architecture i386

So it's not just caml_gc_regs but presumably all the globals that are used in instructions different from pushl and popl.

@xavierleroy
Copy link
Contributor

@damiendoligez 's observations are consistent with the hypothesis that MacOS x86-32 does NOT support dynamic linking of non-PIC code. In itself I'm not surprised. The mystery is the claim that it works found in the camlp4 github.

@damiendoligez
Copy link
Member

Maybe it depends on the Xcode version, although I do have the latest version (8.2.1).

@gasche
Copy link
Member Author

gasche commented Mar 8, 2017

It seems that my general optimism in life does not always match reality. I would vote to close the PR, and wait for a user with an actually reproducible story to maybe restart the discussion.

@damiendoligez
Copy link
Member

There is some information in MPR#6900 that may be relevant.

stedolan pushed a commit to stedolan/ocaml that referenced this pull request Sep 21, 2022
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
* Set ocamlformat to 0.24.1

* Undo dune-project changes

* Format code base

* Update ocamlformat version globally

Co-authored-by: Cuihtlauac ALVARADO <cuihtmlauac@tarides.com>
Co-authored-by: Thibaut Mattio <thibaut.mattio@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants