Re: linux object file containing all kernel symbols and suitable for userspace linking?

From: Daniel Rosenthal
Date: Mon Sep 29 2008 - 02:18:23 EST


> These are provided by the linker script.

Ok, I took a look at both vmlinux_32.lds.S and uml.lds.S (I'm assuming
these are the linker scripts). I also took a look at vmlinux. I
didn't realize at first that vmlinux actually has some symbols in it.
I linked vmlinux to my programs using gcc and it compiled, but I got a
segmentation fault when I ran it. What is the appropriate binary
format to use to output the kernel binary so it won't segfault in
userspace? Ideally, I would like to add another target, say
vmlinux-user, that would output the kernel with all the same symbols
that vmlinux contains, but with a binary format suitable for userspace
linkage. It looks from uml.lds.S that you don't use the default ELF
output format for UML. Why is this?

I guess I probably need to write another architecture specific *.lds.S
file called something like vmlinux-user.lds.S and add a few lines to
the Makefile in the root directory to achieve what I am trying to do,
but I would like to find as general a solution as I can so that maybe
other architectures and other people can use the same solution for
doing kernel code unit tests without replicating a lot of code.

By the way, I noticed that you only have a single uml.lds.S file, and
consequently UML probably either only works on x86 (and x86-64), or
uses the same binary layout on all platforms. I couldn't find
anywhere explicitly where you say UML only runs on x86, but just to
clarify, UML is x86 specific, right?

Daniel


> Work email - jdike at linux dot intel dot com

Sorry, I misread the {addtoit,linux.intel} as {addtoit,linux,intel} in
arch/um/Makefile.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/