# Re: Cross compiling : problem linking

- From: Wolfgang Denk \<hidden\>
- Date: 2003-10-02 15:01:44 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2003/10/9389998
- Thread: https://ratatoskr.run/linuxppc-dev/2003/10/9389998/t.md

```text

In message <1065104646.13376.8.camel@toni> you wrote:
>
> > Without more information (i. e. what sort of code this is and how you
> > intend it to run - stdandalone, in kernel or in user context)  nobody
> > can help you.
>
> Final goal is a kernel module, but now I'm writing a test program in
> user space (standalone, dynamic compiled).

These are two completely different issues.

> Code is quite simple (but I'm unsure about the correctness, due to the
> fact that my C knowledge has collapsed since I didn't use it anymore
> last 2 years):
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <unistd.h>
> #include <asm/io.h>

You're including a kernel header file here. You must not do this. The
functions / macros you're looking for are not available in user space
(for example, outb is #defined only when __KERNEL__ is defined  which
is never the case for user space applications.)

> So somewhere, there is a linker problem.

No, it's a misunderstanding on your side. You cannot run kernel  code
in user space or vice versa.


Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
I have yet to add the ESP-driver to the kernel to read  the  mind  of
the user...                                       - Linus Torvalds in
      [ref]

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
```
