bug-binutils
[Top][All Lists]
Advanced

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

GNU ld -shared fails to link filtered symbols on Solaris


From: Martin Man
Subject: GNU ld -shared fails to link filtered symbols on Solaris
Date: Mon, 27 Nov 2006 22:04:42 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061115)

Hi all,

[ sorry for crossposting ]

I have investigated a little bit GNU ld problems on Solaris related to filter symbols and I seem to have identified one test case which fails under all circumstances. I'd like to get some advices on how to best proceed next.

The nice background info to the problem is at http://www.opensolaris.org/jive/thread.jspa?threadID=18778&tstart=45.

There seems to be a bug in GNU ld that does not link filter symbols properly. The expected behavior is to link in filter symbols as `undefined' thus leaving them for resolution at runtime. In certain cases, ld does not recognize filter symbols and links them into the resulting binary as absolute symbols at address 0x0.

This happens as I could observe when:

1. library that contains filtered symbols is mentioned at the ld commandline, i.e. -lpthread, -ldl, -lc
2. -Wl,-shared option is specified

I also know that the problem does not occur when -Wl,-shared is removed entirely, or replaced with -Wl,-E or -Wl,-Bdynamic, although I don't know how these differ.

There might be other circumstances where this bug exhibits itself, but this one is 100% reproducible, I have attached the simple test case + its output + version of the software used. The problematic system in question is Nexenta GNU Solaris alpha 6.


let me know what other information I can provide,
thanx,
Martin

--
http://martinman.net

Attachment: binutils-bug.tar.gz
Description: GNU Zip compressed data

echo "Rebuilding bggy1..."
Rebuilding bggy1...
gcc -o bggy1 -shared -lpthread -ldl buggy.c
ldd bggy1
        libpthread.so.1 =>       /lib/libpthread.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libgcc_s.so.1 =>         /lib/libgcc_s.so.1
        libc.so.1 =>     /lib/libc.so.1
        libm.so.2 =>     /lib/libm.so.2
echo "The nm output of bggy1 should ideally not contain any Absolute symbols at 
address 0x00000000"
The nm output of bggy1 should ideally not contain any Absolute symbols at 
address 0x00000000
nm -D bggy1 | grep '\(pthr\|dlop\)'
00000000 A dlopen
00000000 A pthread_mutex_destroy
00000000 A pthread_mutex_init
echo ""

echo "Rebuilding bggy2..."
Rebuilding bggy2...
gcc -o bggy2 -Wl,-shared -lpthread -ldl buggy.c
ldd bggy2
        libpthread.so.1 =>       /lib/libpthread.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libc.so.1 =>     /lib/libc.so.1
        libm.so.2 =>     /lib/libm.so.2
echo "The nm output of bggy2 should ideally not contain any Absolute symbols at 
address 0x00000000"
The nm output of bggy2 should ideally not contain any Absolute symbols at 
address 0x00000000
nm -D bggy2 | grep '\(pthr\|dlop\)'
00000000 A dlopen
00000000 A pthread_mutex_destroy
00000000 A pthread_mutex_init
echo ""

echo "Rebuilding bggy3..."
Rebuilding bggy3...
gcc -o bggy3 -Wl,-E -lpthread -ldl buggy.c
ldd bggy3
        libpthread.so.1 =>       /lib/libpthread.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libc.so.1 =>     /lib/libc.so.1
        libm.so.2 =>     /lib/libm.so.2
echo "The nm output of bggy3 should ideally not contain any Absolute symbols at 
address 0x00000000"
The nm output of bggy3 should ideally not contain any Absolute symbols at 
address 0x00000000
nm -D bggy3 | grep '\(pthr\|dlop\)'
         U dlopen
         U pthread_mutex_destroy
         U pthread_mutex_init
echo ""

echo "Rebuilding bggy4..."
Rebuilding bggy4...
gcc -o bggy4  -lpthread -ldl buggy.c
ldd bggy4
        libpthread.so.1 =>       /lib/libpthread.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libc.so.1 =>     /lib/libc.so.1
        libm.so.2 =>     /lib/libm.so.2
echo "The nm output of bggy4 should ideally not contain any Absolute symbols at 
address 0x00000000"
The nm output of bggy4 should ideally not contain any Absolute symbols at 
address 0x00000000
nm -D bggy4 | grep '\(pthr\|dlop\)'
         U dlopen
         U pthread_mutex_destroy
         U pthread_mutex_init
echo ""

echo "Rebuilding bggy5..."
Rebuilding bggy5...
gcc -o bggy5 -Wl,-Bdynamic -lpthread -ldl buggy.c
ldd bggy5
        libpthread.so.1 =>       /lib/libpthread.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libc.so.1 =>     /lib/libc.so.1
        libm.so.2 =>     /lib/libm.so.2
echo "The nm output of bggy5 should ideally not contain any Absolute symbols at 
address 0x00000000"
The nm output of bggy5 should ideally not contain any Absolute symbols at 
address 0x00000000
nm -D bggy5 | grep '\(pthr\|dlop\)'
         U dlopen
         U pthread_mutex_destroy
         U pthread_mutex_init
echo ""

gcc (GCC) 4.0.3 (GNU_Solaris 4.0.3-1nexenta6)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GNU ld version 2.16.91 20060118 NexentaOS GNU/OpenSolaris
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
GNU assembler 2.16.91 20060118 NexentaOS GNU/OpenSolaris
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i386-pc-solaris2.11'.
GNU nm 2.16.91 20060118 NexentaOS GNU/OpenSolaris
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

reply via email to

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