Problem Loading a Module Compiled with GCC 3.4.2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem Loading a Module Compiled with GCC 3.4.2

Ajitpal Singh
Hi All,

I have a kernel module which uses a function from a library file( .lib).

This function takes as a paramater a character pointer of string
buffer and simply prints that string.

This library file has been created by me using ld.

a) When I compile the module and link it with the libary file using
GCC Version 3.4.2(Supplied with Fedora Core 3,Kernel Version is 2.6.9)
and insmod it
I get a Kernel OOPS.


b) But if I compile the module with GCC 3.2.2 (Supplied with RedHat 9)
everything works fine and the module loads successfully.


Kindly could you please tell what could be the problem.

Best Regards,
Ajitpal Singh
Reply | Threaded
Open this post in threaded view
|

Re: Problem Loading a Module Compiled with GCC 3.4.2

Nick Clifton
Hi Ajitpal,

> a) When I compile the module and link it with the libary file using
> GCC Version 3.4.2(Supplied with Fedora Core 3,Kernel Version is 2.6.9)
> and insmod it
> I get a Kernel OOPS.
>
> b) But if I compile the module with GCC 3.2.2 (Supplied with RedHat 9)
> everything works fine and the module loads successfully.
>
>
> Kindly could you please tell what could be the problem.

Most likely - there is something different between the two command lines
being used to either compile, assemble or link your library and module.
  Try comparing these command lines to see what has changed.

Cheers
   Nick


Reply | Threaded
Open this post in threaded view
|

Re: Problem Loading a Module Compiled with GCC 3.4.2

SandeepKsinha
In reply to this post by Ajitpal Singh
On 1/13/06, Ajitpal Singh <[hidden email]> wrote:

> Hi All,
>
> I have a kernel module which uses a function from a library file( .lib).
>
> This function takes as a paramater a character pointer of string
> buffer and simply prints that string.
>
> This library file has been created by me using ld.
>
> a) When I compile the module and link it with the libary file using
> GCC Version 3.4.2(Supplied with Fedora Core 3,Kernel Version is 2.6.9)
> and insmod it
> I get a Kernel OOPS.
>
>
> b) But if I compile the module with GCC 3.2.2 (Supplied with RedHat 9)
> everything works fine and the module loads successfully.
>

Well, I think it might be due the change in the kernel also. The RH9
has basically a 2.4 kernel and wriitng and compiling modules for a 2.4
kernel is totally different  from the way its written for a 2.6
kernel.

The compilation process is totally different in both thses cases.
I also faced the same problem, when i wrote a kernel module for the first time.
So google, writing kernel module for 2.4 kernel and 2.6 kernel, you
will get a way.


--
Regards,
Sandeep





A candle loses nothing if it is used to light another one!