Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions flang-rt/lib/runtime/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

#ifdef _WIN32
extern char **_environ;
#elif defined(__FreeBSD__)
// FreeBSD has environ in crt rather than libc. Using "extern char** environ"
// in the code of a shared library makes it fail to link with -Wl,--no-undefined
// See https://reviews.freebsd.org/D30842#840642
#else
extern char **environ;
#endif
Expand Down Expand Up @@ -104,6 +108,8 @@ void ExecutionEnvironment::Configure(int ac, const char *av[],

#ifdef _WIN32
envp = _environ;
#elif defined(__FreeBSD__)
envp = *reinterpret_cast<char ***>(dlsym(RTLD_DEFAULT, "environ"));
#else
envp = environ;
#endif
Expand Down
Loading