about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/thread/aarch64/syscall_cp.s10
-rw-r--r--src/thread/arm/syscall_cp.s11
-rw-r--r--src/thread/i386/syscall_cp.s11
-rw-r--r--src/thread/microblaze/syscall_cp.s12
-rw-r--r--src/thread/mips/syscall_cp.s11
-rw-r--r--src/thread/or1k/syscall_cp.s12
-rw-r--r--src/thread/powerpc/syscall_cp.s13
-rw-r--r--src/thread/pthread_cancel.c14
-rw-r--r--src/thread/sh/syscall_cp.s12
-rw-r--r--src/thread/x32/syscall_cp.s10
-rw-r--r--src/thread/x86_64/syscall_cp.s10
11 files changed, 96 insertions, 30 deletions
diff --git a/src/thread/aarch64/syscall_cp.s b/src/thread/aarch64/syscall_cp.s
index 6302a0bd..30e677ce 100644
--- a/src/thread/aarch64/syscall_cp.s
+++ b/src/thread/aarch64/syscall_cp.s
@@ -4,10 +4,17 @@
 // syscall(nr, u, v, w, x, y, z)
 //         x8  x0 x1 x2 x3 x4 x5
 
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_asm
+.hidden __syscall_cp_asm
 .type __syscall_cp_asm,%function
 __syscall_cp_asm:
-.global __cp_begin
 __cp_begin:
 	ldr w0,[x0]
 	cbnz w0,1f
@@ -19,7 +26,6 @@ __cp_begin:
 	mov x4,x6
 	mov x5,x7
 	svc 0
-.global __cp_end
 __cp_end:
 	ret
 
diff --git a/src/thread/arm/syscall_cp.s b/src/thread/arm/syscall_cp.s
index 66c5ecbd..96ce6135 100644
--- a/src/thread/arm/syscall_cp.s
+++ b/src/thread/arm/syscall_cp.s
@@ -1,9 +1,16 @@
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_asm
+.hidden __syscall_cp_asm
 .type __syscall_cp_asm,%function
 __syscall_cp_asm:
 	mov ip,sp
 	stmfd sp!,{r4,r5,r6,r7,lr}
-.global __cp_begin
 __cp_begin:
 	ldr r0,[r0]
 	cmp r0,#0
@@ -13,13 +20,11 @@ __cp_begin:
 	mov r1,r3
 	ldmfd ip,{r2,r3,r4,r5,r6}
 	svc 0
-.global __cp_end
 __cp_end:
 	ldmfd sp!,{r4,r5,r6,r7,lr}
 	tst lr,#1
 	moveq pc,lr
 	bx lr
-.global __cp_cancel
 __cp_cancel:
 	ldmfd sp!,{r4,r5,r6,r7,lr}
 	b __cancel
diff --git a/src/thread/i386/syscall_cp.s b/src/thread/i386/syscall_cp.s
index 71ce63f7..7dce1eb3 100644
--- a/src/thread/i386/syscall_cp.s
+++ b/src/thread/i386/syscall_cp.s
@@ -1,5 +1,13 @@
 .text
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_asm
+.hidden __syscall_cp_asm
 .type   __syscall_cp_asm,@function
 __syscall_cp_asm:
 	mov 4(%esp),%ecx
@@ -7,7 +15,6 @@ __syscall_cp_asm:
 	pushl %esi
 	pushl %edi
 	pushl %ebp
-.global __cp_begin
 __cp_begin:
 	movl (%ecx),%eax
 	testl %eax,%eax
@@ -20,14 +27,12 @@ __cp_begin:
 	movl 44(%esp),%edi
 	movl 48(%esp),%ebp
 	int $128
-.global __cp_end
 __cp_end:
 	popl %ebp
 	popl %edi
 	popl %esi
 	popl %ebx
 	ret
-.global __cp_cancel
 __cp_cancel:
 	popl %ebp
 	popl %edi
diff --git a/src/thread/microblaze/syscall_cp.s b/src/thread/microblaze/syscall_cp.s
index ce38b56c..51599c91 100644
--- a/src/thread/microblaze/syscall_cp.s
+++ b/src/thread/microblaze/syscall_cp.s
@@ -1,10 +1,17 @@
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_asm
+.hidden __syscall_cp_asm
 .type   __syscall_cp_asm,@function
 __syscall_cp_asm:
-.global __cp_begin
 __cp_begin:
 	lwi     r5, r5, 0
