Browse Source

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.
Rich Felker 10 years ago
parent
commit
da7ccf822c
2 changed files with 9 additions and 7 deletions
  1. 7 7
      arch/i386/syscall_arch.h
  2. 2 0
      src/internal/i386/syscall.s

+ 7 - 7
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;
 }
 

+ 2 - 0
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