================ @@ -18,6 +18,6 @@ .globl _start _start: .data - .word foo@PLT - . - .word foo@PLT - . + 1 - .word foo@PLT - . - 1 + .word %plt(foo - .) ---------------- MaskRay wrote:
The IR doesn't model the current location (DOT). Instead, It computes `SymA-SymB+offset`. `SymB` might not be the current location, but it and the current location must be in the same section. Let's use `llvm/test/CodeGen/X86/x86-64-plt-relative-reloc.ll` (legacy; but slightly better than `dso_local_equivalent.ll`): ``` @vtable = constant [5 x i32] [i32 0, i32 trunc (i64 sub (i64 ptrtoint (ptr @fn1 to i64), i64 ptrtoint (ptr getelementptr ([5 x i32], ptr @vtable, i32 0, i32 1) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @fn2 to i64), i64 ptrtoint (ptr getelementptr ([5 x i32], ptr @vtable, i32 0, i32 1) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @fn3 to i64), i64 ptrtoint (ptr getelementptr ([5 x i32], ptr @vtable, i32 0, i32 1) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @global4 to i64), i64 ptrtoint (ptr getelementptr ([5 x i32], ptr @vtable, i32 0, i32 1) to i64)) to i32) ] ``` If we need to emit `%pltpcrel`, we will have to change `AsmPrinter::lowerConstant` to know the base GlobalVariable, which might be possible... https://github.com/llvm/llvm-project/pull/132569 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits