Commit Graph

9 Commits

Author SHA1 Message Date
Peter Wemm
f41325db5f With this commit, I hereby pronounce gensetdefs past its use-by date.
Replace the a.out emulation of 'struct linker_set' with something
a little more flexible.  <sys/linker_set.h> now provides macros for
accessing elements and completely hides the implementation.

The linker_set.h macros have been on the back burner in various
forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()),
John Polstra (ELF clue) and myself (cleaned up API and the conversion
of the rest of the kernel to use it).

The macros declare a strongly typed set.  They return elements with the
type that you declare the set with, rather than a generic void *.

For ELF, we use the magic ld symbols (__start_<setname> and
__stop_<setname>).  Thanks to Richard Henderson <rth@redhat.com> for the
trick about how to force ld to provide them for kld's.

For a.out, we use the old linker_set struct.

NOTE: the item lists are no longer null terminated.  This is why
the code impact is high in certain areas.

The runtime linker has a new method to find the linker set
boundaries depending on which backend format is in use.

linker sets are still module/kld unfriendly and should never be used
for anything that may be modular one day.

Reviewed by:	eivind
2001-06-13 10:58:39 +00:00
Peter Wemm
240a9a7ab3 Remove underscores from linker set stabs for the a.out case, after
the demise of asnames.h.
2001-02-25 07:24:03 +00:00
Marcel Moolenaar
d2d42f89d5 o Add explicit alignment to linker set definitions. On i386, data
declarations will not be aligned by default.
o  Remove the alignment work-around for alpha. Our current alpha
   as(1) does not assume alignment after section switching, nor
   does the ia64 as(1).
2001-01-29 01:46:50 +00:00
Doug Rabson
c7821f3ffd Change ".align 3" to ".p2align 3" so that this works with ia64. 2000-09-29 13:35:57 +00:00
John Polstra
64cb419d61 Add a comment explaining the obscure lines:
static void const * const __set_##set##_sym_##sym = &sym;

in the MAKE_SET macros.
2000-05-13 04:38:50 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Peter Wemm
240ee5d0e0 ABS_SET() and BSS_SET() are no longer used. The sole remaining user of
TEXT_SET() is DDB's command tables.
1999-06-26 12:27:01 +00:00
Peter Wemm
05aec5db24 ls_items[] is most definately not a set of pointers to const objects..
sysinits, for example, are sorted by swapping those objects(!).  Perhaps
they should be const and the sysinit sorting should be swapping the
pointers rather than the targets.  This is on my revisit list, but it
has the side effect of removing a lot of warnings.  With -Wcast-qual, it
doesn't seem easy to get rid of the constness when you *know* it's not.
(With apologies to bde, this essentially reverts rev 1.21 of kernel.h
 from back in 1996)
1999-05-08 12:52:26 +00:00
John Polstra
045205a869 Move the linker set definitions into a new header file
<sys/linker_set.h>.  <sys/kernel.h> includes the new header, so
functionally everything is still the same.
1999-01-14 05:48:46 +00:00