* [Xenomai-help] Xenomai 2.5.0: rt_task_shadow fails when libnative is statically linked.
@ 2010-01-26 14:16 Henri Roosen
2010-02-01 22:35 ` Gilles Chanteperdrix
0 siblings, 1 reply; 5+ messages in thread
From: Henri Roosen @ 2010-01-26 14:16 UTC (permalink / raw)
To: xenomai
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
Hi all,
I get segmentation fault when calling rt_task_shadow. Actually
somewhere in the pthread library called from sigshadow_install_once();
This only happens on Xenomai 2.5 when libnative is statically linked.
Tested ok on 2.4.10 both dynamically and statically linked. I use
kernel version 2.6.30.10, xenomai 2.5.0 on x86.
Any idea what is wrong?
Reproduced it with basic app that is attached to this email. Compiled with:
gcc -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__
-I/usr/xenomai/include tst_basic.c -o tst_basic
/usr/xenomai/lib/libnative.a -lpthread
Segfailt in dmesg on xenomai 2.5.0:
tst_basic_2.5[1351]: segfault at 0 ip b7ff5a54 sp bfc9b46c error 4 in
libpthread-2.9.so[b7feb000+13000]
[-- Attachment #2: tst_basic.c --]
[-- Type: text/x-csrc, Size: 448 bytes --]
#include <stdlib.h>
#include <stdio.h>
#include <sys/mman.h>
#include <native/task.h>
static RT_TASK rt_task_desc;
int main(void)
{
int ret;
ret = mlockall(MCL_CURRENT | MCL_FUTURE);
if (ret) {
fprintf(stderr, "mlockall failed %d", ret);
exit(1);
}
ret = rt_task_shadow(&rt_task_desc, "MAIN", 99, 0);
if (ret) {
fprintf(stderr, "rt_task_shadow failed %d", ret);
exit(1);
}
while (1)
rt_task_sleep(10000000LL);
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Xenomai 2.5.0: rt_task_shadow fails when libnative is statically linked.
2010-01-26 14:16 [Xenomai-help] Xenomai 2.5.0: rt_task_shadow fails when libnative is statically linked Henri Roosen
@ 2010-02-01 22:35 ` Gilles Chanteperdrix
2010-02-01 23:52 ` Gilles Chanteperdrix
0 siblings, 1 reply; 5+ messages in thread
From: Gilles Chanteperdrix @ 2010-02-01 22:35 UTC (permalink / raw)
To: Henri Roosen; +Cc: xenomai
Henri Roosen wrote:
> Hi all,
>
> I get segmentation fault when calling rt_task_shadow. Actually
> somewhere in the pthread library called from sigshadow_install_once();
>
> This only happens on Xenomai 2.5 when libnative is statically linked.
> Tested ok on 2.4.10 both dynamically and statically linked. I use
> kernel version 2.6.30.10, xenomai 2.5.0 on x86.
>
> Any idea what is wrong?
>
> Reproduced it with basic app that is attached to this email. Compiled with:
> gcc -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__
> -I/usr/xenomai/include tst_basic.c -o tst_basic
> /usr/xenomai/lib/libnative.a -lpthread
>
> Segfailt in dmesg on xenomai 2.5.0:
> tst_basic_2.5[1351]: segfault at 0 ip b7ff5a54 sp bfc9b46c error 4 in
> libpthread-2.9.so[b7feb000+13000]
Ok. Reproduced here. It looks like xeno_sigshadow_install and
xeno_sigshadow_installed have no address. I am on it.
--
Gilles.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Xenomai 2.5.0: rt_task_shadow fails when libnative is statically linked.
2010-02-01 22:35 ` Gilles Chanteperdrix
@ 2010-02-01 23:52 ` Gilles Chanteperdrix
2010-02-02 9:18 ` Henri Roosen
0 siblings, 1 reply; 5+ messages in thread
From: Gilles Chanteperdrix @ 2010-02-01 23:52 UTC (permalink / raw)
To: Henri Roosen; +Cc: xenomai
Gilles Chanteperdrix wrote:
> Henri Roosen wrote:
>> Hi all,
>>
>> I get segmentation fault when calling rt_task_shadow. Actually
>> somewhere in the pthread library called from sigshadow_install_once();
>>
>> This only happens on Xenomai 2.5 when libnative is statically linked.
>> Tested ok on 2.4.10 both dynamically and statically linked. I use
>> kernel version 2.6.30.10, xenomai 2.5.0 on x86.
>>
>> Any idea what is wrong?
>>
>> Reproduced it with basic app that is attached to this email. Compiled with:
>> gcc -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__
>> -I/usr/xenomai/include tst_basic.c -o tst_basic
>> /usr/xenomai/lib/libnative.a -lpthread
>>
>> Segfailt in dmesg on xenomai 2.5.0:
>> tst_basic_2.5[1351]: segfault at 0 ip b7ff5a54 sp bfc9b46c error 4 in
>> libpthread-2.9.so[b7feb000+13000]
>
> Ok. Reproduced here. It looks like xeno_sigshadow_install and
> xeno_sigshadow_installed have no address. I am on it.
The following patch seems to fix the issue for me.
diff --git a/include/asm-generic/bits/sigshadow.h b/include/asm-generic/bits/sigshadow.h
index 5a32762..e07ce00 100644
--- a/include/asm-generic/bits/sigshadow.h
+++ b/include/asm-generic/bits/sigshadow.h
@@ -4,10 +4,10 @@
#include <pthread.h>
#include <signal.h>
-extern pthread_once_t __attribute__((weak)) xeno_sigshadow_installed;
-extern struct sigaction __attribute__((weak)) xeno_saved_sigshadow_action;
+extern pthread_once_t xeno_sigshadow_installed;
+extern struct sigaction xeno_saved_sigshadow_action;
-void __attribute__((weak)) xeno_sigshadow_install(void);
+void xeno_sigshadow_install(void);
static inline void sigshadow_install_once(void)
{
--
Gilles.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Xenomai 2.5.0: rt_task_shadow fails when libnative is statically linked.
2010-02-01 23:52 ` Gilles Chanteperdrix
@ 2010-02-02 9:18 ` Henri Roosen
2010-02-02 9:21 ` Gilles Chanteperdrix
0 siblings, 1 reply; 5+ messages in thread
From: Henri Roosen @ 2010-02-02 9:18 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
I can confirm this works for me too.
But aren't there any reasons to declare those functions with the
'weak' attribute?
On Tue, Feb 2, 2010 at 12:52 AM, Gilles Chanteperdrix
<gilles.chanteperdrix@xenomai.org> wrote:
> Gilles Chanteperdrix wrote:
>> Henri Roosen wrote:
>>> Hi all,
>>>
>>> I get segmentation fault when calling rt_task_shadow. Actually
>>> somewhere in the pthread library called from sigshadow_install_once();
>>>
>>> This only happens on Xenomai 2.5 when libnative is statically linked.
>>> Tested ok on 2.4.10 both dynamically and statically linked. I use
>>> kernel version 2.6.30.10, xenomai 2.5.0 on x86.
>>>
>>> Any idea what is wrong?
>>>
>>> Reproduced it with basic app that is attached to this email. Compiled with:
>>> gcc -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__
>>> -I/usr/xenomai/include tst_basic.c -o tst_basic
>>> /usr/xenomai/lib/libnative.a -lpthread
>>>
>>> Segfailt in dmesg on xenomai 2.5.0:
>>> tst_basic_2.5[1351]: segfault at 0 ip b7ff5a54 sp bfc9b46c error 4 in
>>> libpthread-2.9.so[b7feb000+13000]
>>
>> Ok. Reproduced here. It looks like xeno_sigshadow_install and
>> xeno_sigshadow_installed have no address. I am on it.
>
> The following patch seems to fix the issue for me.
>
> diff --git a/include/asm-generic/bits/sigshadow.h b/include/asm-generic/bits/sigshadow.h
> index 5a32762..e07ce00 100644
> --- a/include/asm-generic/bits/sigshadow.h
> +++ b/include/asm-generic/bits/sigshadow.h
> @@ -4,10 +4,10 @@
> #include <pthread.h>
> #include <signal.h>
>
> -extern pthread_once_t __attribute__((weak)) xeno_sigshadow_installed;
> -extern struct sigaction __attribute__((weak)) xeno_saved_sigshadow_action;
> +extern pthread_once_t xeno_sigshadow_installed;
> +extern struct sigaction xeno_saved_sigshadow_action;
>
> -void __attribute__((weak)) xeno_sigshadow_install(void);
> +void xeno_sigshadow_install(void);
>
> static inline void sigshadow_install_once(void)
> {
>
>
> --
> Gilles.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] Xenomai 2.5.0: rt_task_shadow fails when libnative is statically linked.
2010-02-02 9:18 ` Henri Roosen
@ 2010-02-02 9:21 ` Gilles Chanteperdrix
0 siblings, 0 replies; 5+ messages in thread
From: Gilles Chanteperdrix @ 2010-02-02 9:21 UTC (permalink / raw)
To: Henri Roosen; +Cc: xenomai
Henri Roosen wrote:
> I can confirm this works for me too.
>
> But aren't there any reasons to declare those functions with the
> 'weak' attribute?
The weak attribute is a directive to the linker or the loader, so, we do
not need it when we declare things, only when we define them.
--
Gilles.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-02-02 9:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-26 14:16 [Xenomai-help] Xenomai 2.5.0: rt_task_shadow fails when libnative is statically linked Henri Roosen
2010-02-01 22:35 ` Gilles Chanteperdrix
2010-02-01 23:52 ` Gilles Chanteperdrix
2010-02-02 9:18 ` Henri Roosen
2010-02-02 9:21 ` Gilles Chanteperdrix
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.