Author: hans Date: Tue Aug 20 02:56:16 2019 New Revision: 369359 URL: http://llvm.org/viewvc/llvm-project?rev=369359&view=rev Log: Merging r369199: ------------------------------------------------------------------------ r369199 | yhs | 2019-08-18 00:12:00 +0200 (Sun, 18 Aug 2019) | 26 lines
[BPF] Fix bpf llvm-objdump issues. Commit https://reviews.llvm.org/D57939 ("[DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries) made a change for relocation resolution when operating on an object file. The change unfortunately broke BPF as given SymbolValue (S) and Addent (A), previously relocation is resolved to S + A and after the change, it is resolved to S This patch fixed the issue by resolving relocation correctly. It looks not all relocation resolution reaches here and I did not trace down exactly when. But I do find if the object file includes codes in two different ELF sections than default ".text", the above bug will be triggered. This patch included a trivial two function source code to demonstrate this issue. The relocation for .debug_loc is resolved incorrectly due to this and llvm-objdump cannot display source annotated assembly. Differential Revision: https://reviews.llvm.org/D66372 ------------------------------------------------------------------------ Added: llvm/branches/release_90/test/CodeGen/BPF/objdump_two_funcs.ll - copied unchanged from r369199, llvm/trunk/test/CodeGen/BPF/objdump_two_funcs.ll Modified: llvm/branches/release_90/ (props changed) llvm/branches/release_90/lib/Object/RelocationResolver.cpp Propchange: llvm/branches/release_90/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Aug 20 02:56:16 2019 @@ -1,3 +1,3 @@ /llvm/branches/Apple/Pertwee:110850,110961 /llvm/branches/type-system-rewrite:133420-134817 -/llvm/trunk:155241,366431,366481,366487,366527,366570,366660,366868,366925,367019,367030,367062,367084,367124,367215,367292,367304,367306,367314,367340-367341,367394,367396,367398,367403,367417,367662,367750,367753,367846-367847,367898,367941,368004,368230,368300,368315,368324,368477-368478,368517-368519,368554,368572,368873,369011,369026,369084,369097,369168 +/llvm/trunk:155241,366431,366481,366487,366527,366570,366660,366868,366925,367019,367030,367062,367084,367124,367215,367292,367304,367306,367314,367340-367341,367394,367396,367398,367403,367417,367662,367750,367753,367846-367847,367898,367941,368004,368230,368300,368315,368324,368477-368478,368517-368519,368554,368572,368873,369011,369026,369084,369097,369168,369199 Modified: llvm/branches/release_90/lib/Object/RelocationResolver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_90/lib/Object/RelocationResolver.cpp?rev=369359&r1=369358&r2=369359&view=diff ============================================================================== --- llvm/branches/release_90/lib/Object/RelocationResolver.cpp (original) +++ llvm/branches/release_90/lib/Object/RelocationResolver.cpp Tue Aug 20 02:56:16 2019 @@ -90,9 +90,9 @@ static bool supportsBPF(uint64_t Type) { static uint64_t resolveBPF(RelocationRef R, uint64_t S, uint64_t A) { switch (R.getType()) { case ELF::R_BPF_64_32: - return S & 0xFFFFFFFF; + return (S + A) & 0xFFFFFFFF; case ELF::R_BPF_64_64: - return S; + return S + A; default: llvm_unreachable("Invalid relocation type"); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits