help-gnu-utils
[Top][All Lists]
Advanced

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

binutils 2.13 on solaris 2.8 has segmentation fault in startup co de


From: Douglas Richardson
Subject: binutils 2.13 on solaris 2.8 has segmentation fault in startup co de
Date: Mon, 16 Sep 2002 12:22:50 -0700

I'm having a problem building programs that use shared libraries on Solaris
2.8 using binutils 2.13. This problem began when I installed binutils 2.13.
Before that I had binutils 2.12, which worked fine. I tried building a test
program with gcc 2.95.2, gcc 3.0.3, and gcc 3.2. The test program dies in
the startup code with a segmentation fault. I found the following shell
script that demonstrates the problem in the gnu.utils.bug newsgroup. Does
anyone know of workaround or fix to this apparent bug?

Thank you,

Douglas Richardson.

-------------------------------snip here-----------------------------
#! /bin/sh

mkdir /tmp/t.$$  || exit 3
cd /tmp/t.$$     || exit 3

cat >main.c <<'EOF'
#include <stdio.h>
#include <dlfcn.h>

int main(void)
{
    void *handle, *sym;
    char *error;

    puts("calling dlopen");
    handle = dlopen("./dyn.so", RTLD_NOW);
    if (!handle) {
        printf("%s\n", dlerror());
        return 1;
    }

    puts("calling dlsym");
    sym = dlsym(handle, "sym");
    if ((error = dlerror()) != 0) {
        printf("%s\n", error);
        return 1;
    }
    puts("calling sym");
    ((void (*)(void))sym)();
    puts("done");
    return 0;
}
EOF

cat >dyn.c <<'EOF'
#include <stdio.h>
void sym(void)
{
    puts("in sym");
}
EOF

[ -n "$SHFLAGS" ] || SHFLAGS="-fPIC -shared"
[ -n "$CC" ]  || CC=gcc

set -x

$CC $CFLAGS $SHFLAGS dyn.c -o dyn.so
$CC $CFLAGS main.c -o main -ldl

./main || exit $?

cd /tmp
rm -rf t.$$
-------------------------------snip here-----------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]