public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/2251] New: Weak undefined symbol doesn't work properly with PIE
@ 2006-01-31 19:13 hjl at lucon dot org
  2006-01-31 19:17 ` [Bug libc/2251] " hjl at lucon dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl at lucon dot org @ 2006-01-31 19:13 UTC (permalink / raw)
  To: glibc-bugs

Weak undefined symbol doesn't work proper with PIE. I see it on x86, x86-64
and IPF. See

http://gcc.gnu.org/ml/gcc/2006-01/msg01007.html

The bug is in both ld.so and ld. I opened a ld bug, PR 2218.

-- 
           Summary: Weak undefined symbol doesn't work properly with PIE
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: hjl at lucon dot org
                CC: glibc-bugs at sources dot redhat dot com
 BugsThisDependsOn: 2218


http://sourceware.org/bugzilla/show_bug.cgi?id=2251

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libc/2251] Weak undefined symbol doesn't work properly with PIE
  2006-01-31 19:13 [Bug libc/2251] New: Weak undefined symbol doesn't work properly with PIE hjl at lucon dot org
@ 2006-01-31 19:17 ` hjl at lucon dot org
  2006-01-31 19:40 ` hjl at lucon dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at lucon dot org @ 2006-01-31 19:17 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From hjl at lucon dot org  2006-01-31 19:17 -------
Created an attachment (id=854)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=854&action=view)
A testcase

PIE built with the fixed linker, I got

gcc -B./ -c -fPIC -g bar.c
gcc -B./ -shared -o libbar.so bar.o #-z nocombreloc
gcc -B./ -c -fPIC -g foo.c
gcc -B./ -c -fPIC -g main.c
gcc -B./ -c -fPIC -g dummy.c
gcc -B./ -shared -o libdummy.so dummy.o #-z nocombreloc
gcc -B./ -pie -o pie foo.o main.o libdummy.so -Wl,-z,nocombreloc -Wl,-rpath,.
gcc -B./ -o exec foo.o main.o libdummy.so -Wl,-z,nocombreloc -Wl,-rpath,.
cp -af libbar.so libdummy.so
./exec
main
foo
PASSED
./pie
main
foo
FAILED

That is undefined weak symbol in PIE is resolved to a definition in
libdummy.so unlike the normal executable.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2251

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libc/2251] Weak undefined symbol doesn't work properly with PIE
  2006-01-31 19:13 [Bug libc/2251] New: Weak undefined symbol doesn't work properly with PIE hjl at lucon dot org
  2006-01-31 19:17 ` [Bug libc/2251] " hjl at lucon dot org
@ 2006-01-31 19:40 ` hjl at lucon dot org
  2006-02-01 13:50 ` vapier at gentoo dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at lucon dot org @ 2006-01-31 19:40 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From hjl at lucon dot org  2006-01-31 19:40 -------
A patch is posted at

http://sources.redhat.com/ml/libc-alpha/2006-01/msg00152.html

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2251

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libc/2251] Weak undefined symbol doesn't work properly with PIE
  2006-01-31 19:13 [Bug libc/2251] New: Weak undefined symbol doesn't work properly with PIE hjl at lucon dot org
  2006-01-31 19:17 ` [Bug libc/2251] " hjl at lucon dot org
  2006-01-31 19:40 ` hjl at lucon dot org
@ 2006-02-01 13:50 ` vapier at gentoo dot org
  2006-03-01  3:57 ` vapier at gentoo dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vapier at gentoo dot org @ 2006-02-01 13:50 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|                            |toolchain@gentoo.org


http://sourceware.org/bugzilla/show_bug.cgi?id=2251

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libc/2251] Weak undefined symbol doesn't work properly with PIE
  2006-01-31 19:13 [Bug libc/2251] New: Weak undefined symbol doesn't work properly with PIE hjl at lucon dot org
                   ` (2 preceding siblings ...)
  2006-02-01 13:50 ` vapier at gentoo dot org
@ 2006-03-01  3:57 ` vapier at gentoo dot org
  2006-03-30  3:20 ` bje at sources dot redhat dot com
  2006-08-09  6:07 ` drepper at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: vapier at gentoo dot org @ 2006-03-01  3:57 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |toolchain at gentoo dot org
  GCC build triplet|toolchain@gentoo.org        |


http://sourceware.org/bugzilla/show_bug.cgi?id=2251

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libc/2251] Weak undefined symbol doesn't work properly with PIE
  2006-01-31 19:13 [Bug libc/2251] New: Weak undefined symbol doesn't work properly with PIE hjl at lucon dot org
                   ` (3 preceding siblings ...)
  2006-03-01  3:57 ` vapier at gentoo dot org
@ 2006-03-30  3:20 ` bje at sources dot redhat dot com
  2006-08-09  6:07 ` drepper at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: bje at sources dot redhat dot com @ 2006-03-30  3:20 UTC (permalink / raw)
  To: glibc-bugs



-- 
Bug 2251 depends on bug 2218, which changed state.

Bug 2218 Summary: Weak undefined symbol doesn't work properly with PIE
http://sourceware.org/bugzilla/show_bug.cgi?id=2218

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

http://sourceware.org/bugzilla/show_bug.cgi?id=2251

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libc/2251] Weak undefined symbol doesn't work properly with PIE
  2006-01-31 19:13 [Bug libc/2251] New: Weak undefined symbol doesn't work properly with PIE hjl at lucon dot org
                   ` (4 preceding siblings ...)
  2006-03-30  3:20 ` bje at sources dot redhat dot com
@ 2006-08-09  6:07 ` drepper at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2006-08-09  6:07 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2006-08-09 06:07 -------
I completely disagree.

The main executable references undef_func.  It's not available at link time. 
That's fine, it's a weak reference.  Like every other weak reference every user
has to check whether the pointer is NULL or not.

But the fact that the symbol is not defined doesn't mean it should not be found
at runtime.  It should be treated like every other symbol not found in the
executable itself (sans the error message from the linker).

This means, the correct behavior is for the linker to emit a relocation for the
symbol in which case the exec test case would also print FAILED.  This is a bug
in binutils.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=2251

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-08-09  6:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-31 19:13 [Bug libc/2251] New: Weak undefined symbol doesn't work properly with PIE hjl at lucon dot org
2006-01-31 19:17 ` [Bug libc/2251] " hjl at lucon dot org
2006-01-31 19:40 ` hjl at lucon dot org
2006-02-01 13:50 ` vapier at gentoo dot org
2006-03-01  3:57 ` vapier at gentoo dot org
2006-03-30  3:20 ` bje at sources dot redhat dot com
2006-08-09  6:07 ` drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).