[compiler-rt] 7ebde1b - Add a shim for setenv on PS4 since it does not exist.

Douglas Yung via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 15:22:35 PST 2019


Author: Douglas Yung
Date: 2019-11-12T15:05:45-08:00
New Revision: 7ebde1bf67daa24ea7735f2b2d7000d074e2ba93

URL: https://github.com/llvm/llvm-project/commit/7ebde1bf67daa24ea7735f2b2d7000d074e2ba93
DIFF: https://github.com/llvm/llvm-project/commit/7ebde1bf67daa24ea7735f2b2d7000d074e2ba93.diff

LOG: Add a shim for setenv on PS4 since it does not exist.

A few years back a similar change was made for getenv since neither function is supported on the PS4 platform.

Recently, commit d889d1e added a call to setenv in compiler-rt which was causing linking errors because the symbol was not found. This fixes that issue by putting in a shim similar to how we previously dealt with the lack of getenv.

Differential Revision: https://reviews.llvm.org/D70033

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingUtil.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingUtil.h b/compiler-rt/lib/profile/InstrProfilingUtil.h
index efba94ca7639..f0e29a8803a0 100644
--- a/compiler-rt/lib/profile/InstrProfilingUtil.h
+++ b/compiler-rt/lib/profile/InstrProfilingUtil.h
@@ -30,9 +30,11 @@ int lprofUnlockFileHandle(FILE *F);
  * lock for exclusive access. The caller will block
  * if the lock is already held by another process. */
 FILE *lprofOpenFileEx(const char *Filename);
-/* PS4 doesn't have getenv. Define a shim. */
+/* PS4 doesn't have setenv/getenv. Define a shim. */
 #if __ORBIS__
 static inline char *getenv(const char *name) { return NULL; }
+static inline int setenv(const char *name, const char *value, int overwrite)
+{ return 0; }
 #endif /* #if __ORBIS__ */
 
 /* GCOV_PREFIX and GCOV_PREFIX_STRIP support */


        


More information about the llvm-commits mailing list