diff options
| author | Xinliang David Li <davidxl@google.com> | 2015-12-07 21:18:16 +0000 |
|---|---|---|
| committer | Xinliang David Li <davidxl@google.com> | 2015-12-07 21:18:16 +0000 |
| commit | 55d927a4fd31ba5334b8a752c47543abc7e73a6d (patch) | |
| tree | 2738e0857d6adc26953d49a1b174ad4ed102c9b9 /compiler-rt/lib/profile/InstrProfiling.c | |
| parent | a1c712fae5bc6f2b65562a0c3d79f6dd4570c2bc (diff) | |
| download | bcm5719-llvm-55d927a4fd31ba5334b8a752c47543abc7e73a6d.tar.gz bcm5719-llvm-55d927a4fd31ba5334b8a752c47543abc7e73a6d.zip | |
[PGO] Stop leaking libc function to buffer API impl
llvm-svn: 254943
Diffstat (limited to 'compiler-rt/lib/profile/InstrProfiling.c')
| -rw-r--r-- | compiler-rt/lib/profile/InstrProfiling.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler-rt/lib/profile/InstrProfiling.c b/compiler-rt/lib/profile/InstrProfiling.c index d864d1bf41f..0ba504aed65 100644 --- a/compiler-rt/lib/profile/InstrProfiling.c +++ b/compiler-rt/lib/profile/InstrProfiling.c @@ -39,6 +39,8 @@ uint32_t BoolCmpXchg(void **Ptr, void *OldV, void *NewV) { __sync_bool_compare_and_swap(Ptr, OldV, NewV) #endif +char *(*GetEnvHook)(const char *) = 0; + LLVM_LIBRARY_VISIBILITY uint64_t __llvm_profile_get_magic(void) { return sizeof(void *) == sizeof(uint64_t) ? (INSTR_PROF_RAW_MAGIC_64) : (INSTR_PROF_RAW_MAGIC_32); @@ -203,7 +205,8 @@ __llvm_profile_instrument_target(uint64_t TargetValue, void *Data, data buffer. The size of the extra space is controlled by an environment varaible. */ static unsigned getVprofExtraBytes() { - const char *ExtraStr = getenv("LLVM_VALUE_PROF_BUFFER_EXTRA"); + const char *ExtraStr = + GetEnvHook ? GetEnvHook("LLVM_VALUE_PROF_BUFFER_EXTRA") : 0; if (!ExtraStr || !ExtraStr[0]) return 1024; return (unsigned)atoi(ExtraStr); |

