Luke Drummond f992ae4fd1 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.
2025-07-23 12:14:51 +01:00
..