-	bnei    r5, __cancel@PLT
+	bnei    r5, __cancel
 	addi    r12, r6, 0
 	add     r5, r7, r0
 	add     r6, r8, r0
@@ -13,7 +20,6 @@ __cp_begin:
 	lwi     r9, r1, 28
 	lwi     r10, r1, 32
 	brki    r14, 0x8
-.global __cp_end
 __cp_end:
 	rtsd    r15, 8
 	nop
diff --git a/src/thread/mips/syscall_cp.s b/src/thread/mips/syscall_cp.s
index d903794d..399289e3 100644
--- a/src/thread/mips/syscall_cp.s
+++ b/src/thread/mips/syscall_cp.s
@@ -1,10 +1,17 @@
 .set    noreorder
 
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_asm
+.hidden __syscall_cp_asm
 .type   __syscall_cp_asm,@function
 __syscall_cp_asm:
 	subu    $sp, $sp, 32
-.global __cp_begin
 __cp_begin:
 	lw      $4, 0($4)
 	bne     $4, $0, __cp_cancel
@@ -22,7 +29,6 @@ __cp_begin:
 	sw      $2, 28($sp)
 	lw      $2, 28($sp)
 	syscall
-.global __cp_end
 __cp_end:
 	beq     $7, $0, 1f
 	addu    $sp, $sp, 32
@@ -30,7 +36,6 @@ __cp_end:
 1:	jr      $ra
 	nop
 
-.global __cp_cancel
 __cp_cancel:
 	addu    $sp, $sp, 32
 	lw      $25, %call16(__cancel)($gp)
diff --git a/src/thread/or1k/syscall_cp.s b/src/thread/or1k/syscall_cp.s
index 02d4cd79..2c0bf0e8 100644
--- a/src/thread/or1k/syscall_cp.s
+++ b/src/thread/or1k/syscall_cp.s
@@ -1,11 +1,18 @@
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_asm
+.hidden __syscall_cp_asm
 .type   __syscall_cp_asm,@function
 __syscall_cp_asm:
-.global __cp_begin
 __cp_begin:
 	l.lwz	r3, 0(r3)
 	l.sfeqi	r3, 0
-	l.bnf	plt(__cancel)
+	l.bnf	__cancel
 	 l.ori	r11, r4, 0
 	l.ori	r3, r5, 0
 	l.ori	r4, r6, 0
@@ -14,7 +21,6 @@ __cp_begin:
 	l.lwz	r7, 0(r1)
 	l.lwz	r8, 4(r1)
 	l.sys	1
-.global __cp_end
 __cp_end:
 	l.jr	r9
 	 l.nop
diff --git a/src/thread/powerpc/syscall_cp.s b/src/thread/powerpc/syscall_cp.s
index 0c7869cc..20b5e0ac 100644
--- a/src/thread/powerpc/syscall_cp.s
+++ b/src/thread/powerpc/syscall_cp.s
@@ -1,3 +1,13 @@
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
+.global __syscall_cp_asm
+.hidden __syscall_cp_asm
+
 #r0: volatile. may be modified during linkage.
 #r1: stack frame: 16 byte alignment.
 #r2: tls/thread pointer on pp32
@@ -16,11 +26,9 @@
 #the fields CR2,CR2,CR4 of the cond reg must be preserved
 #LR (link reg) shall contain the funcs return address
 	.text
-	.global __syscall_cp_asm
 	.type   __syscall_cp_asm,%function
 __syscall_cp_asm:
 	# at enter: r3 = pointer to self->cancel, r4: syscall no, r5: first arg, r6: 2nd, r7: 3rd, r8: 4th, r9: 5th, r10: 6th
-	.global __cp_begin
 __cp_begin:
 	# r3 holds first argument, its a pointer to self->cancel. 
 	# we must compare the dereferenced value with 0 and jump to __cancel if its not
@@ -42,7 +50,6 @@ __cp_begin:
 	mr      7, 9                  # arg5
 	mr      8, 10                  # arg6
 	sc
-	.global __cp_end
 __cp_end:
 	bnslr+ # return if no summary overflow. 
 	#else negate result.
diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c
index 7c5dda31..fde09080 100644
--- a/src/thread/pthread_cancel.c
+++ b/src/thread/pthread_cancel.c
@@ -3,7 +3,13 @@
 #include "syscall.h"
 #include "libc.h"
 
