9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Format for relocatable objects
       [not found] <6b1edbf6593b4f3ad0b0c6211180e565@terzarima.net>
@ 2009-01-06 20:04 ` lucio
  2009-01-06 20:09   ` erik quanstrom
  2009-01-06 21:12   ` Charles Forsyth
  0 siblings, 2 replies; 10+ messages in thread
From: lucio @ 2009-01-06 20:04 UTC (permalink / raw)
  To: 9fans

> one nice thing about the scheme is that in the compiler suite
> only the loader knows or needs to know
> the bit patterns and peculiar properties of the actual machine.

Thank you for reminding me, I thought I'd seen the details somewhere.
Now to actually absorb them, given that if I were to read your
comments literally, I'd assume that the intermediate code would be
machine independent.  Seeing that such is not the case, I'd better
look a little deeper.

It would be a shame (but no disaster) if Binutil's "nm" and other
tools could not at least display native Plan 9 intermediate files.  I
need to know or decide how far to take this exercise.

++L




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] Format for relocatable objects
  2009-01-06 20:04 ` [9fans] Format for relocatable objects lucio
@ 2009-01-06 20:09   ` erik quanstrom
  2009-01-06 22:47     ` Roman V. Shaposhnik
  2009-01-06 21:12   ` Charles Forsyth
  1 sibling, 1 reply; 10+ messages in thread
From: erik quanstrom @ 2009-01-06 20:09 UTC (permalink / raw)
  To: lucio, 9fans

> It would be a shame (but no disaster) if Binutil's "nm" and other
> tools could not at least display native Plan 9 intermediate files.  I
> need to know or decide how far to take this exercise.

why would that be advantagous on plan 9?  if you teach
gcc to output, e.g., 8.out, then what is gained by having
gnu binutils version of nm?

- erik




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] Format for relocatable objects
  2009-01-06 20:04 ` [9fans] Format for relocatable objects lucio
  2009-01-06 20:09   ` erik quanstrom
@ 2009-01-06 21:12   ` Charles Forsyth
  1 sibling, 0 replies; 10+ messages in thread
From: Charles Forsyth @ 2009-01-06 21:12 UTC (permalink / raw)
  To: lucio, 9fans

>Now to actually absorb them, given that if I were to read your
>comments literally, I'd assume that the intermediate code would be
>machine independent.

not if you're reading my comments literally. i'd already observed
that "they contain target-dependent code but not precise machine instructions",
before saying "only the loader knows or needs to know the bit patterns
and peculiar properties of the actual machine".  given that it's target-dependent
it certainly isn't machine independent.  it's target-dependent because
register allocation has been done with regard to the target register set, and because
the compiler has generated code that refers to instructions (including
virtual instructions) available on that target (eg, AMULHW or AMULHWCC
on the powerpc, but not on the x86).

the set of instructions used by the compiler for a given
target is represented by a set of enumeration values in 5.out.h, q.out.h, etc.
the compiler and assembler cannot use anything outside that set. the instructions are represented
in the .[8kvq5...] files by those enumeration values; that includes virtual
instructions and pseudo-ops such as ANAME, ASIGNAME, ATEXT, and AGLOBL.
the enum values are written as one or two-byte value, followed by operand descriptors.
the operands to instructions resemble those on the target, so that they can use
double-indexing if the machine supports that, or shift/rotate (cf. ARM).
they are virtual to the extent that some irregularities of the actual processor
are glossed over, and also because external references are by name, not by address.
the representation is therefore an abstraction of the real machine,
but it isn't machine independent. different machines have different types and numbers
of operands, and different representations in detail for them.

libmach has modules 5obj.c kobj.c etc. that interpret the formats for the benefit
of nm and ar amongst others.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] Format for relocatable objects
  2009-01-06 20:09   ` erik quanstrom
@ 2009-01-06 22:47     ` Roman V. Shaposhnik
  2009-01-06 22:54       ` erik quanstrom
  2009-01-07  3:40       ` lucio
  0 siblings, 2 replies; 10+ messages in thread
