[Bug binutils/3237] New: readelf fails to dump complete DWARF 3 info

2006-09-20 Thread hjl at lucon dot org
When "readelf -w" is used on client.o in

http://sources.redhat.com/bugzilla/show_bug.cgi?id=3191

it fails to dump .gnu.linkonce.wi.client.cpp.7682538d section since it assumes
there is only one set of debug sections. I don't know what the best way to
handle it is. One possibility is to combine the same kind of sections first
before dumping. Otherwise, we have to track which .debug_line a recond is
referring to. However, we will need to clearly mark begin and end of
subsections.

-- 
   Summary: readelf fails to dump complete DWARF 3 info
   Product: binutils
   Version: 2.18 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: hjl at lucon dot org
CC: bug-binutils at gnu dot org


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/3191] Dwarf 2 reader in linker doesn't suppor DW_FORM_ref_addr

2006-09-20 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2006-09-20 22:22 ---
Here is a new patch

http://sourceware.org/ml/binutils/2006-09/msg00205.html

-- 


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/3191] Dwarf 2 reader in linker doesn't suppor DW_FORM_ref_addr

2006-09-20 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2006-09-20 20:57 ---
My patch is wrong. It just hides the real problem. dwarf2.c doesn't really
support more than one debug_xxx sections properly. It won't be easy to fix.
Since dwarf2.c is mainly used for error reporting, it isn't a serious problem.

BTW, readelf also assumes there is one set of DWARF debug sections. It fails
to dump client.o properly.

-- 


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/3235] New: objdump on AMD64 - wrong output for prefixed offset operands.

2006-09-20 Thread fruffell at cs dot uwaterloo dot ca
Problem:


Opcodes 0xA0-0xA3 (mov instruction) each contain a memory offset encoded within 
 
the instruction.  The offsets are address sized, however, on x86_64 the offset 
size defaults to 64-bits (see AMD64 Architecture Programmer's Manual, Volume 3, 
page 192).  Because the offset is address sized, the address override prefix of 
0x67 toggles between 64-bit/32-bit addresses when in 64-bit mode. However, 
objdump always displays the offset as a 64-bit address.

Testcase:
-

memoffset.c:

-- cut 
char tstStr[] = "hello world";

int main()
{
printf("Address of tstStr is 0x%lx\n", tstStr);
asm("mov $'z', %al\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t");
printf("tstStr is \"%s\"\n", tstStr);
return 0;
}
-- cut 

I don't know how to force gas to generate the 0xA2 mov instruction (it 
generates a 0x88 mov), so I have to do this by hand.  When I run the program, 
the address printed is 0x500908, so using a hex editor I replace the sequence 
of nops with "0x67 0xa2 0x08 0x09 0x50 0x00".  After the hexedit, the program 
is rerun, and the output displayed is "zello world" instead of "hello world" 
(the mov instruction was successful).  objdump however still displays the 
address as 64-bits:

400500:   b0 7a   mov$0x7a,%al
400502:   67 a2 08 09 50 00 90addr32 mov %al,0xbe90909000500908
400509:   90 90 be

which is impossible since this is an invalid address (composition of tstStr's 
address and the next 3 opcodes).  Instead, the output should be:

400500:   b0 7a   mov$0x7a,%al
400502:   67 a2 08 09 50 00 90addr32 mov %al,0x500908
400509:   90  nop
40050A:   90  nop
...

Version info:
-

[EMAIL PROTECTED] ~/memOffset $ objdump -v
GNU objdump 2.16.1

[EMAIL PROTECTED] ~/memOffset $ uname -ar
Linux collateral 2.6.16-gentoo-r9 #1 SMP PREEMPT Fri Sep 8 11:52:36 EDT 2006 
x86_64 AMD Opteron(tm) Processor 246 GNU/Linux

-- 
   Summary: objdump on AMD64 - wrong output for prefixed offset
operands.
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: fruffell at cs dot uwaterloo dot ca
CC: bug-binutils at gnu dot org


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: [Bug ld/3191] Dwarf 2 reader in linker doesn't suppor DW_FORM_ref_addr

2006-09-20 Thread Jim Wilson
On Wed, 2006-09-20 at 19:02 +, hjl at lucon dot org wrote:
> When reporting linker error, dwarf2 reader doesn't support more than one
> .debug_info section.

You can only have more than one debug_info section when
-feliminate-dwarf2-dups is used.  This isn't a commonly used option, and
there may be a number of problems with it.  This is allowed by DWARF3,
but not by DWARF2.

I see how your patch might help now.  The debug info is 32-bits as I
mentioned earlier.  The problem here is that pointers are 64-bits.
read_address uses addr_size, and hence is reading a 64-bit address when
it should be reading a 32-bit address, thus getting a number that is too
large.  Your fix adding 64-bit debug support helps because in the 32-bit
case you replaced the read_address call with a read_4_bytes call, which
correctly reads the 32-bit value we want.

However, this is speculation, as I don't know how to reproduce the
failure.  I don't understand why this hasn't come up before.  Also, it
isn't clear what this has to do with the further information you have
provided about multiple debug_info sections.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com




___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/3191] Dwarf 2 reader in linker doesn't suppor DW_FORM_ref_addr

2006-09-20 Thread wilson at specifix dot com

--- Additional Comments From wilson at specifix dot com  2006-09-20 19:31 
---
Subject: Re:  Dwarf 2 reader in linker doesn't suppor
DW_FORM_ref_addr

