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
>Organization:
Computer Protocol Malaysia
>Environment:
NetBSD eufo 5.0.2 NetBSD 5.0.2 (TS7200) #0: Sat Feb  6 15:25:19 UTC 2010  
builds%b8.netbsd.org@localhost:/home/builds/ab/
netbsd-5-0-2-RELEASE/evbarm/201002061851Z-obj/home/builds/ab/netbsd-5-0-2-RELEASE/src/sys/arch/evbarm/compile/T
S7200 evbarm
>Description:
=== Makefile ===
PROG=atomic_cas
NOMAN=1
LDSTATIC=       -static
CFLAGS+=        -g

.include <bsd.prog.mk>
=== 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 
completion.

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

>How-To-Repeat:
This problem occurs on a TS7250 board purchased from 
http://www.embeddedarm.com/products/board-detail.php?product=TS-7250

>Fix:
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