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>, linux-kernel@vger.kernel.org
Subject: Re: in-kernel linking issues
Date: Fri, 15 Nov 2002 14:30:45 -0800	[thread overview]
Message-ID: <20021115143045.C25624@twiddle.net> (raw)
In-Reply-To: <20021115131645.A2168@flint.arm.linux.org.uk>; from rmk@arm.linux.org.uk on Fri, Nov 15, 2002 at 01:16:45PM +0000

On Fri, Nov 15, 2002 at 01:16:45PM +0000, Russell King wrote:
> I'm slightly worried about this.  For things like shared libraries to be
> relocatable on ARM on current toolchains, you need to build with -fPIC.

Err, no you don't.  You only need that if you want to share pages,
which is clearly not an issue with kernel modules.  There are no
restrictions of which I am aware that require ARM to build with -fpic.

My test case,

	int i;
	int foo() { return bar() + i; }
	int j __attribute__((section(".init.data")));
	int __attribute__((section(".init.text")))
	baz() { return i + j; }

works exactly as desired on ARM:

Disassembly of section .text:

00000000 <foo>:
   0:   e52de004        str     lr, [sp, -#4]!
   4:   ebfffffe        bl      4 <foo+0x4>
   8:   e59f3008        ldr     r3, [pc, #8]    ; 18 <foo+0x18>
   c:   e5933000        ldr     r3, [r3]
  10:   e0800003        add     r0, r0, r3
  14:   e49df004        ldr     pc, [sp], #4

Disassembly of section .init.text:

00001000 <baz>:
    1000:       e59f3010        ldr     r3, [pc, #16]   ; 1018 <baz+0x18>
    1004:       e5930000        ldr     r0, [r3]
    1008:       e59f300c        ldr     r3, [pc, #12]   ; 101c <baz+0x1c>
    100c:       e5933000        ldr     r3, [r3]
    1010:       e0800003        add     r0, r0, r3
    1014:       e1a0f00e        mov     pc, lr

Relocation section '.rel.dyn' at offset 0x11258 contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000004  00001501 R_ARM_PC24        00000000   bar
00000018  00001202 R_ARM_ABS32       00000040   i
00001018  00001202 R_ARM_ABS32       00000040   i
0000101c  00000f02 R_ARM_ABS32       00001020   j



r~

  reply	other threads:[~2002-11-15 22:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20021114143701.A30355@twiddle.net.suse.lists.linux.kernel>
2002-11-15  4:13 ` in-kernel linking issues 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 [this message]
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
2002-11-14 22:37 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

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=20021115143045.C25624@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