-long __cancel()
+#ifdef SHARED
+#define hidden __attribute__((__visibility__("hidden")))
+#else
+#define hidden
+#endif
+
+hidden long __cancel()
 {
 	pthread_t self = __pthread_self();
 	if (self->canceldisable == PTHREAD_CANCEL_ENABLE || self->cancelasync)
@@ -16,12 +22,14 @@ long __cancel()
  * definition of __cp_cancel to undo those adjustments and call __cancel.
  * Otherwise, __cancel provides a definition for __cp_cancel. */
 
-weak_alias(__cancel, __cp_cancel);
+hidden weak_alias(__cancel, __cp_cancel);
 
+hidden
 long __syscall_cp_asm(volatile void *, syscall_arg_t,
                       syscall_arg_t, syscall_arg_t, syscall_arg_t,
                       syscall_arg_t, syscall_arg_t, syscall_arg_t);
 
+hidden
 long __syscall_cp_c(syscall_arg_t nr,
                     syscall_arg_t u, syscall_arg_t v, syscall_arg_t w,
                     syscall_arg_t x, syscall_arg_t y, syscall_arg_t z)
@@ -52,7 +60,7 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx)
 	pthread_t self = __pthread_self();
 	ucontext_t *uc = ctx;
 	const char *ip = ((char **)&uc->uc_mcontext)[CANCEL_REG_IP];
-	extern const char __cp_begin[1], __cp_end[1];
+	hidden extern const char __cp_begin[1], __cp_end[1];
 
 	a_barrier();
 	if (!self->cancel || self->canceldisable == PTHREAD_CANCEL_DISABLE) return;
diff --git a/src/thread/sh/syscall_cp.s b/src/thread/sh/syscall_cp.s
index 5677b9c0..c783ca05 100644
--- a/src/thread/sh/syscall_cp.s
+++ b/src/thread/sh/syscall_cp.s
@@ -1,9 +1,16 @@
 .text
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_asm
+.hidden __syscall_cp_asm
 .type   __syscall_cp_asm, @function
 __syscall_cp_asm:
 
-.global __cp_begin
 __cp_begin:
 	mov.l @r4, r4
 	tst   r4, r4
@@ -15,7 +22,7 @@ __cp_begin:
 1:
 
 .align 2
-L1:	.long __cancel@PLT-(1b-.)
+L1:	.long __cancel-(1b-.)
 
 2:	mov   r5, r3
 	mov   r6, r4
@@ -26,7 +33,6 @@ L1:	.long __cancel@PLT-(1b-.)
 	mov.l @(12,r15), r1
 	trapa #22
 
-.global __cp_end
 __cp_end:
 	! work around hardware bug
 	or   r0, r0
diff --git a/src/thread/x32/syscall_cp.s b/src/thread/x32/syscall_cp.s
index 70605c19..79709a55 100644
--- a/src/thread/x32/syscall_cp.s
+++ b/src/thread/x32/syscall_cp.s
@@ -1,9 +1,16 @@
 .text
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_internal
+.hidden __syscall_cp_internal
 .type   __syscall_cp_internal,@function
 __syscall_cp_internal:
 
-.global __cp_begin
 __cp_begin:
 	mov (%rdi),%eax
 	test %eax,%eax
@@ -18,6 +25,5 @@ __cp_begin:
 	mov 16(%rsp),%r9
 	mov %r11,8(%rsp)
 	syscall
-.global __cp_end
 __cp_end:
 	ret
diff --git a/src/thread/x86_64/syscall_cp.s b/src/thread/x86_64/syscall_cp.s
index 788c53cc..1a0fd5d2 100644
--- a/src/thread/x86_64/syscall_cp.s
+++ b/src/thread/x86_64/syscall_cp.s
@@ -1,9 +1,16 @@
 .text
+.global __cp_begin
+.hidden __cp_begin
+.global __cp_end
+.hidden __cp_end
+.global __cp_cancel
+.hidden __cp_cancel
+.hidden __cancel
 .global __syscall_cp_asm
+.hidden __syscall_cp_asm
 .type   __syscall_cp_asm,@function
 __syscall_cp_asm:
 
-.global __cp_begin
 __cp_begin:
 	mov (%rdi),%eax
 	test %eax,%eax
@@ -18,6 +25,5 @@ __cp_begin:
 	mov 16(%rsp),%r9
 	mov %r11,8(%rsp)
 	syscall
-.global __cp_end
 __cp_end:
 	ret