mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Jones <cjones@sutus.com>
To: linux-kernel@vger.kernel.org
Subject: Problems during assembly of Kernel Module.
Date: Thu, 17 Jun 2004 11:30:31 -0700	[thread overview]
Message-ID: <20040617183031.GA6981@qworks.ca> (raw)


Hello all;

After quite some effort investigation and discussion on the crossgcc
mailing group.

I decided to bring my problem here.

I am trying to compile a kernel module for a mips32 chip.

I am having problems with the <asm/uaccess.h> (asm-mips/uaccess) inline 
assembly routines for both get_user() and put_user().

Both of these generate inline assembly. In specific a line:

   j    2b

My mips compiler does not like this very much and complains loudly:

   /tmp/ccw6NzZv.s: Assembler messages:
   /tmp/ccw6NzZv.s:128: Error: Cannot branch to symbol in another
   section.


This program seems to compile FINE on x86 since the x86 assembly seems
to have been re-written and put in arch/i386/lib/getuser.S and the
functions __get_user() in <asm-x86/uaccess.h> seems to be obsolete.

I have included a sample module using one of these calls to demonstrate
the problem. I have tried several different cross-compilers and one
native mips compiler all giving the same complaint on the "j  2b"
instruction.

I am definitely NOT a kernel module expert, but have done my best to
track down the problem and give a sample program.

Any help would be much appreciated.

Cheers,

      -=chris

x86 -> x86:
-------------
gcc -I/location_of_my_kernel_includes -DMODULE -D__KERNEL__ -c
moduletest.c

x86 -> mips:
-------------
mipsel-unknown-linux-gnu-gcc -I/location_of_my_kernel_includes -DMODULE
-D__KERNEL__ -mips32 -c moduletest.c

mips -> mips:
-------------
gcc -I/location_of_my_kernel_inclues -mips32  -DMODULE -D__KERNEL__ -c
moduletest.c


#include <linux/kernel.h>
#include <linux/module.h>


#include <linux/ppp_channel.h>


int init_module() {
      int j=1;
      unsigned long data;
      int foo = 1024;
      data = &foo;
      //OFFENDING k_call -> get_user() : See <asm/uaccess.h>
      // Generates "j 2b" assembly
      get_user(j,(int *)data);
      return 0;
}

void cleanup_module() {
}

-- 
                  Chris Jones | Software Developer | Sutus, Inc.
                 t: +1.604.987.8866 x 2204 | e: cjones@sutus.com

                 reply	other threads:[~2004-06-17 18:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20040617183031.GA6981@qworks.ca \
    --to=cjones@sutus.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®