Porting binutils to other OS

Alfeiks Kaanoken (MadTirra) madtirra@jarios.org
Thu Apr 23 19:26:00 GMT 2009


Hello,
Currently I'm working on Open-Source Operating system 
(http://jarios.org) and we're using ELF as a native binary format.
I want to port binutils to new OS (Jari), in this case I have several 
questions.
First - is it anything linux or bsd specific stuff in binutils code base 
(Jari OS has POSIX, but doesn't contain any GNU extensions yet) ?
I mean, what I need to inject to the source code of binutils to run it 
in new OS.
Second - now we're working on dynamic linking and our system doesn't 
have "dummy faked libs" like linux-vdso.so.1 that going on linux (I can 
wrong, but as I know this is a "kernel" part of system linker), and 
specific linkers like ld-linux-x86-64.so.2. I will explain now:
Our system is a microkernel and multiservice based, microkernel doesn't 
know anything about files and binary formats - in this case we're should 
choose to make all runtime linking and resolving job on the process 
service side - it's mean that process service will create an image of an 
existing process (that calls execve) and map all code from libraries 
with r-x access, clone data sections and create bss - this works now 
with static libraries, but I care about dynamic linking, I have built 
Jari libraries dynamically and I see the following:
$ LD_LIBRARY_PATH=. ldd libsexpr.so
   linux-vdso.so.1 =>  (0x00007fff7c7fe000)
   libc.so => ./libc.so (0x00007fac74196000)
$ LD_LIBRARY_PATH=. ldd libvm86.so
   linux-vdso.so.1 =>  (0x00007fffc11ff000)
   libc.so => ./libc.so (0x00007fe7b8cb8000)
$ LD_LIBRARY_PATH=. ldd libpthread.so
   linux-vdso.so.1 =>  (0x00007fff7b9ff000)
   libc.so => ./libc.so (0x00007ffd734f4000)
I've used -nostdlib option to linker, but it hasn't any effects and 
`linux-vdso.so.1' creates anyway. Libc is a "root" of all the libraries 
and since it didn't depend on any other library it looks like the 
following:
LD_LIBRARY_PATH=. ldd libc.so
   statically linked
But it has dynamic section.
I'm confused a little bit, because our parser of the ELF binary (mostly 
built from existing source code) doesn't find linux-vdso.so.1 - is it ok ?
I'm afraid on possible side effects , maybe I should write some 
OS-specific stubs for binutils to link all correctly ?
Libc already has a linker script for executables binaries - but not for 
libs, maybe am I wrong (and I should write OS-specific linker script for 
shared objects)?

Third - I want to compile all OS services, microkernel, applications and 
so on in native OS, not via toolchain, what the specific stub in 
binutils do I need ?


If there are some manual exist - sorry, but I cannot find it, in the 
binutils documentation I didn't find anything related to my issue.

PS Sorry for my worse english.

Thank you.



More information about the Binutils mailing list