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

Cannot make callbacks from C code when using the -output-obj option under Mac OS X #4841

Closed
vicuna opened this issue Jul 25, 2009 · 1 comment
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 25, 2009

Original bug ID: 4841
Reporter: vouillon
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2009-09-13T16:50:32Z)
Resolution: fixed
Priority: normal
Severity: major
OS: Mac OS X
Version: 3.11.1
Fixed in version: 3.11.2+dev
Category: ~DO NOT USE (was: OCaml general)
Has duplicate: #4860
Parent of: #4878

Bug description

We use the -output-obj option when compiling the Mac OS UI of Unison. With Ocaml 3.11.1, we get the following error when linking the final binary:
Undefined symbols:
"_caml_apply2", referenced from:
_caml_callback2_exn in libasmrun.a(i386.o)
"_caml_apply3", referenced from:
_caml_callback3_exn in libasmrun.a(i386.o)

Indeed, the symbols caml_apply2 and caml_apply3 are local:
> nm u-b.o | grep apply2
000024b0 t _caml_apply2
(File u-b.o is the result of linking the Ocaml code using the "-output-obj" option.)

Apparently, this is a consequence of using "private_extern" rather than "glob" (bug #4960):
.text
.align 4
.private_extern _caml_apply2
_caml_apply2:
subl $12, %esp
[...]

We have tried to use the "-keep_private_externs" of ld as a workaround: it is supposed to prevent the private external symbols from becoming local. But this does not seem to make any difference.

@vicuna
Copy link
Author

vicuna commented Sep 13, 2009

Comment author: @xavierleroy

Fixed in 3.11 bugfix CVS branch (by not emitting .private_extern declarations if -output-obj is active). Will go in 3.11.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants