uClibc compilation error with nommu

Michael Unterkalmsteiner miciu at gmx.de
Tue Mar 10 21:28:17 UTC 2009


On Tuesday 10 March 2009 12.44.32 Michael Unterkalmsteiner wrote:
> On Tuesday 10 March 2009 11.04.41 Michael Unterkalmsteiner wrote:
> > On Tuesday 10 March 2009 00.32.40 Khem Raj wrote:
> 
> > > > /* uClinux-2.0 has vfork, but Linux 2.0 doesn't */
> > >
> > > You should check if you are using right kernel headers while building
> > > uclibc.
> >
> > Since I'm using buildroot I guess the kernel headers configured there are
> > used: BR2_KERNEL_HEADERS_2_6_28=y
> > BR2_DEFAULT_KERNEL_HEADERS="2.6.28.4"
> 
> Ok, I've investigated this a bit... but I'm not sure if what I found out is 
> true, so if someone could please confirm I'd be glad :-)
> 
> 1. The fork syscall is not implemented on nommu systems:
> >>From linux-source-2.6.28/Documentation/nommu-mmap.txt
> 	"Memory mapping behaviour also involves the way fork(), vfork(), clone() and
> 	ptrace() work. Under uClinux there is no fork(), and clone() must be supplied
> 	the CLONE_VM flag."
> 
> 2. The kernel headers (2.8.28.4) do NOT define __NR_vfork
> linux-2.6.28.4/arch/mips/include/asm/unistd.h:
> 	[...]
> 	/* whitelists for checksyscalls */
> 	#define __IGNORE_select
> 	#define __IGNORE_vfork
> 	[...]
> 
> 3. Ergo the compilation fails since __NR_vfork is indeed not defined and fork() 
> is neither. 
> How to solve that?

[I'll answer myself]
This compilation error is solved by the setting
	UCLIBC_HAS_STUBS=y
in the uclibc config. 
So uclibc compiles fine.

But there's a new error... gcc fails linking:

/home/mlunter/psp/mips-toolchain/buildroot-2009.02/build_mipsel/staging_dir/usr/mipsel-linux-uclibc/bin/ranlib libgcc.a
/home/mlunter/psp/mips-toolchain/buildroot-2009.02/build_mipsel/staging_dir/usr/lib/libc.a(__uClibc_main.os): In function `__uClibc_fini':
__uClibc_main.c:(.text+0x20): undefined reference to `__fini_array_start'
__uClibc_main.c:(.text+0x24): undefined reference to `__fini_array_end'
/home/mlunter/psp/mips-toolchain/buildroot-2009.02/build_mipsel/staging_dir/usr/lib/libc.a(__uClibc_main.os): In function `__uClibc_main':
__uClibc_main.c:(.text+0x1ac): undefined reference to `__preinit_array_start'
__uClibc_main.c:(.text+0x1c4): undefined reference to `__preinit_array_end'
__uClibc_main.c:(.text+0x218): undefined reference to `__init_array_start'
__uClibc_main.c:(.text+0x21c): undefined reference to `__init_array_end'
/home/mlunter/psp/mips-toolchain/buildroot-2009.02/build_mipsel/staging_dir/usr/mipsel-linux-uclibc/bin/ld: ./libgcc_s.so.1.tmp: hidden symbol `__fini_array_end' isn't defined
/home/mlunter/psp/mips-toolchain/buildroot-2009.02/build_mipsel/staging_dir/usr/mipsel-linux-uclibc/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1

I googled up that error but with no satisfying result... 

Thanks,
Michael


More information about the uClibc mailing list