Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 May 2020 21:29:45 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r361142 - releng/11.4/contrib/llvm-project/llvm/lib/Support/Unix
Message-ID:  <202005172129.04HLTjqo018381@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Sun May 17 21:29:45 2020
New Revision: 361142
URL: https://svnweb.freebsd.org/changeset/base/361142

Log:
  MF11 r360876: 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
    qemu-user-static, at the moment), where we would previously run off
    the end of ::environ.
  
    Patch By: kevans
  
    Reviewed By: arichardson
  
  Approved by:	re (kib)

Modified:
  releng/11.4/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc
Directory Properties:
  releng/11.4/   (props changed)
  releng/11.4/contrib/llvm-project/llvm/   (props changed)

Modified: releng/11.4/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc
==============================================================================
--- releng/11.4/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc	Sun May 17 20:37:15 2020	(r361141)
+++ releng/11.4/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc	Sun May 17 21:29:45 2020	(r361142)
@@ -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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005172129.04HLTjqo018381>