[PATCH] D126781: [CodeGen] Correctly handle weak symbols in the codegen

Jun Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 07:44:04 PDT 2022


junaire created this revision.
junaire added reviewers: v.g.vassilev, rjmccall.
Herald added a project: All.
junaire requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This used to be several downstream patches of Cling, it aims to fix
errors in Clang Interpreter when trying to use inline functions.
Before this patch:

clang-repl> inline int foo() { return 42;}
clang-repl> int x = foo();

JIT session error: Symbols not found: [ _Z3foov ]
error: Failed to materialize symbols:
{ (main, { x, $.incr_module_1.__inits.0, __orc_init_func.incr_module_1 }) }

Co-authored-by: Axel Naumann <Axel.Naumann at cern.ch>
Signed-off-by: Jun Zhang <jun at junz.org>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126781

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/ModuleBuilder.cpp
  clang/unittests/Interpreter/InterpreterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126781.433400.patch
Type: text/x-patch
Size: 5972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220601/a81868df/attachment-0001.bin>


More information about the cfe-commits mailing list