From: Roman V. Shaposhnik @ 2009-01-06 22:47 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs; +Cc: lucio


On Tue, 2009-01-06 at 15:09 -0500, erik quanstrom wrote:
> > It would be a shame (but no disaster) if Binutil's "nm" and other
> > tools could not at least display native Plan 9 intermediate files.  I
> > need to know or decide how far to take this exercise.
>
> why would that be advantagous on plan 9?  if you teach
> gcc to output, e.g., 8.out, then what is gained by having
> gnu binutils version of nm?

Not *on* Plan9, but *for* Plan9: think cross-environment.

Thanks,
Roman.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] Format for relocatable objects
  2009-01-06 22:47     ` Roman V. Shaposhnik
@ 2009-01-06 22:54       ` erik quanstrom
  2009-01-06 23:07         ` Roman V. Shaposhnik
  2009-01-07  3:40       ` lucio
  1 sibling, 1 reply; 10+ messages in thread
From: erik quanstrom @ 2009-01-06 22:54 UTC (permalink / raw)
  To: 9fans

> On Tue, 2009-01-06 at 15:09 -0500, erik quanstrom wrote:
>> > It would be a shame (but no disaster) if Binutil's "nm" and other
>> > tools could not at least display native Plan 9 intermediate files.  I
>> > need to know or decide how far to take this exercise.
>>
>> why would that be advantagous on plan 9?  if you teach
>> gcc to output, e.g., 8.out, then what is gained by having
>> gnu binutils version of nm?
>
> Not *on* Plan9, but *for* Plan9: think cross-environment.

let's just assume that everyone here knows where to find linux.

- erik




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] Format for relocatable objects
  2009-01-06 22:54       ` erik quanstrom
@ 2009-01-06 23:07         ` Roman V. Shaposhnik
  2009-01-07  3:45           ` lucio
  0 siblings, 1 reply; 10+ messages in thread
From: Roman V. Shaposhnik @ 2009-01-06 23:07 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Tue, 2009-01-06 at 17:54 -0500, erik quanstrom wrote:
> > On Tue, 2009-01-06 at 15:09 -0500, erik quanstrom wrote:
> >> > It would be a shame (but no disaster) if Binutil's "nm" and other
> >> > tools could not at least display native Plan 9 intermediate files.  I
> >> > need to know or decide how far to take this exercise.
> >>
> >> why would that be advantagous on plan 9?  if you teach
> >> gcc to output, e.g., 8.out, then what is gained by having
> >> gnu binutils version of nm?
> >
> > Not *on* Plan9, but *for* Plan9: think cross-environment.
>
> let's just assume that everyone here knows where to find linux.

Well, that's what I meant: binutils on Linux (or any other UNIX
for that matter) understood Plan9's *.out files you can set up
a cross-environment *on Linux* and deploy on Plan9. I'm not sure
its a killer application, but its a use case.

Thanks,
Roman.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] Format for relocatable objects
  2009-01-06 22:47     ` Roman V. Shaposhnik
  2009-01-06 22:54       ` erik quanstrom
@ 2009-01-07  3:40       ` lucio
  1 sibling, 0 replies; 10+ messages in thread
From: lucio @ 2009-01-07  3:40 UTC (permalink / raw)
  To: 9fans

> Not *on* Plan9, but *for* Plan9: think cross-environment.

I thought about that, but dismissed it because Plan 9 objects exist
only in a Plan 9 environment in the scenario Erik envisages.  But,
funny enough, I am currently using NetBSD as my GCC platform, so your
point is not entirely irrelevant.

++L




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] Format for relocatable objects
  2009-01-06 23:07         ` Roman V. Shaposhnik
@ 2009-01-07  3:45           ` lucio
  0 siblings, 0 replies; 10+ messages in thread
From: lucio @ 2009-01-07  3:45 UTC (permalink / raw)
  To: 9fans

