[compiler-rt] r284440 - [profile] Mark lprofCurFilename as COMPILER_RT_WEAK

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 17:02:28 PDT 2016


Author: vedantk
Date: Mon Oct 17 19:02:28 2016
New Revision: 284440

URL: http://llvm.org/viewvc/llvm-project?rev=284440&view=rev
Log:
[profile] Mark lprofCurFilename as COMPILER_RT_WEAK

This makes __llvm_profile_set_filename() work across dylib boundaries on
Darwin.

This functionality was originally meant to work on all platforms, but
was moved to a Linux-only directory with r272404. The root cause of the
test failure on Darwin was that lprofCurFilename was not marked weak.
Each dylib maintained its own copy of the variable due to the two-level
namespace.

Tested with check-profile (on Darwin). I don't expect this to regress
other platforms.

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

Added:
    compiler-rt/trunk/test/profile/instrprof-set-filename-shared.test
      - copied, changed from r284258, compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test
Removed:
    compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test
Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingFile.c

Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=284440&r1=284439&r2=284440&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Mon Oct 17 19:02:28 2016
@@ -82,7 +82,8 @@ typedef struct lprofFilename {
   ProfileNameSpecifier PNS;
 } lprofFilename;
 
-lprofFilename lprofCurFilename = {0, 0, 0, {0}, {0}, 0, 0, 0, PNS_unknown};
+COMPILER_RT_WEAK lprofFilename lprofCurFilename = {0, 0, 0, {0}, {0},
+                                                   0, 0, 0, PNS_unknown};
 
 int getpid(void);
 static int getCurFilenameLength();

Removed: compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test?rev=284439&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test (original)
+++ compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test (removed)
@@ -1,8 +0,0 @@
-# Test that __llvm_profile_set_filename is honored by shared libary too.
-RUN: mkdir -p %t.d
-RUN: %clang_profgen=%t.shared.profraw -fPIC -shared -o %t.d/t.shared %S/../Inputs/instrprof-dlopen-func.c
-RUN: %clang_profgen -DCALL_SHARED -o %t.m -O3 -rpath %t.d %t.d/t.shared %S/../instrprof-set-filename.c 
-RUN: %run %t.m %t.main.profraw
-RUN: llvm-profdata show %t.main.profraw | FileCheck --check-prefix=SHARED %s
-
-# SHARED: Total functions: 2

Copied: compiler-rt/trunk/test/profile/instrprof-set-filename-shared.test (from r284258, compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-set-filename-shared.test?p2=compiler-rt/trunk/test/profile/instrprof-set-filename-shared.test&p1=compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test&r1=284258&r2=284440&rev=284440&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/Linux/instrprof-set-filename-shared.test (original)
+++ compiler-rt/trunk/test/profile/instrprof-set-filename-shared.test Mon Oct 17 19:02:28 2016
@@ -1,7 +1,7 @@
 # Test that __llvm_profile_set_filename is honored by shared libary too.
 RUN: mkdir -p %t.d
-RUN: %clang_profgen=%t.shared.profraw -fPIC -shared -o %t.d/t.shared %S/../Inputs/instrprof-dlopen-func.c
-RUN: %clang_profgen -DCALL_SHARED -o %t.m -O3 -rpath %t.d %t.d/t.shared %S/../instrprof-set-filename.c 
+RUN: %clang_profgen=%t.shared.profraw -fPIC -shared -o %t.d/t.shared %S/Inputs/instrprof-dlopen-func.c
+RUN: %clang_profgen -DCALL_SHARED -o %t.m -O3 -rpath %t.d %t.d/t.shared %S/instrprof-set-filename.c
 RUN: %run %t.m %t.main.profraw
 RUN: llvm-profdata show %t.main.profraw | FileCheck --check-prefix=SHARED %s
 




More information about the llvm-commits mailing list