Go to file
Fangrui Song ba51fd5664 Reland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded
This restores r361830 "[ELF] Error on relocations to STT_SECTION symbols if the sections were discarded"
and dependent commits (r362218, r362497) which were reverted by r364321, with a fix of a --gdb-index issue.

.rela.debug_ranges contains relocations of range list entries:

    // start address of a range list entry
    // old: 0; after r361830: 0
    00000000000033a0 R_X86_64_64 .text._ZN2v88internal7Isolate7factoryEv + 0
    // end address of a range list entry
    // old: 0xe; after r361830: 0
    00000000000033a8 R_X86_64_64 .text._ZN2v88internal7Isolate7factoryEv + e

If both start and end addresses of a range list entry resolve to 0,
DWARFDebugRangeList::isEndOfListEntry() will return true, then the
.debug_range decoding loop will terminate prematurely:

    while (true) {
      decode StartAddress
      decode EndAddress
      if (Entry.isEndOfListEntry()) // prematurely
        break;
      Entries.push_back(Entry);
    }

In lld/ELF/SyntheticSections.cpp, readAddressAreas() will read
incomplete address ranges and the resulting .gdb_index will be
incomplete. For files that gdb hasn't loaded their debug info, gdb uses
.gdb_index to map addresses to CUs. The absent entries make gdb fail to
symbolize some addresses.

To address this issue, we simply allow relocations to undefined symbols
in DWARF.cpp:findAux() and let RelocationResolver resolve them.

This patch should fix:

[1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190603/659848.html
[2] https://bugs.chromium.org/p/chromium/issues/detail?id=978067

llvm-svn: 364391
2019-06-26 08:09:08 +00:00
.github Add github lockdown app to auto-close pull requests. 2019-06-25 22:51:46 +00:00
clang [clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase 2019-06-26 07:39:03 +00:00
clang-tools-extra [clangd] Add Value field to HoverInfo 2019-06-26 08:00:24 +00:00
compiler-rt Follow up fix for r364366. 2019-06-26 00:54:06 +00:00
debuginfo-tests [Python 3] Decode check_ouput result as UTF-8 2019-06-25 15:58:32 +00:00
libclc travis: Add LLVM-8 build 2019-03-27 21:28:31 +00:00
libcxx Revert "Change the ABI version and ABI namespace to be `_LIBCPP_VERSION`" 2019-06-26 00:05:14 +00:00
libcxxabi [demangle] Special case clang's creative mangling of __uuidof expressions. 2019-06-18 23:34:09 +00:00
libunwind [libunwind][AArch64] Fix libunwind::Registers_arm64::jumpto 2019-06-17 11:00:21 +00:00
lld Reland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded 2019-06-26 08:09:08 +00:00
lldb Fix a typo in help text. 2019-06-25 23:13:16 +00:00
llgo IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
llvm [Metadata] Add GNU extensions for call site DWARF symbols 2019-06-26 07:31:09 +00:00
openmp [OpenMP][libomptarget] Add support for declare target to clause under unified memory 2019-06-19 15:48:10 +00:00
parallel-libs Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
polly [test] Add wrap flags after D61934. 2019-06-17 19:17:07 +00:00
pstl [pstl] Default to the serial backend when unspecified 2019-06-20 17:56:51 +00:00
.arcconfig Update monorepo .arcconfig with new project callsign. 2019-01-31 14:34:59 +00:00
.clang-format Add .clang-tidy and .clang-format files to the toplevel of the 2019-01-29 16:43:16 +00:00
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.gitignore Add a reduced copy of the llvm .gitignore 2019-04-09 00:52:49 +00:00
README.md

README.md

The LLVM Compiler Infrastructure

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.