public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* IA64 bug with -z defs
@ 2004-06-17  6:03 Ian Wienand
  2004-06-23  6:56 ` H. J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Wienand @ 2004-06-17  6:03 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1959 bytes --]

Hi,

This recently came up from a problem with gnome stuff in Debian on
IA64.  Basically, a developer added -Wl,-z,defs to a build, and IA64
broke.

Looking into it, say you have a simple shared library

--- l.c ---
int fn(int i)
{
	return notfound(i+1)
}
---

and do this 

$ gcc -g  -shared -o libl.so l.c
$ gcc -g -Wl,-z,defs  -shared -o libl.bad.so l.c
/tmp/ccCYI3Wd.o(.text+0x42): In function `fn':
/usr/src/binutils-test/l.c:3: warning: undefined reference to `notfound'
$ objdump --disassemble libl.so > good.dump
$ objdump --disassemble libl.bad.so > bad.dump
$ diff -u good.dump bad.dump
--- good.dump   2004-06-17 15:41:17.798943503 +1000
+++ bad.dump    2004-06-17 15:41:26.838005893 +1000
@@ -1,5 +1,5 @@

-libl.so:     file format elf64-ia64-little
+libl.bad.so:     file format elf64-ia64-little

 Disassembly of section .init:

@@ -154,7 +154,7 @@
  c5c:  00 00 04 00                         nop.i 0x0
  c60:  1c 00 00 00 01 00       [MFB]       nop.m 0x0
  c66:  00 00 00 02 00 00                   nop.f 0x0
- c6c:  c8 fd ff 58                         br.call.sptk.many b0=a20 <_init+0xa0>
+ c6c:  08 00 00 50                         br.call.sptk.many b0=c60 <fn+0x40>
  c70:  02 08 00 48 00 21       [MII]       mov r1=r36
  c76:  e0 00 20 00 42 00                   mov r14=r8;;
  c7c:  01 70 00 84                         mov r8=r14

So, as far as I can tell, the undefined reference when using -z defs
never ends up with a PLT slot (that's the branch to _init, right?) but
just loops back to it's self.  This was exactly the problem we were
seeing (programs would just sit and hang).

Doing the same thing on i386 results in both 'bad' and 'good' looking
exactly the same, so I assume it's an IA64 bug.

-i
ianw@gelato.unsw.edu.au
http://www.gelato.unsw.edu.au

(I had a quick look at the code, but quickly established it would take
me forever to figure out what is going on.)



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: IA64 bug with -z defs
  2004-06-17  6:03 IA64 bug with -z defs Ian Wienand
@ 2004-06-23  6:56 ` H. J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H. J. Lu @ 2004-06-23  6:56 UTC (permalink / raw)
  To: Ian Wienand; +Cc: binutils

On Thu, Jun 17, 2004 at 04:03:08PM +1000, Ian Wienand wrote:
> Hi,
> 
> This recently came up from a problem with gnome stuff in Debian on
> IA64.  Basically, a developer added -Wl,-z,defs to a build, and IA64
> broke.
> 
> Looking into it, say you have a simple shared library
> 
> --- l.c ---
> int fn(int i)
> {
> 	return notfound(i+1)
> }
> ---
> 
> and do this 
> 
> $ gcc -g  -shared -o libl.so l.c
> $ gcc -g -Wl,-z,defs  -shared -o libl.bad.so l.c
> /tmp/ccCYI3Wd.o(.text+0x42): In function `fn':
> /usr/src/binutils-test/l.c:3: warning: undefined reference to `notfound'
> $ objdump --disassemble libl.so > good.dump
> $ objdump --disassemble libl.bad.so > bad.dump
> $ diff -u good.dump bad.dump

It should be fixed in the Linux binutils 2.15.90.0.2:

Changes from binutils 2.15.90.0.1.1:

1. Update from binutils 2004 0412.
2. Add --as-needed/--no-as-needed to linker.
3. Fix -z defs in linker.
4. Always reserve the memory for ia64 dynamic linker.
5. Fix a race condition in ia64 lazy binding.

The current one is 2.15.91.0.1.


H.J.

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

end of thread, other threads:[~2004-06-23  6:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-17  6:03 IA64 bug with -z defs Ian Wienand
2004-06-23  6:56 ` H. J. Lu

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).