9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] a question on style
@ 2008-07-31 22:02 ron minnich
  2008-07-31 22:04 ` erik quanstrom
  2008-08-01  9:26 ` Roman V. Shaposhnik
  0 siblings, 2 replies; 15+ messages in thread
From: ron minnich @ 2008-07-31 22:02 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

For some time now, over 10 years anyway, the GNU world has been using
the linker to create initialized structs, viz:
static const struct cpu_driver driver __cpu_driver = {
        .ops = &cpu_dev_ops,
        .id_table = cpu_table,
};

(this from linuxbios)

The __cpu_driver is passed to the linker and you end up with an array
of all structs tagged with that name.

These are called linker sets. I first heard of them in 1995 or so when
freebsd moved away from generating arrays of structs from the BSD
config tool and used gld to create those same arrays.

Plan 9 takes the older style approach: a script parses a config file
and creates C code which initializes the struct arrays.

Now, I betray my age, I guess, but I prefer the plan 9 style. I am
curious: am I just out of touch with this modern world?

Why do I like the Plan 9 style?
1. you can figure out what source constitutes the
program/application/os/bios by looking at C code
2. program analysis tools can analyse C code; you don't need binaries
and linker scripts
3. Errors such as empty structs are easier to catch at build time;
we've seen cases where nobody
    built a binary with, e.g., any cpu drivers and we did not know
until the BIOS tried to start
4. If you are using, e.g., Eclipse or Kscope, you can see how code is
invoked and used, which is
    harder when initialized structs are created by the linker.

OK, am I just out of date or is there a real reason for linker
sets?This question just came up in linuxbios v3 and I am wondering if
I am a stubborn old coot (likely) or if there really is merit to my
dislike of linker sets.

ron



^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [9fans] a question on style
@ 2008-07-31 22:17 erik quanstrom
  0 siblings, 0 replies; 15+ messages in thread
From: erik quanstrom @ 2008-07-31 22:17 UTC (permalink / raw)
  To: rminnich, 9fans

> >> OK, am I just out of date or is there a real reason for linker
> >> sets?This question just came up in linuxbios v3 and I am wondering if
> >> I am a stubborn old coot (likely) or if there really is merit to my
> >> dislike of linker sets.
> >
> > why can't both be true?
> >
>
> I suspect both are true ...

would i be rude to agree with you?

- erik



^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <af2f03a68f1be3c97a367093315a9f56@quanstro.net>]
* Re: [9fans] a question on style
@ 2008-08-01 11:41 erik quanstrom
  0 siblings, 0 replies; 15+ messages in thread
From: erik quanstrom @ 2008-08-01 11:41 UTC (permalink / raw)
  To: rvs, 9fans

> > > Now, on the other hand, I guess kernel is different though.
> > > Isn't it supposed to be one huge piece of magic to begin with? ;-)
> >
> > it's supposed to be neither.
>
> Yeah, but Ron was talking 'bout that kernel from Scandinavia,
> right?

uff-da.

- erik



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

end of thread, other threads:[~2008-08-05 22:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-31 22:02 [9fans] a question on style ron minnich
2008-07-31 22:04 ` erik quanstrom
2008-07-31 22:15   ` ron minnich
2008-08-01  9:26 ` Roman V. Shaposhnik
2008-08-01 10:06   ` erik quanstrom
2008-08-01 11:09     ` Roman V. Shaposhnik
2008-07-31 22:17 erik quanstrom
     [not found] <af2f03a68f1be3c97a367093315a9f56@quanstro.net>
2008-07-31 22:19 ` ron minnich
2008-08-01 15:37   ` Steve Simon
2008-08-01 16:28     ` Pietro Gagliardi
2008-08-01 17:24       ` Charles Forsyth
2008-08-01 22:29         ` erik quanstrom
2008-08-03 11:27       ` bblochl
2008-08-05 22:38     ` erik quanstrom
2008-08-01 11:41 erik quanstrom

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).