This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

IA64 bug with -z defs


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: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]