bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/425] New: ld -r generates error "Unsupported .stab relocat


From: e9925248 at stud4 dot tuwien dot ac dot at
Subject: [Bug binutils/425] New: ld -r generates error "Unsupported .stab relocation"
Date: 3 Oct 2004 15:41:56 -0000

Under some conditions, ld -r generates turns a relocation in the 
.stabs section in a R_XXX_NONE relocation. This happens in  
elf_link_input_bfd (elflink.c): 
 
if (irela->r_offset >= (bfd_vma) -2) 
                    { 
                      /* This is a reloc for a deleted entry or somesuch. 
                         Turn it into an R_*_NONE reloc, at the same 
                         offset as the last reloc.  elf_eh_frame.c and 
                         elf_bfd_discard_info rely on reloc offsets 
                         being ordered.  */ 
                      irela->r_offset = last_offset; 
                      irela->r_info = 0; 
                      irela->r_addend = 0; 
                      continue; 
                    } 
 
If such a file is read again by the bfd-library,  
_bfd_stab_section_find_nearest_line (syms.c) will print always the  
error message "Unsupported .stab relocation". 
 
A minimal example: 
t1.s: 
----- 
        .text 
.Ltext0: 
        .stabs  "libgcc2.c",130,0,0,0 
        .text 
        .stabs "",100,0,0,Letext 
Letext: 
 
 
t2.s: 
----- 
        .text 
.Ltext0: 
        .stabs  "libgcc2.c",130,0,0,0 
        .stabs  "tconfig.h",130,0,0,0 
        .stabs  "../include/ansidecl.h",130,0,0,0 
        .stabn  162,0,0,0 
        .stabs  "config/m68hc05/m68hc05.h",130,0,0,0 
        .stabs  "config/dbxelf.h",130,0,0,0 
        .stabn  162,0,0,0 
        .stabn  162,0,0,0 
        .stabs  "defaults.h",130,0,0,0 
        .stabn  162,0,0,0 
        .stabn  162,0,0,0 
        .text 
        .stabs "",100,0,0,Letext 
Letext: 
 
tx.c: 
----- 
int test() 
{ 
return 1; 
} 
 
 
$ as -o t1.o t1.s 
$ as -o t2.o t2.s 
$gcc -c tx.o 
$objdump -tr t1.o t2.o tx.o 
 
t1.o:     file format elf32-i386 
 
SYMBOL TABLE: 
00000000 l    d  .text  00000000 
00000000 l    d  .data  00000000 
00000000 l    d  .bss   00000000 
00000000 l       .text  00000000 Letext 
00000000 l    d  .stab  00000000 
00000000 l    d  .stabstr       00000000 
 
 
RELOCATION RECORDS FOR [.stab]: 
OFFSET   TYPE              VALUE 
00000020 R_386_32          .text 
 
 
 
t2.o:     file format elf32-i386 
 
SYMBOL TABLE: 
00000000 l    d  .text  00000000 
00000000 l    d  .data  00000000 
00000000 l    d  .bss   00000000 
00000000 l       .text  00000000 Letext 
00000000 l    d  .stab  00000000 
00000000 l    d  .stabstr       00000000 
 
 
RELOCATION RECORDS FOR [.stab]: 
OFFSET   TYPE              VALUE 
00000098 R_386_32          .text 
 
 
 
tx.o:     file format elf32-i386 
 
SYMBOL TABLE: 
00000000 l    df *ABS*  00000000 tx.c 
00000000 l    d  .text  00000000 
00000000 l    d  .data  00000000 
00000000 l    d  .bss   00000000 
00000000 l    d  .note.GNU-stack        00000000 
00000000 l    d  .comment       00000000 
00000000 g     F .text  0000000a test 
 
$ objdump -dl t1.o t2.o tx.o 
 
t1.o:     file format elf32-i386 
 
 
t2.o:     file format elf32-i386 
 
 
tx.o:     file format elf32-i386 
 
Disassembly of section .text: 
 
00000000 <test>: 
test(): 
   0:   55                      push   %ebp 
   1:   89 e5                   mov    %esp,%ebp 
   3:   b8 01 00 00 00          mov    $0x1,%eax 
   8:   c9                      leave 
   9:   c3                      ret 
 
 
$ ld -r -o o1.o t1.o t2.o tx.o 
$ objdump -tr o1.o 
 
o1.o:     file format elf32-i386 
 
SYMBOL TABLE: 
00000000 l    d  .text  00000000 
00000000 l    d  .data  00000000 
00000000 l    d  .bss   00000000 
00000000 l    d  .stab  00000000 
00000000 l    d  *ABS*  00000000 
00000000 l    d  .stabstr       00000000 
00000000 l    d  .comment       00000000 
00000000 l    d  .note.GNU-stack        00000000 
00000000 l    d  *ABS*  00000000 
00000000 l    d  *ABS*  00000000 
00000000 l    d  *ABS*  00000000 
00000000 l       .text  00000000 Letext 
00000000 l       .text  00000000 Letext 
00000000 l    df *ABS*  00000000 tx.c 
00000000 g     F .text  0000000a test 
 
 
RELOCATION RECORDS FOR [.stab]: 
OFFSET   TYPE              VALUE 
00000020 R_386_32          .text 
00000024 R_386_NONE        *ABS* 
 
$ objdump -dl o1.o 
 
o1.o:     file format elf32-i386 
 
Disassembly of section .text: 
 
00000000 <test>: 
BFD: Unsupported .stab relocation 
   0:   55                      push   %ebp 
BFD: Unsupported .stab relocation 
   1:   89 e5                   mov    %esp,%ebp 
BFD: Unsupported .stab relocation 
   3:   b8 01 00 00 00          mov    $0x1,%eax 
BFD: Unsupported .stab relocation 
   8:   c9                      leave 
BFD: Unsupported .stab relocation 
   9:   c3                      ret 
 
$objdump -v 
GNU objdump 2.15.90.0.3 20040415 
 
Older binutils are also affected (2.13.90.0.18 20030121 Debian GNU/Linux). 
2.15.91 20040623 shows the same behavior. 
 
The assembler-files are an striped down version of a longer gcc-output,  
which shows the same behavior. If they are needed, I can provide them. 
 
Martin Kögler 
address@hidden

-- 
           Summary: ld -r generates error "Unsupported .stab relocation"
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: e9925248 at stud4 dot tuwien dot ac dot at
                CC: bug-binutils at gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: all target which use elf and stabs


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

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




reply via email to

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