Hi Riku,
Thanks for your response.
(1)
I tried correcting the klibc definition of struct stat with the kernel definition of stat64, but still I don't get the correct results. e.g.
root@genericarmv8:~/anilss/AArch64/klibc-aarch64/usr/klibc/tests# ./stat test.out
Path = test.out
st_dev = 0x11 (0,17)
st_ino = 4194908
st_mode = 0
st_nlink = 0
st_uid = 0
st_gid = 0
st_rdev = 0xf (0,15)
st_size = 8
st_blksize = 1380795825
st_blocks = 129482584
st_atim = 1380537164.223008806
st.mtim = 1380537164.223008806
New definition of stat that I tried is:/* This matches struct stat64 in glibc2.1, hence the absolutely
* insane amounts of padding around dev_t's.
* Note: The kernel zero's the padded region because glibc might read them
* in the hope that the kernel has stretched to using larger sizes.
*/
struct stat {
__stdev64 (st_dev);
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
__stdev64 (st_rdev);
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
unsigned long long st_ino;
};
This is same as that in ARM.
Plus I noticed that the original definition that was in klibc for aarch64 (the one with which I have issues) is exactly same as that in x86_64 and there the test works fine. That is bit confusing. On x86_64 it gives the following result (with the same definition that was in aarch64):
anilss@anilss:~/Native/klibc-2.0.1/usr/klibc/tests$ ./stat test.out
Path = test.out
st_dev = 0x801 (8,1)
st_ino = 4857342
st_mode = 0100664
st_nlink = 1
st_uid = 1000
st_gid = 1000
st_rdev = 0x0 (0,0)
st_size = 8399061
st_blksize = 4096
st_blocks = 16408
st_atim = 1380802488.081739059
st.mtim = 1379586488.807291875
st.ctim = 1379586488.807291875
(2)
Per what I have gathered from elsewhere on web, the value of Ttext in KLIBCSHAREDFLAGS should prevent klibc.so from occupying same virtual address space as some other module. May be this understanding is not sufficient.
# 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
#KLIBCREQFLAGS +=
#KLIBCOPTFLAGS += -mgeneral-regs-only