From: Gordon McNutt <gmcnutt@ridgerun.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-mips@oss.sgi.com, linux-mips@fnet.fr
Subject: Re: insmod hates RELA?
Date: Fri, 06 Oct 2000 07:22:14 -0600 [thread overview]
Message-ID: <39DDD206.19443FAB@ridgerun.com> (raw)
In-Reply-To: Pine.GSO.3.96.1001006121819.26752C-100000@delta.ds2.pg.gda.pl
"Maciej W. Rozycki" wrote:
> On Fri, 6 Oct 2000, Ralf Baechle wrote:
>
> > A possible explanation would be that you use the wrong binutils, have a
> > corrupt module file or try to load a module for another architecture or
> > modutils being plain broken?
>
> The linker tends to create empty .rela sections even if there is no input
> for them. This actually is a minor error and until (unless) we modify the
> linker just use the quick fix for modutils that is available from my FTP
> site (not that these modutils actually work ;-) ).
>
> --
> + Maciej W. Rozycki, Technical University of Gdansk, Poland +
> +--------------------------------------------------------------+
> + e-mail: macro@ds2.pg.gda.pl, PGP key available +
On the advice of a colleague I switched to an older version of gcc (2.90.29)
which got rid of the RELA problem (I was using 2.96). I've now gotten further
toward my goal of inserting a module.
But I'm not there yet. insmod (2.3.9) now complains about a relocation
overflow on all of the kernel symbols. I'm looking at the source for insmod
now. At the moment I'm trying to figure out why insmod wants to relocate
kernel symbols. After patching in the values from ksym, it tries to relocate
kernel symbols along with all the local symbols. Seems like a mismatch
between what insmod expects the ELF to look like and what gcc wants to
generate. Maybe I'm missing a gcc option or something? Here's the options I'm
using to build the module:
/usr/bin/mips-linux-gcc -D__KERNEL__ -DMODULE -I../include -Wall
-Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce
-DMODVERSIONS -G 0 -mno-abicalls -mcpu=r5000 -pipe -fno-pic -mips2
I've looked a little more since writing the above. The relocation errors are
occurring in the .bss section, where it appears insmod is iterating over all
references to a symbol and doing a relocation. The type of relocation done
for all symbols is associated with the 'R_MIPS_26' #define (see linux/elf.h).
Does anyone know much about this? Does this mean that symbols will be
relocated to a 26-bit offset from some known base? If so, then how is it
supposed to deal with kernel symbols? The problem appears when insmod
verifies that the symbol's address is within a certain range of the section
header. Not unexpectedly, the ksyms don't satisfy this check. They're way out
of there.
Is this a bug in insmod?
Anyway, thanks for the help
--Gordon
WARNING: multiple messages have this Message-ID (diff)
From: Gordon McNutt <gmcnutt@ridgerun.com>
Cc: linux-mips@oss.sgi.com, linux-mips@fnet.fr
Subject: Re: insmod hates RELA?
Date: Fri, 06 Oct 2000 07:22:14 -0600 [thread overview]
Message-ID: <39DDD206.19443FAB@ridgerun.com> (raw)
Message-ID: <20001006132214.-HK7djfRWHpFd8EgQB1f5hb4KY6DWyfq70gRHw48RTw@z> (raw)
In-Reply-To: Pine.GSO.3.96.1001006121819.26752C-100000@delta.ds2.pg.gda.pl
"Maciej W. Rozycki" wrote:
> On Fri, 6 Oct 2000, Ralf Baechle wrote:
>
> > A possible explanation would be that you use the wrong binutils, have a
> > corrupt module file or try to load a module for another architecture or
> > modutils being plain broken?
>
> The linker tends to create empty .rela sections even if there is no input
> for them. This actually is a minor error and until (unless) we modify the
> linker just use the quick fix for modutils that is available from my FTP
> site (not that these modutils actually work ;-) ).
>
> --
> + Maciej W. Rozycki, Technical University of Gdansk, Poland +
> +--------------------------------------------------------------+
> + e-mail: macro@ds2.pg.gda.pl, PGP key available +
On the advice of a colleague I switched to an older version of gcc (2.90.29)
which got rid of the RELA problem (I was using 2.96). I've now gotten further
toward my goal of inserting a module.
But I'm not there yet. insmod (2.3.9) now complains about a relocation
overflow on all of the kernel symbols. I'm looking at the source for insmod
now. At the moment I'm trying to figure out why insmod wants to relocate
kernel symbols. After patching in the values from ksym, it tries to relocate
kernel symbols along with all the local symbols. Seems like a mismatch
between what insmod expects the ELF to look like and what gcc wants to
generate. Maybe I'm missing a gcc option or something? Here's the options I'm
using to build the module:
/usr/bin/mips-linux-gcc -D__KERNEL__ -DMODULE -I../include -Wall
-Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce
-DMODVERSIONS -G 0 -mno-abicalls -mcpu=r5000 -pipe -fno-pic -mips2
I've looked a little more since writing the above. The relocation errors are
occurring in the .bss section, where it appears insmod is iterating over all
references to a symbol and doing a relocation. The type of relocation done
for all symbols is associated with the 'R_MIPS_26' #define (see linux/elf.h).
Does anyone know much about this? Does this mean that symbols will be
relocated to a 26-bit offset from some known base? If so, then how is it
supposed to deal with kernel symbols? The problem appears when insmod
verifies that the symbol's address is within a certain range of the section
header. Not unexpectedly, the ksyms don't satisfy this check. They're way out
of there.
Is this a bug in insmod?
Anyway, thanks for the help
--Gordon
next prev parent reply other threads:[~2000-10-06 13:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <39DCDBA0.8EED1CBD@ridgerun.com>
2000-10-06 2:51 ` insmod hates RELA? Ralf Baechle
2000-10-06 10:26 ` Maciej W. Rozycki
2000-10-06 10:57 ` Keith Owens
2000-10-06 12:05 ` Maciej W. Rozycki
2000-10-06 13:22 ` Gordon McNutt [this message]
2000-10-06 13:22 ` Gordon McNutt
2000-10-06 13:51 ` Keith Owens
2000-10-06 14:52 ` Gordon McNutt
2000-10-06 14:52 ` Gordon McNutt
2000-10-06 15:14 ` Maciej W. Rozycki
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=39DDD206.19443FAB@ridgerun.com \
--to=gmcnutt@ridgerun.com \
--cc=linux-mips@fnet.fr \
--cc=linux-mips@oss.sgi.com \
/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