public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Richard Henderson <rth@twiddle.net>, linux-kernel@vger.kernel.org
Subject: Re: in-kernel linking issues
Date: Sun, 17 Nov 2002 12:59:59 -0800	[thread overview]
Message-ID: <20021117125959.A31315@twiddle.net> (raw)
In-Reply-To: <20021117130132.AA5352C058@lists.samba.org>; from rusty@rustcorp.com.au on Sun, Nov 17, 2002 at 11:46:32PM +1100

Another Idea:

Why build our own __ksymtab section, which contains names and
addresses in some random order that requires a linear search,
when instead we can re-use the dynamic symbol table for the 
shared library.  If we do that, we no longer have a linear search,
but can use the hash table provided by the linker.  Plus we don't
have to work so hard to get rid of it.  ;-)

Consider

#define EXPORT_SYMBOL(sym)			\
	asm (".section .exports\n"		\
	     "	.asciz \"" #sym "\"\n"		\
	     ".previous")

then link with '--version-exports-section ""'.  This will result
in a .dynsym section that contains exactly those symbols we asked
to exported from the module (plus the undefineds, but that's obvious).

This has other benefits in that the linker will now know that
the symbols not exported may be able to have their relocations
satisfied completely at link time, which results in fewer dynamic
relocations.

Along that same vein, we should be using the link option -Bsymbolic,
since we do not allow modules to override one another's symbols,
and this describes that fact to the linker.  Which will result in
even fewer dynamic relocations.

The problem remaining here is to get the same dynamic symbol table
generated for the kernel itself.  This is where we'd really win with
the hashing, since the kernel has by far the largest symbol table.
I'll have to give this some more thought.


r~

  parent reply	other threads:[~2002-11-17 20:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-14 22:37 in-kernel linking issues Richard Henderson
2002-11-16  5:47 ` Rusty Russell
2002-11-16 22:51   ` Richard Henderson
     [not found]     ` <20021117130132.AA5352C058@lists.samba.org>
2002-11-17 20:59       ` Richard Henderson [this message]
     [not found] <20021114143701.A30355@twiddle.net.suse.lists.linux.kernel>
2002-11-15  4:13 ` Andi Kleen
2002-11-15  4:21   ` Richard Henderson
2002-11-15  8:44   ` Rusty Russell
2002-11-15 10:29     ` Andi Kleen
2002-11-15 12:51     ` Richard Henderson
2002-11-15 13:16       ` Russell King
2002-11-15 22:30         ` Richard Henderson
2002-11-15 21:21       ` Rusty Russell
2002-11-15 22:22         ` Richard Henderson
2002-11-15 22:45           ` Rusty Russell
2002-11-15 23:47             ` Richard Henderson
2002-11-16  6:19               ` Rusty Russell
2002-11-18 16:46       ` Kai Germaschewski
2002-11-19  6:26         ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021117125959.A31315@twiddle.net \
    --to=rth@twiddle.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox