]> granicus.if.org Git - musl/commitdiff
rework cancellation weak alias logic not to depend on archive order
authorRich Felker <dalias@aerifal.cx>
Mon, 7 Jul 2014 02:56:25 +0000 (22:56 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 7 Jul 2014 02:56:25 +0000 (22:56 -0400)
if the order of object files in the static archive libc.a was not
respected by the linker, the old logic could wrongly cause POSIX
symbols outside of the ISO C namespace to be pulled into pure C
programs. this should not happen with well-behaved linkers, but
relying on the link order was a bad idea anyway.

files are renamed to better reflect their contents now that they don't
need names to control their order as members in the archive file.

src/thread/__syscall_cp.c [moved from src/thread/cancel_dummy.c with 51% similarity]
src/thread/pthread_cancel.c [moved from src/thread/cancel_impl.c with 98% similarity]
src/thread/pthread_testcancel.c

similarity index 51%
rename from src/thread/cancel_dummy.c
rename to src/thread/__syscall_cp.c
index b630b02c79153cbaa1e733379340fc764d19035c..a48cee9b022f0d516a8f188a5c8cc04800328f6c 100644 (file)
@@ -8,10 +8,11 @@ static long sccp(syscall_arg_t nr,
        return (__syscall)(nr, u, v, w, x, y, z);
 }
 
-weak_alias(sccp, __syscall_cp);
+weak_alias(sccp, __syscall_cp_c);
 
-static void dummy()
+long (__syscall_cp)(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)
 {
+       return __syscall_cp_c(nr, u, v, w, x, y, z);
 }
-
-weak_alias(dummy, __testcancel);
similarity index 98%
rename from src/thread/cancel_impl.c
rename to src/thread/pthread_cancel.c
index 069b27962ac1b56f0e55b693742e7a04d7209690..e3d291ee107ac469f714872f3f5db524d9c3be1b 100644 (file)
@@ -13,7 +13,7 @@ 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);
 
-long (__syscall_cp)(syscall_arg_t nr,
+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)
 {
index 33238c0f70c5af59e17c40a0537b8bc578b36116..ba5f7c6cc29b91ab2678b8ad984a17ca91bb351a 100644 (file)
@@ -1,6 +1,11 @@
 #include "pthread_impl.h"
+#include "libc.h"
 
-void __testcancel(void);
+static void dummy()
+{
+}
+
+weak_alias(dummy, __testcancel);
 
 void pthread_testcancel()
 {