Subject: PTL2 (pkgsrc/devel/ptl2) doesn't work with i386/ELF
To: None <tech-pkg@netbsd.org>
From: Kazuki Sakamoto <sakamoto@cec.co.jp>
List: tech-kern
Date: 09/20/1999 14:45:45
PTL2 (pkgsrc/devel/pth2) doesn't work with i386/ELF.
Environment: NetBSD-current 9/10 kernel + 8/10 userland

% cat a.c
main(){}

% ptlgcc -v a.c
Reading specs from /usr/pkg/PTL/lib/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /usr/libexec/cpp -lang-c -v -iprefix /usr/pkg/PTL/lib//i386-netbsd/egcs-1.1.2/ -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -Di386 -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -D__i386__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__ -D__i386 -Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386) -I/usr/pkg/PTL/include -include /usr/pkg/PTL/include/sys/pthread-init.h a.c /tmp/cco289b9.i
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/pkg/PTL/include
 /usr/include
End of search list.
 /usr/libexec/cc1 /tmp/cco289b9.i -quiet -dumpbase a.c -version -o /tmp/ccoX2Ota.s
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386-netbsd) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
 as -o /tmp/ccyLEhCa.o /tmp/ccoX2Ota.s
 /usr/libexec/collect2 -m elf_i386 -dc -dp -e __start -dynamic-linker /usr/libexec/ld.elf_so -R /usr/pkg/lib /usr/lib/crt0.o /usr/lib/crtbegin.o -L/usr/pkg/PTL/lib -L/usr/libexec /tmp/ccyLEhCa.o -lgcc -L/usr/pkg/lib -lPTL -lc -lgcc /usr/lib/crtend.o

% ./a.out
Segmentation fault (core dumped)

% gdb ./a.out
GNU gdb 4.17
Copyright 1998 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--netbsd"...(no debugging symbols found)...
(gdb) run
Starting program: /tmp/T/a.out 
(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:544
/opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:544: No such file or directory.
(gdb) break ioctl
Breakpoint 1 at 0x48069740: file /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c, line 547.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /tmp/T/a.out 
Cannot insert breakpoint 1:
Temporarily disabling shared library breakpoints:
1 

Breakpoint 1, ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
/opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547: No such file or directory.
(gdb) s

Breakpoint 1, ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
/opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547: No such file or directory.
(gdb) s

..

Breakpoint 1, ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
/opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547: No such file or directory.
(gdb) where
#0  ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#1  0x4807c8b4 in IOCTL ()
#2  0x4806974e in ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#3  0x4807c8b4 in IOCTL ()
#4  0x4806974e in ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#5  0x4807c8b4 in IOCTL ()
#6  0x4806974e in ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#7  0x4807c8b4 in IOCTL ()
#8  0x4806974e in ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#9  0x4807c8b4 in IOCTL ()
#10 0x4806974e in ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#11 0x4807c8b4 in IOCTL ()
#12 0x4806974e in ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#13 0x4807c8b4 in IOCTL ()
#14 0x4806974e in ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#15 0x4807c8b4 in IOCTL ()
#16 0x4806974e in ioctl (fd=0, cmd=1076655123, arg=0xefbfd7f8)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io_api.c:547
#17 0x480e7fcc in tcgetattr ()
#18 0x480e7f7f in isatty ()
#19 0x480673c6 in _pthread_io_fdinit (fd=0)
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io.c:356
#20 0x48067205 in _pthread_io_init ()
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/io.c:281
#21 0x48066652 in _pthread_init ()
    at /opt/pkgsrc/devel/ptl2/work/PTL2-current-990622/src/init.c:239
#22 0x80487bc in _pthread_inithook ()
#23 0x80487a7 in dlerror ()
#24 0x804847b in _init ()
#25 0x8048594 in __start ()
(gdb) quit

what's wrong?

sakamoto