[PATCH] D82745: [ThinLto] Fix Ifunc symbol usage

Vladislav Khmelevsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 02:39:30 PDT 2020


yota9 created this revision.
yota9 added reviewers: tejohnson, mehdi_amini, pcc.
Herald added subscribers: llvm-commits, arphaman, dexonsmith, steven_wu, hiraditya, inglorion.
Herald added a project: LLVM.

This patch fixes undefined reference problem when using ifunc symbols with
thinLTO.

The bug link: https://bugs.llvm.org/show_bug.cgi?id=46488#
This patch adds ifunc symbol to the global value summary. The ifunc
summary contains link to its resolver.

The llvm-dis results of the bug example:

Before patch:
^1 = gv: (name: "called", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 1, readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0)))) ; guid = 9741048783615374159
^2 = gv: (name: "resolver", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 1, readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0), refs: (^1)))) ; guid = 18291748799076262136

After patch:
^1 = gv: (name: "foo", summaries: (ifunc: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), resolver: ^3))) ; guid = 6699318081062747564
^2 = gv: (name: "called", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 1, readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0)))) ; guid = 9741048783615374159
^3 = gv: (name: "resolver", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 1, readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0), refs: (^2)))) ; guid = 18291748799076262136


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82745

Files:
  llvm/include/llvm/Bitcode/LLVMBitCodes.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Transforms/IPO/FunctionImport.cpp
  llvm/test/Bitcode/thinlto-ifunc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82745.274019.patch
Type: text/x-patch
Size: 20479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200629/873b9c84/attachment-0001.bin>


More information about the llvm-commits mailing list