[PATCH] D143226: [MC][CodeGen] Introduce handling for R_RISCV_PLT32 relocation

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 15:19:47 PST 2023


jrtc27 added inline comments.


================
Comment at: llvm/test/CodeGen/RISCV/dso_local_equivalent.ll:1-11
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=riscv64 -relocation-model=pic -data-sections -o - %s --asm-verbose=0 | FileCheck %s
+
+declare void @extern_func()
+
+; CHECK: const:
+; CHECK:   .word   extern_func at PLT-const
----------------
Hm, seems update_llc_test_checks.py can't handle globals, just uses an empty dict :(

In that case I think you want this cleaned up version of your hand-written test.

Ideally we'd also have an RV32 test, but unifying them is a bit awkward due to the trunc needing to not exist. Technically you can do an oversized ptrtoint on RV32 (or undersized ptrtoint on RV64 and forego the trunc on both) but that's not what Clang (currently) generates. I do wonder why it doesn't just do an i32 ptrtoint unconditionally though...


================
Comment at: llvm/test/MC/RISCV/elf-reloc-plt32.s:4
+
+.section .data
+.word extern_func at PLT - . + 4
----------------
Just .data?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143226/new/

https://reviews.llvm.org/D143226



More information about the llvm-commits mailing list