Bug#414795: libpthread/NPTL: static linking seems to break raise(3), abort(3)

2007-03-22 Thread Florian Weimer
* Daniel Jacobowitz:

 Statically linked executables simply do not support NPTL.  If
 possible, a link-time warning should be generated, perhaps even an
 error.

 Actually, I don't know that this is correct.

Several mailing list postings strongly suggest that this is upstream's
position.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#414795: libpthread/NPTL: static linking seems to break raise(3), abort(3)

2007-03-21 Thread Florian Weimer
* Alex Pennace:

 A program that is statically linked to NPTL will fail at runtime when
 calling raise(3) (and, by extension, abort(3)): 

Statically linked executables simply do not support NPTL.  If
possible, a link-time warning should be generated, perhaps even an
error.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#414795: libpthread/NPTL: static linking seems to break raise(3), abort(3)

2007-03-21 Thread Alex Pennace
On Wed, Mar 21, 2007 at 09:17:58PM +0100, Florian Weimer wrote:
 * Alex Pennace:
 
  A program that is statically linked to NPTL will fail at runtime when
  calling raise(3) (and, by extension, abort(3)): 
 
 Statically linked executables simply do not support NPTL.  If
 possible, a link-time warning should be generated, perhaps even an
 error.

A warning or error would fix what is currently broken.

Is it the case that NPTL's design critera explicitly excluded static
linking, or is that facility a work in progress? What does POSIX have
to say about supporting static linking?


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#414795: libpthread/NPTL: static linking seems to break raise(3), abort(3)

2007-03-21 Thread Daniel Jacobowitz
On Wed, Mar 21, 2007 at 05:11:13PM -0400, Alex Pennace wrote:
 On Wed, Mar 21, 2007 at 09:17:58PM +0100, Florian Weimer wrote:
  * Alex Pennace:
  
   A program that is statically linked to NPTL will fail at runtime when
   calling raise(3) (and, by extension, abort(3)): 
  
  Statically linked executables simply do not support NPTL.  If
  possible, a link-time warning should be generated, perhaps even an
  error.

Actually, I don't know that this is correct.

 What does POSIX have
 to say about supporting static linking?

Nothing whatsoever.

-- 
Daniel Jacobowitz
CodeSourcery


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#414795: libpthread/NPTL: static linking seems to break raise(3), abort(3)

2007-03-21 Thread Florian Weimer
* Alex Pennace:

 Is it the case that NPTL's design critera explicitly excluded static
 linking, or is that facility a work in progress?

libc as a whole doesn't really support static linking anymore.  For
instance, gethostbyaddr and friends only work with the exact libc
version you linked statically against (because at run time, code must
be loaded dynamically).

 What does POSIX have to say about supporting static linking?

Nothing, it's beyond its scope.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#414795: libpthread/NPTL: static linking seems to break raise(3), abort(3)

2007-03-13 Thread Alex Pennace
Package: libc6-dev
Version: 2.3.6.ds1-13
Severity: normal

A program that is statically linked to NPTL will fail at runtime when
calling raise(3) (and, by extension, abort(3)): 

$ cc -g -Wall -pthread -I/usr/include/nptl -L/usr/lib/nptl -static
test1.c   -o test1 
$ strace ./test1
...
tgkill(0, 0, SIGQUIT)   = -1 EINVAL (Invalid argument)

This does not occur if the binary is dynamically linked against NPTL,
nor does it occur when linked against LinuxThreads, either statically
or dynamically.

-- Details:

$ cat test.c
#include signal.h

int main(int argc, char *argv[]) {
  raise(SIGQUIT);

  return 0;
}

$ cat Makefile 
all: test1 test2 test3 test4
test1: CFLAGS=-g -Wall -pthread -I/usr/include/nptl -L/usr/lib/nptl -static
test2: CFLAGS=-g -Wall -pthread -I/usr/include/nptl -L/usr/lib/nptl
test3: CFLAGS=-g -Wall -pthread -static
test4: CFLAGS=-g -Wall -pthread

test1.c test2.c test3.c test4.c: test.c
cp $^ $@

$ strace ./test1
execve(./test1, [./test1], [/* 24 vars */]) = 0
uname({sys=Linux, node=itrains, ...}) = 0
brk(0)  = 0x80bf000
brk(0x80bfc90)  = 0x80bfc90
set_thread_area({entry_number:-1 - 6, base_addr:0x80bf830, limit:1048575, 
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, 
useable:1}) = 0
brk(0x80e0c90)  = 0x80e0c90
brk(0x80e1000)  = 0x80e1000
tgkill(0, 0, SIGQUIT)   = -1 EINVAL (Invalid argument)
exit_group(0)   = ?
Process 32023 detached

$ strace ./test2
execve(./test2, [./test2], [/* 24 vars */]) = 0
uname({sys=Linux, node=itrains, ...}) = 0
brk(0)  = 0x804a000
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xa7f4a000
access(/etc/ld.so.preload, R_OK)  = -1 ENOENT (No such file or directory)
open(/etc/ld.so.cache, O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=23128, ...}) = 0
mmap2(NULL, 23128, PROT_READ, MAP_PRIVATE, 3, 0) = 0xa7f44000
close(3)= 0
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
open(/lib/tls/i686/cmov/libpthread.so.0, O_RDONLY) = 3
read(3, \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240H\0..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=89370, ...}) = 0
mmap2(NULL, 70104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0xa7f32000
mmap2(0xa7f4, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe) = 0xa7f4
mmap2(0xa7f42000, 4568, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xa7f42000
close(3)= 0
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
open(/lib/tls/i686/cmov/libc.so.6, O_RDONLY) = 3
read(3, \177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240O\1..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1241392, ...}) = 0
mmap2(NULL, 1247388, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0xa7e01000
mmap2(0xa7f28000, 28672, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x127) = 0xa7f28000
mmap2(0xa7f2f000, 10396, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xa7f2f000
close(3)= 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xa7e0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xa7dff000
mprotect(0xa7f28000, 20480, PROT_READ)  = 0
set_thread_area({entry_number:-1 - 6, base_addr:0xa7dff6c0, limit:1048575, 
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, 
useable:1}) = 0
munmap(0xa7f44000, 23128)   = 0
set_tid_address(0xa7dff708) = 32025
rt_sigaction(SIGRTMIN, {0xa7f364c0, [], SA_SIGINFO}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0xa7f36420, [], SA_RESTART|SA_SIGINFO}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
uname({sys=Linux, node=itrains, ...}) = 0
tgkill(32025, 32025, SIGQUIT)   = 0
--- SIGQUIT (Quit) @ 0 (0) ---
+++ killed by SIGQUIT +++
Process 32025 detached

$ strace ./test3
execve(./test3, [./test3], [/* 24 vars */]) = 0
uname({sys=Linux, node=itrains, ...}) = 0
brk(0)  = 0x80b2000
brk(0x80d3000)  = 0x80d3000
getpid()= 32027
kill(32027, SIGQUIT)= 0
--- SIGQUIT (Quit) @ 0 (0) ---
+++ killed by SIGQUIT +++
Process 32027 detached

$ strace ./test4
execve(./test4, [./test4], [/* 24 vars */]) = 0
uname({sys=Linux, node=itrains, ...}) = 0
brk(0)  = 0x804a000
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE,