Hi, Mike,

Do you have time to review this patch? Any suggestion? Or it is ready to be 
pushed?

Thanks,
Jian

-----Original Message-----
From: uclibc-boun...@uclibc.org [mailto:uclibc-boun...@uclibc.org] On Behalf Of 
Jian Peng
Sent: Monday, March 28, 2011 3:09 PM
To: Mike Frysinger; uclibc@uclibc.org
Subject: RE: sigprocmask testing program failed with static linking

I chose Plain Text mode in Outlook, but not sure why line wrap failed.

Here is my new patch using weak_function.

>From 4ebcbb392994e5a8a310d59ca5541fe97c4babdd Mon Sep 17 00:00:00 2001
From: Jian Peng <jipeng2...@gmail.com>
Date: Mon, 28 Mar 2011 15:00:23 -0700
Subject: [PATCH 1/1] common: fix sigprocmask static linking bug

simple sigprocmask testing program will fail to be compiled due to
multiple definition of sigprocmask in libpthread.a and libc.a

$ gcc sigprocmask-test.c -o sigprocmask-test -static -lpthread
sigprocmask.c:(.text+0x0): multiple definition of `sigprocmask'

The solution is to define sigprocmask as weak symbol.

Signed-off-by: Jian Peng <jipeng2...@gmail.com>
---
 libc/sysdeps/linux/common/sigprocmask.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/sysdeps/linux/common/sigprocmask.c 
b/libc/sysdeps/linux/common/sigprocmask.c
index 011d7b3..1d0d51a 100644
--- a/libc/sysdeps/linux/common/sigprocmask.c
+++ b/libc/sysdeps/linux/common/sigprocmask.c
@@ -23,7 +23,7 @@ static __always_inline
 _syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set,
                  sigset_t *, oldset, size_t, size)
 
-int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
+int weak_function sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
 {
 #ifdef SIGCANCEL
        sigset_t local_newmask;
@@ -58,7 +58,7 @@ static __always_inline
 _syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set,
                  sigset_t *, oldset)
 
-int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
+int weak_function sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
 {
 #ifdef SIGCANCEL
        sigset_t local_newmask;
-- 
1.7.4.1

-----Original Message-----
From: uclibc-boun...@uclibc.org [mailto:uclibc-boun...@uclibc.org] On Behalf Of 
Mike Frysinger
Sent: Sunday, March 27, 2011 1:01 AM
To: uclibc@uclibc.org
Subject: Re: sigprocmask testing program failed with static linking

On Sun, Mar 27, 2011 at 3:27 AM, Jian Peng wrote:

please fix your e-mail client to properly wrap long lines.

> >From 2e435b037624eff8c0daaa146d6feca57ce1eecf Mon Sep 17 00:00:00 2001
> From: Jian Peng <jipeng2...@gmail.com>
> Date: Sat, 26 Mar 2011 23:44:52 -0700
> Subject: [PATCH 1/1] common: fix sigprocmask static linking bug
>
> simple sigprocmask testing program will fail to be compiled due to multiple 
> definition of sigprocmask in libpthread.a and libc.a

you need to manually line wrap your changelog to like 74 chars

> -int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
> +int __attribute__((weak)) sigprocmask(int how, const sigset_t * set, 
> sigset_t * oldset)

you need to use weak_function.  raw __attribute__((...)) is rarely the
way to go anymore.
-mike
_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to