> Well, that's what I meant: binutils on Linux (or any other UNIX
> for that matter) understood Plan9's *.out files you can set up
> a cross-environment *on Linux* and deploy on Plan9. I'm not sure
> its a killer application, but its a use case.

It's also a necessity in order to bootstrap the GCC compiler, although
you need it only once.  The other option is to go back into
pre-history and compile a very old version of GCC under KenCC, but
then the number of iterations may be much greater.

You don't need the Binutils for anything other than executables, but I
was hoping to get them for free or at least at a very low price, it
seems that is not the case.

++L

PS: I may still go as far back as that, because GCC 2.95 (my memory
may be faulty there) was a benchmark compiler (just before the EGCS
fad) and may be worth keeping around as a reference.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] Format for relocatable objects
  2009-01-06 18:47 lucio
@ 2009-01-06 20:11 ` Charles Forsyth
  0 siblings, 0 replies; 10+ messages in thread
From: Charles Forsyth @ 2009-01-06 20:11 UTC (permalink / raw)
  To: lucio, 9fans

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

.[8kvq965] ... files are unrelated to a.out.

as ken thompson's paper says
	The object files are binary forms of assembly language,
	similar to what might be passed between
	the first and second passes of an assembler.
they  contain target-dependent code but not precise machine instructions
(the loader makes the final choice of machine instructions).

one nice thing about the scheme is that in the compiler suite
only the loader knows or needs to know
the bit patterns and peculiar properties of the actual machine.

[-- Attachment #2: Type: message/rfc822, Size: 2620 bytes --]

From: lucio@proxima.alt.za
To: 9fans@9fans.net
Subject: [9fans] Format for relocatable objects
Date: Tue, 6 Jan 2009 20:47:06 +0200
Message-ID: <f9a3ba290cd70e70c7dbfe2e161edba8@proxima.alt.za>

Where should I look for the format of Plan 9 objects as created by the
compiler(s) and ready for linking?  I'm hoping there is a place other
than the compiler sources that documents this intermediate format,
which I presume is not totally unlike a.out.

Also, while I'm asking, there must be more than a hint of ELF in the
Linux emulation code, can someone point me to the details?  ELF is low
on my list of favourites, but there may be some useful shortcuts in
giving it a bit of recognition under Plan 9.

++L

PS: in case the context isn't obvious, GNU CC and C++ for Plan 9 are
the eventual objectives, I'm taking a slightly circular approach in an
attempt to understand David Hogan's work a lot better than I do now.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [9fans] Format for relocatable objects
@ 2009-01-06 18:47 lucio
  2009-01-06 20:11 ` Charles Forsyth
  0 siblings, 1 reply; 10+ messages in thread
From: lucio @ 2009-01-06 18:47 UTC (permalink / raw)
  To: 9fans

Where should I look for the format of Plan 9 objects as created by the
compiler(s) and ready for linking?  I'm hoping there is a place other
than the compiler sources that documents this intermediate format,
which I presume is not totally unlike a.out.

Also, while I'm asking, there must be more than a hint of ELF in the
Linux emulation code, can someone point me to the details?  ELF is low
on my list of favourites, but there may be some useful shortcuts in
giving it a bit of recognition under Plan 9.

++L

PS: in case the context isn't obvious, GNU CC and C++ for Plan 9 are
the eventual objectives, I'm taking a slightly circular approach in an
attempt to understand David Hogan's work a lot better than I do now.




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-07  3:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <6b1edbf6593b4f3ad0b0c6211180e565@terzarima.net>
2009-01-06 20:04 ` [9fans] Format for relocatable objects lucio
2009-01-06 20:09   ` erik quanstrom
2009-01-06 22:47     ` Roman V. Shaposhnik
2009-01-06 22:54       ` erik quanstrom
2009-01-06 23:07         ` Roman V. Shaposhnik
2009-01-07  3:45           ` lucio
2009-01-07  3:40       ` lucio
2009-01-06 21:12   ` Charles Forsyth
2009-01-06 18:47 lucio
2009-01-06 20:11 ` Charles Forsyth

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 NNTP newsgroup(s).