forked from OSchip/llvm-project
				
			[PGO] Improve prof library portability
Patch by: Johan Engelen Introduce LLVM_LIBRARY_WEAK macro. Define LLVM_LIBRARY_WEAK and LLVM_LIBRARY_VISIBIITY for MSVC llvm-svn: 255688
This commit is contained in:
		
							parent
							
								
									f85b008de8
								
							
						
					
					
						commit
						1fbae3b76a
					
				| 
						 | 
				
			
			@ -56,8 +56,8 @@ static int writeFileWithName(const char *OutputName) {
 | 
			
		|||
  return RetVal;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__((weak)) int __llvm_profile_OwnsFilename = 0;
 | 
			
		||||
__attribute__((weak)) const char *__llvm_profile_CurrentFilename = NULL;
 | 
			
		||||
LLVM_LIBRARY_WEAK int __llvm_profile_OwnsFilename = 0;
 | 
			
		||||
LLVM_LIBRARY_WEAK const char *__llvm_profile_CurrentFilename = NULL;
 | 
			
		||||
 | 
			
		||||
static void truncateCurrentFile(void) {
 | 
			
		||||
  const char *Filename;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,11 +12,14 @@
 | 
			
		|||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#define LLVM_ALIGNAS(x) __declspec(align(x))
 | 
			
		||||
#define LLVM_LIBRARY_VISIBILITY
 | 
			
		||||
#define LLVM_LIBRARY_WEAK __declspec(selectany)
 | 
			
		||||
#elif __GNUC__
 | 
			
		||||
#define LLVM_ALIGNAS(x) __attribute__((aligned(x)))
 | 
			
		||||
#define LLVM_LIBRARY_VISIBILITY __attribute__((visibility("hidden")))
 | 
			
		||||
#define LLVM_LIBRARY_WEAK __attribute__((weak))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define LLVM_LIBRARY_VISIBILITY __attribute__((visibility("hidden")))
 | 
			
		||||
#define LLVM_SECTION(Sect) __attribute__((section(Sect)))
 | 
			
		||||
 | 
			
		||||
#define PROF_ERR(Format, ...)                                                  \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,8 +11,7 @@ extern "C" {
 | 
			
		|||
 | 
			
		||||
#include "InstrProfiling.h"
 | 
			
		||||
 | 
			
		||||
__attribute__((visibility("hidden"))) int __llvm_profile_runtime;
 | 
			
		||||
 | 
			
		||||
LLVM_LIBRARY_VISIBILITY int __llvm_profile_runtime;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue