NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-evbarm/43801: Statically linked program that calls atomic_cas_ulong crashes with segmentation fault

>Number:         43801
>Category:       port-evbarm
>Synopsis:       Statically linked program that calls atomic_cas_ulong crashes 
>with segmentation fault
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 26 13:20:01 +0000 2010
>Originator:     Y H Loke
>Release:        NetBSD 5.0.2
Computer Protocol Malaysia
NetBSD eufo 5.0.2 NetBSD 5.0.2 (TS7200) #0: Sat Feb  6 15:25:19 UTC 2010
S7200 evbarm
=== Makefile ===
LDSTATIC=       -static
CFLAGS+=        -g

.include <>
=== atomic_cas C program ===
#include <stdio.h>
#include <atomic.h>

int main()
    unsigned long ul, old, new;

    ul = 3; old = 1; new = 2;
    printf("atomic_cas_ulong=%lu\n", atomic_cas_ulong(&ul, old, new));
    return 0;
When the above C program is built and then executed, it crashes with 
segmentation fault. If it is build with LDSTATIC commented out, it runs fine to 

This problem is also causing statically linked pthreads programs to crash at 
start up.

This problem occurs on a TS7250 board purchased from

I don't know how to fix it because I don't have enough knowledge on NetBSD 
linker and how atomic library works.

Home | Main Index | Thread Index | Old Index