[llvm-dev] unusual use of getenv

Luke Drummond via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 2 13:38:23 PST 2020


On Mon Nov 2, 2020 at 7:53 PM GMT, Michael Kruse wrote:

> I am pretty sure this has nothing to do with Windows, but with static
> linking.
>
> When building an executable (opt, clang) we need to ensure that all
> the symbols are available in the artifact to ensure that a loaded
> plugin uses them. Otherwise the linker may discard object files from
> .a libraries that are not used by the executable itself, which only
> uses a subset of the functionality. In particular, one wants to ensure
> that all passes are available in the opt executable, even though no
> default pass pipeline does not reference a pass but can be added using
> the cl::opt mechanism.
Right. Like a sort of static `-rdynamic` hack.
I'm starting to suspect it's not going to be straightforward to remove
this cleanly.

Thanks for the insight.


More information about the llvm-dev mailing list