From: "Alexander Bottema" <Alexander.Bottema@mathworks.com>
To: <caml-list@yquem.inria.fr>
Subject: RE: [Caml-list] Dynamic linking
Date: Wed, 5 Oct 2005 09:11:13 -0400 [thread overview]
Message-ID: <DB873318D1A41648BEAC4B5AAB63B3E10AC7DDB1@MESSAGE-AH.ad.mathworks.com> (raw)
I think we may attach different meanings to "position independent code."
For me PIC includes PIC suitable for dynamic linking. (This is what the
-fPIC option tells GCC to do.)
-- Alexander
-----Original Message-----
From: skaller [mailto:skaller@users.sourceforge.net]
Sent: Wednesday, October 05, 2005 4:15 AM
To: Alexander Bottema
Cc: caml-list@yquem.inria.fr
Subject: RE: [Caml-list] Dynamic linking
On Tue, 2005-10-04 at 11:56 -0400, Alexander Bottema wrote:
> But the problem with a DLL is that you never now what address will be
> allocated for your executable. It can be located anywhere between 0
and
> 2^64-1.
Not on current versions of Linux/x86_64. They only support 48 bit
code addresses (I think it is 48 bits), this is the so-called
'small model'.
> Thus, when a DLL calls another DLL a 64-bit call is potentially
> required. AMD64 supports global address tables that enable you to
> translate a 32-bit call into a 64-bit one (likewise with data access).
> If you compile a C file with gcc (-fPIC -S) you'll get code that looks
> like this:
I know ..but it has NOTHING to do with position independent code.
> For OCaml to work you need to emit instructions of type 'call foo@PLT'
> and 'movl xyzzy@GOT(%ebx)'. Currently, the OCaml does not do this for
> AMD64, which is the heart of the problem. If you think this is trivial
> to fix, please go head and do it; I'd be very happy.
This has nothing to do with making the *code* position independent.
It is to do with supporting elf/ld.so dynamic loading. This is
another issue entirely.
Clearly, to access a symbol of an 'unknown' address,
you put the address into a known table slot instead,
when the library is loaded, and access indirectly.
In any case, this doesn't solve the problem, but it does
identify it correctly: the problem is to emit instructions
to bind to load-time linked libraries on Linux/Elf/ld.so
platforms. You can be sure Windows -- for the same processor --
uses a different dynamic linkage model .. :)
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
next reply other threads:[~2005-10-05 13:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-05 13:11 Alexander Bottema [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-06-18 4:18 Jeffrey Loren Shaw
2007-06-15 16:03 Alain Frisch
2007-06-15 16:47 ` [Caml-list] " Joel Reymont
2007-06-15 16:52 ` Brian Hurt
2007-06-15 18:24 ` Alain Frisch
2007-06-15 18:59 ` Jon Harrop
2007-06-15 20:57 ` Alain Frisch
2007-06-15 22:38 ` Quôc Peyrot
2007-06-16 7:23 ` Alain Frisch
2007-06-16 17:33 ` Jon Harrop
2007-06-16 17:59 ` skaller
2007-06-16 20:13 ` Christophe TROESTLER
2007-06-16 23:10 ` Philippe Wang
2007-06-15 22:37 ` skaller
2007-06-15 22:45 ` Christophe TROESTLER
2007-06-15 22:58 ` skaller
2007-06-20 13:40 ` Alain Frisch
2007-06-24 11:35 ` Jon Harrop
2005-10-04 15:56 Alexander Bottema
2005-10-05 8:14 ` skaller
2005-10-04 12:47 Alexander Bottema
2005-10-04 14:47 ` skaller
2005-09-28 12:44 Alexander Bottema
2005-09-26 3:09 Jonathan Roewen
2005-09-26 4:26 ` skaller
2005-09-26 5:14 ` Jacques Garrigue
2005-09-26 5:20 ` Jonathan Roewen
2005-09-28 9:05 ` Jacques Garrigue
2005-04-05 21:12 Emir Pasalic
2005-04-05 22:02 ` [Caml-list] " Igor Pechtchanski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB873318D1A41648BEAC4B5AAB63B3E10AC7DDB1@MESSAGE-AH.ad.mathworks.com \
--to=alexander.bottema@mathworks.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox