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

Support for position-independent code and natdynlink on ARM #5404

Closed
vicuna opened this Issue Nov 21, 2011 · 3 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Nov 21, 2011

Original bug ID: 5404
Reporter: meurer
Assigned to: @lefessan
Status: closed (set by @lefessan on 2012-01-17T10:05:03Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.12.1
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #5433
Monitored by: tgazagna @glondu @hcarty

Bug description

Hello,

I spent some time fixing the ARM compiler part to emit position-independent code in order to get proper support for natdynlink on ARM. The critical part is fixing the generated branches to use the PLT (cf. issue 5049), the other relocations seem to be handled properly, hence there's no need to use the GOT to access global variables. That does however require changes to the runtime interface as r12 is used as scratch register for the PLT slots. I fixed these by introducing two additional functions caml_invoke_gc and caml_c_invoke, which are similar to their caml_call_gc and caml_c_call counterparts, but do not use r12 for parameter passing. The old functions are provided for compatibility with existing code/libraries (and are used by the code generator when appropriate).

The attached patch contains the required changes to the runtime and the compiler toolchain. So far the stuff was tested with Debian squeeze armel running on QEMU and a NanosG20 SBC (ARM926EJ-S rev 5 (v5l)).

I did some tests on the ARM926EJ-S, and there seems to be no noticable performance hit (OLD is OCaml 3.12.1 without the patch, NEW is the patched OCaml generating PIC code):

File OLD NEW
bdd.ml 16.880 16.660
boyer.ml 16.980 16.760
fft.ml 55.270 54.820
nucleic.ml 187.280 187.200
quicksort.ml 3.990 4.000
sieve.ml 0.330 0.340
soli.ml 0.150 0.160
sorts.ml 75.230 73.350

File attachments

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Nov 29, 2011

Comment author: meurer

Anything else required to get this fixed for the next release?

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Dec 22, 2011

Comment author: meurer

This fix is made obsolete by #5433.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 17, 2012

Comment author: @lefessan

Obsoleted by #5433, so closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.