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

Wish: improve -pack implementation #2500

Closed
vicuna opened this issue Apr 24, 2004 · 2 comments
Closed

Wish: improve -pack implementation #2500

vicuna opened this issue Apr 24, 2004 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Apr 24, 2004

Original bug ID: 2500
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Gerd Stolpmann
Version: 3.07pl2
OS: All
Submission from: p508170d8.dip0.t-ipconnect.de (80.129.112.216)

Hello cathedral,

as a pragmatic solution to the problem that -pack does not work for every
platform, I have the following suggestion: Currently, the symbols are renamed
after machine-code generation, and this is why objcopy is needed. To work around
this, I suggest to rename the symbols before machine-code generation. This
does not need any further tools.

ocamlopt could be called as follows:

ocamlopt -c module.ml -for-pack

This would already generate a module.o where the symbols are renamed. In
module.cmx, a special flag would be included indicating that this happened.
Later, when

ocamlopt -pack ...

is called, only these specially prepared modules are accepted. Conversely, it is
forbidden to use these modules for anything else.

I hope that this change helps that -pack is widely adopted. I don't see any
other way to handle name clashes in an intelligent way. You know that there are
some library authors who are unwilling to rename their modules (i.e. the
cooperative social solution), and I also think it is not the task of O'Caml
distributions to make pressure on the authors in this respect. All other
solutions to the problem are somehow dumb, e.g. a registry of module names, or
something like this.

In the hope the cathedral understands what is going on on the bazaar,

Gerd Stolpmann

@vicuna
Copy link
Author

vicuna commented Apr 27, 2004

Comment author: administrator

Dear Gerd,

as a pragmatic solution to the problem that -pack does not work for every
platform,

Well, GNU binutils are available for all platforms supported by ocamlopt,
so ocamlopt -pack does work for every platform, in a way. But it is
true that installing binutils (when they are not installed by default)
is a bit of a pain, and the code in ocamlopt that performs the symbol
renaming is somewhat ugly.

I have the following suggestion: Currently, the symbols are renamed
after machine-code generation, and this is why objcopy is needed. To
work around this, I suggest to rename the symbols before
machine-code generation. This does not need any further tools.

It's a highly reasonable suggestion. I cannot say offhand how easy
it is to implement (it looks like one of those "small" changes that
can impact many little things in the compiler), but will try to look
at this when I have a bit more time.

Best wishes,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Aug 2, 2005

Comment author: administrator

Implemented a priori renaming (ocamlopt -for-pack) in 3.09 as suggested. XL,
2005-08-01

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

No branches or pull requests

1 participant