llvm-project/llvm
Yonghong Song 821c93d556 [BPF] Disable relocation for .BTF.ext section
Build llvm with assertion on, and then build bcc against this llvm.
Run any bcc tool with debug=8 (turning on -g for clang compilation),
you will get the following assertion errors,
  /home/yhs/work/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:888:
  void llvm::RuntimeDyldELF::resolveBPFRelocation(const llvm::SectionEntry&, uint64_t,
    uint64_t, uint32_t, int64_t): Assertion `Value <= (4294967295U)' failed.

The .BTF.ext ELF section uses Fixup's to get the instruction
offsets. The data width of the Fixup is 4 bytes since we only need
the insn offset within the section.

This caused the above error though since R_BPF_64_32 expects
4-byte value and the Runtime Dyld tried to resolve the actual
insn address which is 8 bytes.

Actually the offset within the section is all what we need.
Therefore, there is no need to perform any kind of relocation
for .BTF.ext section and such relocation will actually cause
incorrect result.

This patch changed BPFELFObjectWriter::getRelocType() such that
for Fixup Kind FK_Data_4, if the relocation Target is a temporary
symbol, let us skip the relocation (ELF::R_BPF_NONE).

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 349778
2018-12-20 17:40:23 +00:00
..
benchmarks
bindings
cmake Re-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen" 2018-12-19 19:42:21 +00:00
docs Introduce llvm.loop.parallel_accesses and llvm.access.group metadata. 2018-12-20 04:58:07 +00:00
examples Fix build break from r347239 2018-11-19 18:51:11 +00:00
include Re-land r349731 "[CodeGen][ExpandMemcmp] Add an option for allowing overlapping loads. 2018-12-20 13:01:04 +00:00
lib [BPF] Disable relocation for .BTF.ext section 2018-12-20 17:40:23 +00:00
projects [projects] Use directory name for add_llvm_external_projects 2018-12-04 00:12:03 +00:00
resources
runtimes
test [CodeView] Emit global variables within lexical scopes to limit visibility 2018-12-20 17:33:45 +00:00
tools [llvm-objcopy] Use ELFOSABI_NONE instead of 0. NFC. 2018-12-20 10:59:52 +00:00
unittests Fix gcc7 -Wdangling-else warning. NFCI. 2018-12-20 14:09:15 +00:00
utils [gn build] Add build files for clang/lib/{Analysis,Edit,Sema} 2018-12-20 13:39:25 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt Revert r349517 "[CMake] Default options for faster executables on MSVC" 2018-12-19 18:01:42 +00:00
CODE_OWNERS.TXT [llvm-mca] Move llvm-mca library to llvm/lib/MCA. 2018-12-17 08:08:31 +00:00
CREDITS.TXT add Kang Zhang(shkzhang@cn.ibm.com) to the CREDITS.TXT 2018-11-25 02:56:49 +00:00
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT Update the list of platforms & archs 2018-12-16 14:47:16 +00:00
configure
llvm.spec.in

README.txt

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.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.