[all-commits] [llvm/llvm-project] f992ae: Slightly improve the getenv("bar") linking problem
Luke Drummond via All-commits
all-commits at lists.llvm.org
Wed Jul 23 04:15:42 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f992ae4fd16357116b341a1c8291b970787dc462
https://github.com/llvm/llvm-project/commit/f992ae4fd16357116b341a1c8291b970787dc462
Author: Luke Drummond <luke.drummond at codeplay.com>
Date: 2025-07-23 (Wed, 23 Jul 2025)
Changed paths:
M llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
M llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
M llvm/include/llvm/ExecutionEngine/MCJIT.h
M llvm/include/llvm/LinkAllIR.h
M llvm/include/llvm/LinkAllPasses.h
A llvm/include/llvm/Support/AlwaysTrue.h
M llvm/tools/bugpoint/bugpoint.cpp
M polly/include/polly/LinkAllPasses.h
Log Message:
-----------
Slightly improve the getenv("bar") linking problem
There's been a variation of the following in the code since 2005:
if (unoptimizable_true)
return;
use_this_symbol_to_force_linking(); // unreachable but never removed
Way back in 00d5508496c it was the win32 call `GetCurrentProcess`
but switched to `getenv("bar")` fairly soon after in 63e504ff43. While
that pulled in fewer dependencies and made the code portable, it's a
bit of a weird construct. The environment variable used for the `getenv`
call is "bar", which is particularly weird to see fly past when you run
`ltrace` on a binary linked against LLVM.
In this patch I don't try to replace this construct wholesale - it's
still required for architectural reasons I'm not able to tackle right
now, but I did try and make it slightly less weird and opaque:
- It gives the construct a name
- The environment variable hints where this comes from and that its
value is ignored
Combined, this should be a bit of improvement for the next person who
wonders what LLVM is up to when they trace their process or see
smatterings of `getenv("bar")` dotted around the source.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list