[PATCH] D65755: [ELF][PPC] Don't relax ifunc toc-indirect accesses to toc-relative

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 08:57:23 PDT 2019


sfertile added inline comments.


================
Comment at: ELF/Arch/PPC64.cpp:175
   // Only non-preemptable defined symbols can be relaxed.
-  if (!d || d->isPreemptible)
+  //
+  // The toc entry of a non-preemptable ifunc is relocated by R_PPC64_IRELATIVE,
----------------
minor nit:  I think it would help readability if the new comment and check were added after the existing preemptible check.


================
Comment at: ELF/Arch/PPC64.cpp:176
+  //
+  // The toc entry of a non-preemptable ifunc is relocated by R_PPC64_IRELATIVE,
+  // not representable as a toc-relative value. Exclude ifunc.
----------------
It might be better to spell out why the address is not representable as a toc-relative value. IIUC: The symbol being referenced is a resolver function that the dynamic loader will run to determine what function should be used. Relaxing to a toc-relative reference will manifest the address of the resolver function as opposed to the address of the resolved function (which is not know until load time).


================
Comment at: test/ELF/ppc64-toc-relax-ifunc.s:6-7
+# RUN:   llvm-mc -filetype=obj -triple=powerpc64le - -o %t1.o
+# RUN: ld.lld %t.o %t1.o -o %t
+
+## ifunc is a non-preemptable STT_GNU_IFUNC. Its toc entry will be
----------------
FileCheck run-step is missing.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D65755





More information about the llvm-commits mailing list