diff options
author | Luís Marques <luismarques@lowrisc.org> | 2019-11-21 23:33:01 +0000 |
---|---|---|
committer | Luís Marques <luismarques@lowrisc.org> | 2019-11-21 23:34:05 +0000 |
commit | 7bf721e59c54aba854ab81cc6fc92db30446cfda (patch) | |
tree | 0963b9f6632a9b115c6fca858d87ccaf8794f24e /llvm/lib/Object/RelocationResolver.cpp | |
parent | 75434366cec161ee532ee0ec3dcb5ebeb588d9df (diff) | |
download | bcm5719-llvm-7bf721e59c54aba854ab81cc6fc92db30446cfda.tar.gz bcm5719-llvm-7bf721e59c54aba854ab81cc6fc92db30446cfda.zip |
[Object][RISCV] Resolve R_RISCV_32_PCREL
Summary: Add support for resolving `R_RISCV_32_PCREL` relocations. Those aren't
actually resolved AFAIK, but support is still needed to avoid llvm-dwarfdump
errors. The use of these relocations was introduced in D66419 but the
corresponding resolving wasn't added then. The test adds a check that should
catch future unresolved relocations.
Reviewers: asb, lenary
Reviewed By: asb
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70204
Diffstat (limited to 'llvm/lib/Object/RelocationResolver.cpp')
-rw-r--r-- | llvm/lib/Object/RelocationResolver.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Object/RelocationResolver.cpp b/llvm/lib/Object/RelocationResolver.cpp index 97c69677f58..5a1052ffcde 100644 --- a/llvm/lib/Object/RelocationResolver.cpp +++ b/llvm/lib/Object/RelocationResolver.cpp @@ -336,6 +336,7 @@ static bool supportsRISCV(uint64_t Type) { switch (Type) { case ELF::R_RISCV_NONE: case ELF::R_RISCV_32: + case ELF::R_RISCV_32_PCREL: case ELF::R_RISCV_64: case ELF::R_RISCV_SET6: case ELF::R_RISCV_SUB6: @@ -360,6 +361,8 @@ static uint64_t resolveRISCV(RelocationRef R, uint64_t S, uint64_t A) { return A; case ELF::R_RISCV_32: return (S + RA) & 0xFFFFFFFF; + case ELF::R_RISCV_32_PCREL: + return (S + RA - R.getOffset()) & 0xFFFFFFFF; case ELF::R_RISCV_64: return S + RA; case ELF::R_RISCV_SET6: |