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.
1. 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:
# -*- makefile -*-
#
# arch/aarch64/MCONFIG
#
# Special rules for this architecture. Note that this is actually
# included from the main Makefile, and that pathnames should be
# accordingly.
#
CPU_ARCH ?= armv8-a
CPU_TUNE ?= generic
KLIBCOPTFLAGS += -Os -march=$(CPU_ARCH) -mtune=$(CPU_TUNE)
KLIBCBITSIZE = 64
KLIBCREQFLAGS += -fno-exceptions
#KLIBCSTRIPFLAGS += -R .ARM.exidx
# Extra linkflags when building the shared version of the library
# This address needs to be reachable using normal inter-module
# calls, and work on the memory models for this architecture
#KLIBCSHAREDFLAGS = -Ttext 0x01800200 <-- Is this value correct..?#KLIBCREQFLAGS +=
#KLIBCOPTFLAGS += -mgeneral-regs-only
2. 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.