On Wed, 2006-09-20 at 19:02 +, hjl at lucon dot org wrote:
> When reporting linker error, dwarf2 reader doesn't support more than one
> .debug_info section.

You can only have more than one debug_info section when
-feliminate-dwarf2-dups is used.  This isn't a commonly used option, and
there may be a number of problems with it.  This is allowed by DWARF3,
but not by DWARF2.

I see how your patch might help now.  The debug info is 32-bits as I
mentioned earlier.  The problem here is that pointers are 64-bits.
read_address uses addr_size, and hence is reading a 64-bit address when
it should be reading a 32-bit address, thus getting a number that is too
large.  Your fix adding 64-bit debug support helps because in the 32-bit
case you replaced the read_address call with a read_4_bytes call, which
correctly reads the 32-bit value we want.

However, this is speculation, as I don't know how to reproduce the
failure.  I don't understand why this hasn't come up before.  Also, it
isn't clear what this has to do with the further information you have
provided about multiple debug_info sections.


-- 


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/3191] Dwarf 2 reader in linker doesn't suppor DW_FORM_ref_addr

2006-09-20 Thread hjl at lucon dot org

--- Additional Comments From hjl at lucon dot org  2006-09-20 19:02 ---
Gcc may generate:

 .section.gnu.linkonce.wi.client.cpp.7682538d,"",@progbits
 ...
DW.client.cpp.7682538d.2b:
.uleb128 0xd
.long   0x16a
.byte   0x1
.long   .LASF10
.byte   0x1
.byte   0x25
.byte   0x1
.uleb128 0xe
.long   0x114
.byte   0x1
.byte   0x0


.section.debug_info
...
.uleb128 0x8d
.long   0x1c3f
.quad   DW.client.cpp.7682538d.2b
.byte   0x0

When reporting linker error, dwarf2 reader doesn't support more than one
.debug_info section.

-- 
   What|Removed |Added

Summary|Linker doesn't support  |Dwarf 2 reader in linker
   |DWARF3 DW_FORM_ref_addr |doesn't suppor
   ||DW_FORM_ref_addr


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/3191] Linker doesn't support DWARF3 DW_FORM_ref_addr

2006-09-20 Thread pluto at agmk dot net


-- 
   What|Removed |Added

Attachment #1306 is|0   |1
   obsolete||


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/3191] Linker doesn't support DWARF3 DW_FORM_ref_addr

2006-09-20 Thread pluto at agmk dot net

--- Additional Comments From pluto at agmk dot net  2006-09-20 09:26 ---
Created an attachment (id=1307)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1307&action=view)
preprocessed sources and objects from gcc-4.1/4.2


-- 


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/3191] Linker doesn't support DWARF3 DW_FORM_ref_addr

2006-09-20 Thread pluto at agmk dot net

--- Additional Comments From pluto at agmk dot net  2006-09-20 09:24 ---
(In reply to comment #11)
> (In reply to comment #8)
> > It looks like a gcc bug. See
> > 
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29146
> 
> No it does not.
> What version of GCC did you produce this object file?

with gcc 4.1.2-20060817 (without patch from #7) i get:

$ g++ -O2 -fno-strict-aliasing -fwrapv -march=x86-64 \
  -gdwarf-2 -g2 -feliminate-dwarf2-dups client-gcc41.ii -c
$ g++ -o /dev/null client-gcc41.o
(...)
/usr/bin/ld: Dwarf Error: DW_FORM_strp offset (660090) greater than or equal 
to .debug_str size (27111).
/usr/bin/ld: Dwarf Error: DW_FORM_strp offset (660090) greater than or equal 
to .debug_str size (27111).
(...)

with gcc 4.1.2-20060817 (with patch from #7) it works fine.
with gcc-4.2 (without patch from #7) it works fine.
with gcc-4.2 (with patch from #7) not tested (probably works too).

> And how did you build GCC while you are at that?

$ gcc -v
Reading specs from /usr/lib64/gcc/x86_64-pld-linux/4.1.2/specs
Target: x86_64-pld-linux
Configured 
with: ../configure --prefix=/usr --with-local-prefix=/usr/local 
--libdir=/usr/lib64 --libexecdir=/usr/lib64 --infodir=/usr/share/info 
--mandir=/usr/share/man --x-libraries=/usr/lib64 --enable-shared 
--enable-threads=posix --enable-languages=c,c++,fortran,objc,obj-c++,ada,java 
--enable-c99 --enable-long-long --enable-multilib --enable-nls --disable-werror 
--with-gnu-as --with-gnu-ld --with-demangler-in-ld --with-system-zlib 
--with-slibdir=/lib64 --without-system-libunwind --enable-cmath 
--with-long-double-128 --with-gxx-include-dir=/usr/include/c++/4.1.2 
--disable-libstdcxx-pch --enable-__cxa_atexit --enable-libstdcxx-allocator=new 
--with-qt4dir=/usr/lib64/qt4 --disable-libjava-multilib --enable-libgcj 
--enable-libgcj-multifile --enable-libgcj-database --enable-gtk-cairo 
--enable-java-awt=qt,gtk,xlib --enable-jni --enable-xmlj --enable-alsa 
--enable-dssi 
x86_64-pld-linux
Thread model: posix
gcc version 4.1.2 20060817 (prerelease) (PLD-Linux)


-- 


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

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


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils