[llvm] [flang][runtime] Use dlsym to access char** environ on FreeBSD (PR #158477)

Peter Klausler via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 29 08:41:21 PDT 2025


================
@@ -104,6 +108,10 @@ void ExecutionEnvironment::Configure(int ac, const char *av[],
 
 #ifdef _WIN32
   envp = _environ;
+#elif defined(__FreeBSD__)
+  auto envpp = reinterpret_cast<char ***>(dlsym(RTLD_DEFAULT, "environ"));
----------------
klausler wrote:

We use braced initialization in the runtime, and always use braces around the controlled statements of `if`, `for`, and other constructs.


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


More information about the llvm-commits mailing list