bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/24191] New: Gold doesn't properly process relocations to dedup


From: marc at groundctl dot com
Subject: [Bug gold/24191] New: Gold doesn't properly process relocations to deduplicated code
Date: Thu, 07 Feb 2019 14:20:05 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=24191

            Bug ID: 24191
           Summary: Gold doesn't properly process relocations to
                    deduplicated code
           Product: binutils
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: marc at groundctl dot com
                CC: ian at airs dot com
  Target Milestone: ---

$ cat x.cpp
class a {
  virtual void c();
};
inline void a::c(){}
$ g++ -g -c x.cpp -o x.o
$ objdump --dwarf=decodedline -r -j.debug_line x.o

x.o:     file format elf64-x86-64

Contents of the .debug_line section:

CU: x.cpp:
File name                            Line number    Starting address    View
x.cpp                                          4                   0
x.cpp                                          4                 0x8
x.cpp                                          4                 0xb


RELOCATION RECORDS FOR [.debug_line]:
OFFSET           TYPE              VALUE 
000000000000002b R_X86_64_64       .text._ZN1a1cEv


$ ld.gold x.o x.o -o x.gold -lstdc++
$ objdump --dwarf=decodedline x.gold

x.gold:     file format elf64-x86-64

Contents of the .debug_line section:

CU: x.cpp:
File name                            Line number    Starting address    View
x.cpp                                          4            0x4002c0
x.cpp                                          4            0x4002c8
x.cpp                                          4            0x4002cb


CU: x.cpp:
File name                            Line number    Starting address    View
x.cpp                                          4                   0
x.cpp                                          4                 0x8
x.cpp                                          4                 0xb


$ ld.bfd x.o x.o -o x.bfd -lstdc++
ld.bfd: warning: cannot find entry symbol _start; defaulting to
0000000000401000
$ objdump --dwarf=decodedline x.bfd

x.bfd:     file format elf64-x86-64

Contents of the .debug_line section:

CU: x.cpp:
File name                            Line number    Starting address    View
x.cpp                                          4            0x401000
x.cpp                                          4            0x401008
x.cpp                                          4            0x40100b


CU: x.cpp:
File name                            Line number    Starting address    View
x.cpp                                          4            0x401000
x.cpp                                          4            0x401008
x.cpp                                          4            0x40100b


It appears that gold does not process the relocation in the second instance of
x.o, and so in the final binary there are 2 debug line entries; one pointing at
the correct address and one pointing at 0.  This is handled correctly by
ld.bfd.  This may be related to bug 16794.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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