On 1 October 2013 15:19, Anil Singhar anil.singhar@linaro.org wrote:
Hi,
I am trying to port klibc to aarch64. My code is available from:
git clone git://git.linaro.org/people/anil.singhar/klibc-aarch64.git
At this point, I am trying to fix the following issues. Any help / comment / advice / suggestion is highly appreciated.
- Need to find the correct value for KLIBCSHAREDFLAGS (What value should I
set Ttext to in the aarch64 specific MCONFIG file?). Right now the MCONFIG looks as follows:
It is hard to answer to this question as I don't know what klibc uses KLIBCSHAREDFLAGS for.
S += -mgeneral-regs-only
- The stat family of syscalls don't work correctly. There is only one
actual syscall: fstat, which is used by lstat and stat. The syscall doesn't seem to return valid values for target files. e.g. The following fields are wrong:
toot@genericarmv8:~/anilss/AArch64/klibc-aarch64/usr/klibc/tests# ./stat test.out Path = test.out st_dev = 0x11 (0,17) st_ino = 5910539 st_mode = 0 st_nlink = 4295000484 <-- This is wrong st_uid = 0 st_gid = 0 st_rdev = 0x0 (0,0) st_size = 15 st_blksize = 1380537164 st_blocks = 223008806 st_atim = 1048576.000000008 st.mtim = 1380612975.029926968 st.ctim = 1380537164.223008806
Because the fields are wrong, the parsed values are also wrong. Applications such as ls, gzip etc. fail to work because they rely on this syscall.
This would imply that the struct stat is defined incorrectly for Aarch64. Looking into the kernel sources ( ./arch/arm64/include/uapi/asm/stat.h points to ./include/uapi/asm-generic/stat.h ) the definition in klibc sources ( ./usr/include/arch/aarch64/klibc/archstat.h ) is indeed incorrect. Once you fix the "struct stat" definition to match what is in the kernel, you should se better results.
Since I am doing the development on ARMv8 Foundation model using linaro openembedded image, is there a debug version of the kernel (the one img-foundation.axf) that I can use to debug the syscall itself in kernel mode using kgdb? Any other debugging ideas..?
Generally speaking it is better to first read the kernel sources related to system call failing before attempting to step in debugger.