From: Waldemar Kozaczuk <jwkozac...@gmail.com> Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> Branch: master
vdso: make it work on aarch64 This patch fixes couple of issues with vdso on aarch64. Firstly, it fixed the compilation problem with the .align directive which is interpreted differently on aarch64 (#bytes vs bits). Secondly, it corrects the names of the vdso symbols exported by the library - "__kernel_*" vs "__vdso_*" and which ones are exported. The new arch specific version files have been added to properly export those symbols. Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -2161,7 +2161,7 @@ $(out)/libenviron.so: $(environ_sources) $(out)/libvdso.so: libc/vdso/vdso.c $(makedir) $(call quiet, $(CC) $(CFLAGS) -c -fPIC -o $(out)/libvdso.o libc/vdso/vdso.c, CC libvdso.o) - $(call quiet, $(LD) -shared -fPIC -z now -o $(out)/libvdso.so $(out)/libvdso.o -T libc/vdso/vdso.lds, LINK libvdso.so) + $(call quiet, $(LD) -shared -fPIC -z now -o $(out)/libvdso.so $(out)/libvdso.o -T libc/vdso/vdso.lds --version-script=libc/vdso/$(arch)/vdso.version, LINK libvdso.so) bootfs_manifest ?= bootfs.manifest.skel diff --git a/libc/vdso/aarch64/vdso.version b/libc/vdso/aarch64/vdso.version --- a/libc/vdso/aarch64/vdso.version +++ b/libc/vdso/aarch64/vdso.version @@ -0,0 +1,9 @@ +/* Pretend like we are Linux 2.6.39 */ +LINUX_2.6.39 { + global: + __kernel_gettimeofday; + __kernel_clock_gettime; + __kernel_clock_getres; + local: + *; +}; diff --git a/libc/vdso/vdso.c b/libc/vdso/vdso.c --- a/libc/vdso/vdso.c +++ b/libc/vdso/vdso.c @@ -2,6 +2,7 @@ #include <time.h> #include <sys/time.h> +#ifdef __x86_64__ __attribute__((__visibility__("default"))) time_t __vdso_time(time_t *tloc) { @@ -19,3 +20,24 @@ int __vdso_clock_gettime(clockid_t clk_id, struct timespec *tp) { return clock_gettime(clk_id, tp); } +#endif + +#ifdef __aarch64__ +__attribute__((__visibility__("default"))) +int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz) +{ + return gettimeofday(tv, tz); +} + +__attribute__((__visibility__("default"))) +int __kernel_clock_gettime(clockid_t clk_id, struct timespec *tp) +{ + return clock_gettime(clk_id, tp); +} + +__attribute__((__visibility__("default"))) +int __kernel_clock_getres(clockid_t clk_id, struct timespec *tp) +{ + return clock_getres(clk_id, tp); +} +#endif diff --git a/libc/vdso/vdso.lds b/libc/vdso/vdso.lds --- a/libc/vdso/vdso.lds +++ b/libc/vdso/vdso.lds @@ -25,16 +25,3 @@ PHDRS /*note PT_NOTE FLAGS(4);*/ eh_frame_hdr PT_GNU_EH_FRAME FLAGS(4); } - -/* Pretend like we are Linux 2.6 */ -VERSION -{ - LINUX_2.6 { - global: - __vdso_clock_gettime; - __vdso_gettimeofday; - __vdso_time; - local: - *; - }; -} diff --git a/libc/vdso/x64/vdso.version b/libc/vdso/x64/vdso.version --- a/libc/vdso/x64/vdso.version +++ b/libc/vdso/x64/vdso.version @@ -0,0 +1,9 @@ +/* Pretend like we are Linux 2.6 */ +LINUX_2.6 { + global: + __vdso_clock_gettime; + __vdso_gettimeofday; + __vdso_time; + local: + *; +}; diff --git a/libvdso-content.S b/libvdso-content.S --- a/libvdso-content.S +++ b/libvdso-content.S @@ -1,5 +1,10 @@ .pushsection .data +#ifdef __x86_64__ .align 4096 +#endif +#ifdef __aarch64__ +.align 16 +#endif .global libvdso_start .hidden libvdso_start libvdso_start: -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/00000000000019a5100603f2b2f6%40google.com.