[lld] [lld][ELF] Fix a corner case of elf::getLoongArchPageDelta (PR #71907)
    Lu Weining via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Nov 10 01:52:58 PST 2023
    
    
  
================
@@ -159,6 +159,10 @@ uint64_t elf::getLoongArchPageDelta(uint64_t dest, uint64_t pc) {
   bool negativeA = lo12(dest) > 0x7ff;
   bool negativeB = (result & 0x8000'0000) != 0;
 
+  // A corner case; directly return the expected result.
+  if (result == 0xfffffffffffff000 && negativeA)
+    return result = 0xffffffff00000000;
----------------
SixWeining wrote:
The current case is raised by some end user. I don't know if there are other cases too. Seems that binutils' processing is in elfnn-loongarch.c (`RELOCATE_CALC_PC64_HI32`); I'm not sure whether it is helpful.
https://github.com/llvm/llvm-project/pull/71907
    
    
More information about the llvm-commits
mailing list