Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Dec 2000 22:24:10 -0800 (PST)
From:      John Polstra <TrimYourCc@polstra.com>
To:        arch@freebsd.org
Subject:   Re: gensetdefs using sh(1),sed(1),grep(1) and awk(1)
Message-ID:  <200012220624.eBM6OA575353@vashon.polstra.com>
In-Reply-To: <200012210628.eBL6Sd773356@vashon.polstra.com>
References:  <3A405A43.5C10697C@cup.hp.com> <20001220115432.B10298@dragon.nuxi.com> <20001221103548.A10223@rafe.jeamland.net> <200012210628.eBL6Sd773356@vashon.polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Having thought about it some more today ... I think what we ought to
do is not improve gensetdefs but rather eliminate the need for it.
That is feasible but will require a little bit of work.  The binutils
ld has the necessary linker magic to support generating linker sets in
ELF without any special tools.  I looked into it a long time ago when
working on the switch to ELF, but I'll have to look again (probably
after the holidays) to remember exactly how it's done.

The catch is that with the built-in linker sets you don't quite get
the information we currently rely upon.  In particular, you don't get
the int which contains the number of elements in the set.  All you get
is a NULL-terminated vector of pointers to the members of the set.
This is adequate for most of our uses of linker sets, but not for all
of them.  Some of the existing code uses the count word directly.
At the time of the ELF conversion it seemed more expedient to write
gensetdefs than to track down and fix all of the places where the
count word was used.

As I recall, there was also a problem involving some static
initialization used in defining sysctls.

We should go thru all of the uses of linker sets (there aren't that
many of them in the whole source tree) and make them use a more
abstract API that we can reasonably expect to support on any target
system.  The API would be along the lines of a SET_FOREACH() macro in
the spirit of the *_FOREACH macros defined in <sys/queue.h>.

There _could_ be a SET_COUNT() macro to give the total number
of elements in a set.  The easy way to do this would be to just
have it count the elements, but that's fairly inefficient.  I
also toyed around with computing the counts just once at system
initialization time, and that may be feasible.  The idea is to have
a master set-of-all-linker-sets which is itself a linker set.  At
initialization time, you iterate over the members of the master set
and count and record the length of each member.

John
-- 
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Disappointment is a good sign of basic intelligence."  -- Chögyam Trungpa



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012220624.eBM6OA575353>