svn commit: r360801 - head/contrib/llvm-project/llvm/lib/Support/Unix
Ed Maste
emaste at FreeBSD.org
Thu May 7 21:18:38 UTC 2020
Author: emaste
Date: Thu May 7 21:18:37 2020
New Revision: 360801
URL: https://svnweb.freebsd.org/changeset/base/360801
Log:
Merge commit 21e5e1724b75 from llvm git:
getMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD
Once we hit AT_NULL, we need to bail out of the loop; not just the
enclosing switch. This fixes basic usage (e.g. `cc --version`) when
AT_EXECPATH isn't present on older branches (e.g. under
emu-user-static, at the moment), where we would previously run off
the end of ::environ.
Patch By: kevans
Reviewed By: arichardson
Differential Revision: https://reviews.llvm.org/D79239
MFC after: 3 days
Modified:
head/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc
Modified: head/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc
==============================================================================
--- head/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc Thu May 7 21:14:12 2020 (r360800)
+++ head/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc Thu May 7 21:18:37 2020 (r360801)
@@ -208,14 +208,9 @@ std::string getMainExecutable(const char *argv0, void
while (*p++ != 0)
;
// Iterate through auxiliary vectors for AT_EXECPATH.
- for (;;) {
- switch (*(uintptr_t *)p++) {
- case AT_EXECPATH:
+ for (; *(uintptr_t *)p != AT_NULL; p++) {
+ if (*(uintptr_t *)p++ == AT_EXECPATH)
return *p;
- case AT_NULL:
- break;
- }
- p++;
}
#endif
// Fall back to argv[0] if auxiliary vectors are not available.
More information about the svn-src-all
mailing list