[llvm] [Opt] Enable statically-linked plugin support (PR #79227)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 12:25:41 PST 2024


efriedma-quic wrote:

> that seems much simpler than this PR + https://github.com/llvm/llvm-project/pull/79205

I'm not sure I understand what you're getting at with the reference to #79205 .  Most of the decisions there were constrained by producing something that actually builds correctly in all configurations.  The goal is to allow users to build an "opt-with-a-plugin" without rebuilding LLVM.  So we put the logic of opt into a library.  We have to be able to build that library as a shared library for -DBUILD_SHARED_LIBS builds, so that library can't contain the definition of main().  So in sum, we need to have a library that contains all the logic, and exposes optMain() to call that logic.

We could remove the parameter from optMain, and use a global variable instead, but that doesn't really simplify anything.

https://github.com/llvm/llvm-project/pull/79227


More information about the llvm-commits mailing list