facebookarchive / BOLT

Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries
2.52k stars 178 forks source link

`objdump --dwarf=decodedline` produce tons of warnings about `file index 0 > number of files 291` and `corrupt file index 4294967295 encountered` #174

Closed KSSysLab closed 3 years ago

KSSysLab commented 3 years ago

The line number of some file is 0. Is it the root cause?

a.out:     file format elf64-x86-64

Contents of the .debug_line section:

CU: /home/distcc/clang-11.1.0/include/c++/v1/__tree:
File name                            Line number    Starting address    View    Stmt

/home/distcc/clang-11.1.0/include/c++/v1/vector:
vector                                       437            0x4114aa               x

/home/distcc/clang-11.1.0/include/c++/v1/new:
new                                          253            0x4114c1               x

/home/distcc/clang-11.1.0/include/c++/v1/vector:
vector                                         0            0x4114cb
vector                                       996            0x4114ce               x
vector                                       996            0x4114d5
vector                                       997            0x4114dc               x
vector                                       997            0x4114e0
vector                                         0            0x4114e7

/home/distcc/clang-11.1.0/include/c++/v1/memory:
memory                                      1809            0x4114f1               x
memory                                      1601            0x4114f9               x
memory                                      1809            0x4114fd               x
memory                                      1601            0x411508               x
memory                                         0            0x41150c
memory                                      1809            0x41150f               x

See the memory standard header file, the address 0x41150c has a ZERO line number. I suspect BOLT has some issues with rewriting dwarf info since the address belongs to .bolt.org.text section.

  8 .rela.plt     000048a8  0000000000408bc0  0000000000408bc0  00008bc0  2**3  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .init         0000001a  000000000040e000  000000000040e000  0000e000  2**2  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .plt          00003080  000000000040e020  000000000040e020  0000e020  2**4  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .plt.got      000000b0  00000000004110a0  00000000004110a0  000110a0  2**3  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .bolt.org.text 03ca9d3f  0000000000411150  0000000000411150  00011150  2**4  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .fini         00000009  00000000040bae90  00000000040bae90  03cbae90  2**2  CONTENTS, ALLOC, LOAD, READONLY, CODE

My objdump version: 2.36.50

aaupov commented 3 years ago

@ayermolo: can you please weigh in on this issue?

ayermolo commented 3 years ago

Not sure. I am not familiar with that part of the code. @KSSysLab can you post a small repro program?

maksfb commented 3 years ago

This issue should be fixed in the trunk. @KSSysLab, could you please confirm?