From da7ccf822c2a7f0413868b8d99029907f1d61a41 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 14 Apr 2015 10:22:12 -0400 Subject: [PATCH] use hidden visibility for i386 asm-internal __vsyscall symbol otherwise the call instruction in the inline syscall asm results in textrels without ld-time binding. --- arch/i386/syscall_arch.h | 14 +++++++------- src/internal/i386/syscall.s | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/i386/syscall_arch.h b/arch/i386/syscall_arch.h index a4efae90..ca0ea7fb 100644 --- a/arch/i386/syscall_arch.h +++ b/arch/i386/syscall_arch.h @@ -6,49 +6,49 @@ static inline long __syscall0(long n) { unsigned long __ret; - __asm__ __volatile__ ("call __vsyscall" : "=a"(__ret) : "a"(n) : "memory"); + __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n) : "memory"); return __ret; } static inline long __syscall1(long n, long a1) { unsigned long __ret; - __asm__ __volatile__ ("call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1) : "memory"); + __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1) : "memory"); return __ret; } static inline long __syscall2(long n, long a1, long a2) { unsigned long __ret; - __asm__ __volatile__ ("call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2) : "memory"); + __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2) : "memory"); return __ret; } static inline long __syscall3(long n, long a1, long a2, long a3) { unsigned long __ret; - __asm__ __volatile__ ("call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3) : "memory"); + __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3) : "memory"); return __ret; } static inline long __syscall4(long n, long a1, long a2, long a3, long a4) { unsigned long __ret; - __asm__ __volatile__ ("call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4) : "memory"); + __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4) : "memory"); return __ret; } static inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5) { unsigned long __ret; - __asm__ __volatile__ ("push %6 ; call __vsyscall ; add $4,%%esp" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4), "g"(a5) : "memory"); + __asm__ __volatile__ ("push %6 ; .hidden __vsyscall ; call __vsyscall ; add $4,%%esp" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4), "g"(a5) : "memory"); return __ret; } static inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6) { unsigned long __ret; - __asm__ __volatile__ ("push %6 ; call __vsyscall6 ; add $4,%%esp" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4), "g"(0+(long[]){a5, a6}) : "memory"); + __asm__ __volatile__ ("push %6 ; .hidden __vsyscall6 ; call __vsyscall6 ; add $4,%%esp" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4), "g"(0+(long[]){a5, a6}) : "memory"); return __ret; } diff --git a/src/internal/i386/syscall.s b/src/internal/i386/syscall.s index 2914acee..739201ae 100644 --- a/src/internal/i386/syscall.s +++ b/src/internal/i386/syscall.s @@ -7,6 +7,7 @@ # code, respectively), and optimizes for size/simplicity in the caller. .global __vsyscall +.hidden __vsyscall .type __vsyscall,@function __vsyscall: push %edi @@ -41,6 +42,7 @@ __vsyscall: # possible to pass two arguments on the stack. .global __vsyscall6 +.hidden __vsyscall6 .type __vsyscall6,@function __vsyscall6: push %ebp -- 2.25.1