* The Extension to ELF
@ 2012-08-08 5:39 Fumiaki Isoya
2012-08-08 6:32 ` Ian Lance Taylor
0 siblings, 1 reply; 9+ messages in thread
From: Fumiaki Isoya @ 2012-08-08 5:39 UTC (permalink / raw)
To: gcc
I'd just sent mail to rms@gnu.org and he replied.
> I know nothing abnout ELF format, and I have not worked on GCC since
> 1991. Thus, I simply am not in a position to judge the merits of your
> suggestion. How about writing to gcc@gnu.org, which is the discussion
> list for GCC?
My original message is below. I'd like to hear your opinion.
> Hello.
>
> This is the 3rd time to send email in this topic. My first
> purpose in 1994 was to make a simple and lightweight OO language
> which can run on 32bit native DOS. I planned the implementation
> of C structure which has the first variable of a pointer to its
> class. And I considered about the class which contains a pointer
> table for instance methods.
>
> ------------------------------------------------------------------------
> class Object {
> int a, b; /* instance variable */
> void do0 (); /* instance method */
> void do1 ();
> void do2 ();
> void do3 ();
> void do4 ();
> };
>
> Object obj;
>
> ------------------------------------------------------------------------
> [MEMORY IMAGE]
>
> Object
> +-----------+
> | Ptr super |
> | Ptr do0 |
> | Ptr do1 |
> | Ptr do2 |
> | Ptr do3 |
> | Ptr do4 |
> +-----------+
>
> obj
> +-----------+
> | Ptr class |---> Object
> | int a |
> | int b |
> +-----------+
>
> ------------------------------------------------------------------------
> class Point extends Object {
> int x, y, z; /* instance variable */
> void do2 (); /* instance method (override) */
> void do5 (); /* instance method */
> void do6 (); /* instance method */
> };
>
> Point pt;
>
> ------------------------------------------------------------------------
> [MEMORY IMAGE]
>
> Point
> +--------------------+
> | Ptr super |---> Object
> | Ptr do0 |
> | Ptr do1 |
> | Ptr do2 |
> | Ptr do3 |
> | Ptr do4 |
> | Ptr do5 |
> | Ptr do6 |
> +--------------------+
>
> pt
> +-----------+
> | Ptr class |---> Point
> | int a |
> | int b |
> | int x |
> | int y |
> | int z |
> +-----------+
>
> ------------------------------------------------------------------------
>
> Even with this simple plan, trying to implement was very difficult
> because I was going to keep the principle "What is necessary is to
> re-compile only the source files you touched".
>
> Consider the class, for example, which has 5 instance methods.
> The derived class adds 2 methods and overrides 1 method. The
> object files are separate into two. The symbols of indices (in
> asm file) will be something like the below.
>
> Object_super .define 0
> Object_do0 .define 4
> Object_do1 .define 8
> Object_do2 .define 12
> Object_do3 .define 16
> Object_do4 .define 20
> Object_MMAX .define 24 /* Method MAX */
>
> Object_class .define 0
> Object_a .define 4
> Object_b .define 8
> Object_VMAX .define 12 /* Variable MAX */
>
>
> Point_super .define Object_super
> Point_do0 .define Object_do0
> Point_do1 .define Object_do1
> Point_do2 .define Object_do2
> Point_do3 .define Object_do3
> Point_do4 .define Object_do4
> Point_do5 .define Object_MMAX .+ 0
> Point_do6 .define Object_MMAX .+ 4
> Point_MMAX .define Object MMAX .+ 8
>
> Point_a .define Object_a
> Point_b .define Object_b
> Point_x .define Object_VMAX .+ 0
> Point_y .define Object_VMAX .+ 4
> Point_z .define Object_VMAX .+ 8
> Point_VMAX .define Object_VMAX .+ 12
>
>
> The object file of the derived class doesn't know the length of
> the method table of the super class, nor the index of the method
> to override. The calculation of constants to generate a suitable
> method table must be ld's job as long as we keep the principle.
> Take care this is not about the method dispatch. This is about
> the classes as global variables which is generated by ld. It
> contains a flat pointer table of instance methods. How do you
> think about this principle?
>
> I suspect we should make decision of solving all symbols by the
> calculation. That is, all symbols should be solved by the
> calculation of the information that stored in Reverse Polish which
> consists of constants, other symbols, and their arithmetic. It
> also contains the information of shared libraries possibly. I
> suppose this decision gives unified implementation of object
> files, static libraries, and shared libraries. In fact it will be
> the extended ELF.
>
> Please forgive me because I'm not any linker expert. I don't know
> very much the details of ELF format. I know m68k asm, but I only
> regards ld as a kind of constant resolver. I even don't know
> really well about dynamic linking. But I believe this kind of
> solution will be the best infrastructure (binutils, and the
> mechanism of shared library) for the object oriented languages.
> I'm not interested in designing OO language, I'm just talking
> about infrastructure. I imagine the goal of this infrastructure
> is to provide seamless linking of OO language's object files, C's
> object files, and Asm's object files.
>
> I had read the article of the interview to Straustrap so many
> years ago and he had said "My work is to design the language, I'm
> not interested in implementations" or something like it. In
> contrast with it, my interest is implementations. How do you
> think about the great effects which he brought with his stance?
>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: The Extension to ELF
2012-08-08 5:39 The Extension to ELF Fumiaki Isoya
@ 2012-08-08 6:32 ` Ian Lance Taylor
2012-08-08 7:47 ` Fumiaki Isoya
2012-08-08 11:23 ` Frank Ch. Eigler
0 siblings, 2 replies; 9+ messages in thread
From: Ian Lance Taylor @ 2012-08-08 6:32 UTC (permalink / raw)
To: Fumiaki Isoya; +Cc: gcc
On Tue, Aug 7, 2012 at 10:38 PM, Fumiaki Isoya <isoyaf@gmail.com> wrote:
>> I suspect we should make decision of solving all symbols by the
>> calculation. That is, all symbols should be solved by the
>> calculation of the information that stored in Reverse Polish which
>> consists of constants, other symbols, and their arithmetic. It
>> also contains the information of shared libraries possibly. I
>> suppose this decision gives unified implementation of object
>> files, static libraries, and shared libraries. In fact it will be
>> the extended ELF.
The details matter.
ELF is designed to permit fast program loading at runtime, and to
permit fast linking. Changing symbol and relocation values to take
general expressions works against that goal.
> I imagine the goal of this infrastructure
> is to provide seamless linking of OO language's object files, C's
> object files, and Asm's object files.
We can already link all these object files together.
I'm sure it is possible to improve on ELF in various ways. However,
ELF is pretty good. I very strongly recommend that you understand how
the format works before you attempt to extend it.
Ian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: The Extension to ELF
2012-08-08 6:32 ` Ian Lance Taylor
@ 2012-08-08 7:47 ` Fumiaki Isoya
2012-08-08 11:23 ` Frank Ch. Eigler
1 sibling, 0 replies; 9+ messages in thread
From: Fumiaki Isoya @ 2012-08-08 7:47 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc
> ELF is designed to permit fast program loading at runtime, and to
> permit fast linking. Changing symbol and relocation values to take
> general expressions works against that goal.
> I'm sure it is possible to improve on ELF in various ways. However,
> ELF is pretty good. I very strongly recommend that you understand how
> the format works before you attempt to extend it.
Thanks for your reply.
I don't necessarily have a thought special to ELF. I merely thought
vaguely "it will become such a form, supposing it realizes". If
required, even if it will become a completely different format from
ELF, I don't care.
I showed example.
> Point_do6 .define Object_MMAX .+ 4
What I hope is that this definition is going to be stored in .o file
as the following form.
[Point_do6] [Object_MAX] [4] [+] [!]
My main hope is to keep the principle "What is necessary is to
re-compile only the source files you touched". I don't care at all if
I must convert the execution file or library file from different
format to ELF after linking or archiving.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: The Extension to ELF
2012-08-08 6:32 ` Ian Lance Taylor
2012-08-08 7:47 ` Fumiaki Isoya
@ 2012-08-08 11:23 ` Frank Ch. Eigler
2012-08-08 13:24 ` Ian Lance Taylor
2012-08-08 15:42 ` Fumiaki Isoya
1 sibling, 2 replies; 9+ messages in thread
From: Frank Ch. Eigler @ 2012-08-08 11:23 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: Fumiaki Isoya, gcc
Ian Lance Taylor <iant@google.com> writes:
> [...]
> ELF is designed to permit fast program loading at runtime, and to
> permit fast linking. Changing symbol and relocation values to take
> general expressions works against that goal.
> [...]
It may interest you to know that, for an older Cygnus project (mep),
we implemented a facility called computed/complex relocations, as an
ELF extension. This is a way of encoding general symbol/arithmetic
expressions to be evaluated at link time and substituted into the
binary output. (It may be similar to the vms-alpha ETIR facility.)
This has been merged into gnu binutils some time ago, though is not
widely known, and only used by a single cgen-based gas port. See the
OBJ_COMPLEX_RELC conditionals in gas/*, the BSF_*RELC/STT_RELC logic
in bfd/*.
- FChE
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: The Extension to ELF
2012-08-08 11:23 ` Frank Ch. Eigler
@ 2012-08-08 13:24 ` Ian Lance Taylor
2012-08-08 13:34 ` Frank Ch. Eigler
2012-08-08 15:42 ` Fumiaki Isoya
1 sibling, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 2012-08-08 13:24 UTC (permalink / raw)
To: Frank Ch. Eigler; +Cc: Fumiaki Isoya, gcc
On Wed, Aug 8, 2012 at 4:23 AM, Frank Ch. Eigler <fche@redhat.com> wrote:
> Ian Lance Taylor <iant@google.com> writes:
>
>> [...]
>> ELF is designed to permit fast program loading at runtime, and to
>> permit fast linking. Changing symbol and relocation values to take
>> general expressions works against that goal.
>> [...]
>
> It may interest you to know that, for an older Cygnus project (mep),
> we implemented a facility called computed/complex relocations, as an
> ELF extension. This is a way of encoding general symbol/arithmetic
> expressions to be evaluated at link time and substituted into the
> binary output. (It may be similar to the vms-alpha ETIR facility.)
>
> This has been merged into gnu binutils some time ago, though is not
> widely known, and only used by a single cgen-based gas port. See the
> OBJ_COMPLEX_RELC conditionals in gas/*, the BSF_*RELC/STT_RELC logic
> in bfd/*.
Thanks, I was trying to remember that.
It is perhaps also worth noting that the IEEE-695 object file format
supports arbitrary expressions in a number of different ways,
including for relocation calculations. The format is not widely used
today, for more or less that reason.
Ian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: The Extension to ELF
2012-08-08 13:24 ` Ian Lance Taylor
@ 2012-08-08 13:34 ` Frank Ch. Eigler
0 siblings, 0 replies; 9+ messages in thread
From: Frank Ch. Eigler @ 2012-08-08 13:34 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: Fumiaki Isoya, gcc
Hi -
On Wed, Aug 08, 2012 at 06:23:52AM -0700, Ian Lance Taylor wrote:
> [...]
> > This has been merged into gnu binutils some time ago, though is not
> > widely known, and only used by a single cgen-based gas port. See the
> > OBJ_COMPLEX_RELC conditionals in gas/*, the BSF_*RELC/STT_RELC logic
> > in bfd/*.
>
> Thanks, I was trying to remember that.
>
> It is perhaps also worth noting that the IEEE-695 object file format
> supports arbitrary expressions in a number of different ways,
> including for relocation calculations. The format is not widely used
> today, for more or less that reason.
It is quite different from ELF for sure. One certainly wouldn't want
to use such a complex-relocation facility unnecessarily - when the
hard-coded normal ones will do the job. But if you need something
more, and are willing to pay the longer linking time (than what?),
it's worth considering.
- FChE
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: The Extension to ELF
2012-08-08 11:23 ` Frank Ch. Eigler
2012-08-08 13:24 ` Ian Lance Taylor
@ 2012-08-08 15:42 ` Fumiaki Isoya
2012-08-08 16:23 ` Frank Ch. Eigler
1 sibling, 1 reply; 9+ messages in thread
From: Fumiaki Isoya @ 2012-08-08 15:42 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc
> It may interest you to know that, for an older Cygnus project (mep),
> we implemented a facility called computed/complex relocations, as an
> ELF extension. This is a way of encoding general symbol/arithmetic
> expressions to be evaluated at link time and substituted into the
> binary output. (It may be similar to the vms-alpha ETIR facility.)
Did you write some compiler language to evaluate that feature?
How is the idea of adopting it as the standard format of GNU Hurd?
- Isoyaf
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: The Extension to ELF
2012-08-08 15:42 ` Fumiaki Isoya
@ 2012-08-08 16:23 ` Frank Ch. Eigler
2012-08-08 17:36 ` Fumiaki Isoya
0 siblings, 1 reply; 9+ messages in thread
From: Frank Ch. Eigler @ 2012-08-08 16:23 UTC (permalink / raw)
To: Fumiaki Isoya; +Cc: Ian Lance Taylor, gcc
Fumiaki Isoya <isoyaf@gmail.com> writes:
>> It may interest you to know that, for an older Cygnus project (mep),
>> we implemented a facility called computed/complex relocations, as an
>> ELF extension. This is a way of encoding general symbol/arithmetic
>> expressions to be evaluated at link time and substituted into the
>> binary output. [...]
>
> Did you write some compiler language to evaluate that feature?
No. Software for this particular was mainly coded in assembly, and
the assembly language / instruction set were itself very
configurable(!), so relocations had to be general. If this capability
is useful for a higher-level language, a binding would have to be
created, and the arch gas/binutils would have to start generating the
info.
> How is the idea of adopting it as the standard format of GNU Hurd?
I have no opinion on this. Note though that these complex relocations
are encoded within a standard ELF file (merely using separate
relocation-type and symbol-type codes). There is no need for an
OS/kernel to support it, since all the action takes place within the
assembler and linker.
- FChE
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: The Extension to ELF
2012-08-08 16:23 ` Frank Ch. Eigler
@ 2012-08-08 17:36 ` Fumiaki Isoya
0 siblings, 0 replies; 9+ messages in thread
From: Fumiaki Isoya @ 2012-08-08 17:36 UTC (permalink / raw)
To: Frank Ch. Eigler; +Cc: gcc
> > How is the idea of adopting it as the standard format of GNU Hurd?
>
> I have no opinion on this. Note though that these complex relocations
> are encoded within a standard ELF file (merely using separate
> relocation-type and symbol-type codes). There is no need for an
> OS/kernel to support it, since all the action takes place within the
> assembler and linker.
OK. I do discard my idea trying to cover shared library. But I
believe that if such gas were the standard assembler, anyone will be
able to write lightweight OO compiler language comparatively easily.
- Isoyaf
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-08-08 17:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-08 5:39 The Extension to ELF Fumiaki Isoya
2012-08-08 6:32 ` Ian Lance Taylor
2012-08-08 7:47 ` Fumiaki Isoya
2012-08-08 11:23 ` Frank Ch. Eigler
2012-08-08 13:24 ` Ian Lance Taylor
2012-08-08 13:34 ` Frank Ch. Eigler
2012-08-08 15:42 ` Fumiaki Isoya
2012-08-08 16:23 ` Frank Ch. Eigler
2012-08-08 17:36 ` Fumiaki Isoya
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).