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

segfaults on -pthread -static and LD_ASSUME_KERNE=2.2.5



Hi! I am using debian sarge-3.1 (updating)

ii  gcc            3.3.5-3        The GNU C compiler
ii  libgcc1        3.4.3-13sarge1 GCC support library
ii  libstdc++5     3.3.5-13       The GNU Standard C++ Library v3
ii  libc6          2.3.2.ds1-22sa GNU C Library: Shared libraries and Timezone

Sample showng bug(?):
# makefile
TARGET := oo

all: $(TARGET)

$(TARGET) : main.cc
        $(CXX) main.cc -o $@ -pthread -static

run: $(TARGET)
        ./$(TARGET)

//main.cc
#include <iostream>

using namespace std;

int
main (int argc, char * argv[])
{
    cerr << "end\n";
    return 0;
}

#run.sh
#!/bin/sh

export LD_ASSUME_KERNEL=2.2.5
ulimit -c unlimited
make run

#######################
And now i'm running ./run.sh:
$ ./run
./oo
make: *** [run] Segmentation fault (core dumped)

$ gdb ./oo core
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

Core was generated by `./oo'.
Program terminated with signal 11, Segmentation fault.
#0  0x0809bb8c in __strtoul_internal ()
(gdb) bt
#0  0x0809bb8c in __strtoul_internal ()
#1  0x08093882 in __libc_start_main ()
#2  0x08048121 in _start () at ../sysdeps/i386/elf/start.S:102


Binary, compiled in RHEL4, runs successfully.

Is it bug? Is it libc, libstdc++, gcc or kernel bug?
How to fix this program runned in such environment?

Sorry, I am not in a mail list. Please, CC me explicitly.
Thanks.



Reply to: