aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/TestModuleFileExtension.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2021-02-10 09:47:10 -0800
committerFangrui Song <i@maskray.me>2021-02-10 09:47:10 -0800
commit04a2e12612f49e65a7dc14fa45f11f0632d427f2 (patch)
tree9d7506a5b251a504b4c6c4f62e14ffd6b95b09c5 /clang/lib/Frontend/TestModuleFileExtension.cpp
parent4f30a3d3d26d55c0701dc56dde711667320fdd30 (diff)
downloadllvm-04a2e12612f49e65a7dc14fa45f11f0632d427f2.zip
llvm-04a2e12612f49e65a7dc14fa45f11f0632d427f2.tar.gz
llvm-04a2e12612f49e65a7dc14fa45f11f0632d427f2.tar.bz2
DebugInfo/Symbolize: Retrieve filename from the preceding STT_FILE for .symtab symbolization
The ELF spec says: > STT_FILE: Conventionally, the symbol's name gives the name of the source file associated with the object file. A file symbol has STB_LOCAL binding, its section index is SHN_ABS, and it precedes the other STB_LOCAL symbols for the file, if it is present. For a local symbol, the preceding STT_FILE symbol is almost always in the same file[1]. GNU addr2line uses this heuristic to retrieve the filename associated with a local symbol (e.g. internal linkage functions in C/C++). GNU addr2line can assign STT_FILE filename to a non-local symbol, too, but the trick only works if no regular symbol precede STT_FILE. This patch does not implement this corner case (not useful for most executables which have more than one files). In case of filename mismatch between .debug_line & .symtab, arbitrarily make .debug_line win. [1]: LLD does not synthesize STT_FILE symbols (https://bugs.llvm.org/show_bug.cgi?id=48023 see also https://sourceware.org/bugzilla/show_bug.cgi?id=26822). An assembly file without `.file` directives can cause mis-attribution. This is an edge case. Differential Revision: https://reviews.llvm.org/D95927
Diffstat (limited to 'clang/lib/Frontend/TestModuleFileExtension.cpp')
0 files changed, 0 insertions, 0 deletions