[llvm] r176173 - In GCC 4.7, function names are now forbidden from .gcda files. Support this by

Alexey Samsonov samsonov at google.com
Wed Feb 27 00:09:42 PST 2013


Hi!

I see the following error on our Windows buildbot, can it be caused by your
change?

3> GCDAProfiling.c 3>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(172):
error C2275: 'uint32_t' : illegal use of this type as an expression 3>
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(23)
: see declaration of 'uint32_t'
3>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(172): error C2146:
syntax error : missing ';' before identifier 'len'
3>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(172): error C2065: 'len'
: undeclared identifier
3>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(174): error C2065: 'len'
: undeclared identifier
3>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(175): error C2065: 'len'
: undeclared identifier 4> GCDAProfiling.c
4>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(172): error C2275:
'uint32_t' : illegal use of this type as an expression 4> C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(23) : see
declaration of 'uint32_t'
4>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(172): error C2146:
syntax error : missing ';' before identifier 'len'
4>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(172): error C2065: 'len'
: undeclared identifier
4>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(174): error C2065: 'len'
: undeclared identifier
4>..\..\..\llvm\runtime\libprofile\GCDAProfiling.c(175): error C2065: 'len'
: undeclared identifier


On Wed, Feb 27, 2013 at 10:22 AM, Nick Lewycky <nicholas at mxc.ca> wrote:

> Author: nicholas
> Date: Wed Feb 27 00:22:56 2013
> New Revision: 176173
>
> URL: http://llvm.org/viewvc/llvm-project?rev=176173&view=rev
> Log:
> In GCC 4.7, function names are now forbidden from .gcda files. Support
> this by
> passing a null pointer to the function name in to GCDAProfiling, and add
> another
> switch onto GCOVProfiling.
>
> Modified:
>     llvm/trunk/include/llvm/Transforms/Instrumentation.h
>     llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
>     llvm/trunk/runtime/libprofile/GCDAProfiling.c
>
> Modified: llvm/trunk/include/llvm/Transforms/Instrumentation.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation.h?rev=176173&r1=176172&r2=176173&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Transforms/Instrumentation.h (original)
> +++ llvm/trunk/include/llvm/Transforms/Instrumentation.h Wed Feb 27
> 00:22:56 2013
> @@ -34,7 +34,8 @@ ModulePass *createPathProfilerPass();
>  ModulePass *createGCOVProfilerPass(bool EmitNotes = true, bool EmitData =
> true,
>                                     bool Use402Format = false,
>                                     bool UseExtraChecksum = false,
> -                                   bool NoRedZone = false);
> +                                   bool NoRedZone = false,
> +                                   bool NoFunctionNamesInData = false);
>
>  // Insert AddressSanitizer (address sanity checking) instrumentation
>  FunctionPass *createAddressSanitizerFunctionPass(
>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=176173&r1=176172&r2=176173&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
> +++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Wed Feb 27
> 00:22:56 2013
> @@ -45,14 +45,16 @@ namespace {
>      static char ID;
>      GCOVProfiler()
>          : ModulePass(ID), EmitNotes(true), EmitData(true),
> Use402Format(false),
> -          UseExtraChecksum(false), NoRedZone(false) {
> +          UseExtraChecksum(false), NoRedZone(false),
> +          NoFunctionNamesInData(false) {
>        initializeGCOVProfilerPass(*PassRegistry::getPassRegistry());
>      }
> -    GCOVProfiler(bool EmitNotes, bool EmitData, bool use402Format,
> -                 bool useExtraChecksum, bool NoRedZone_)
> +    GCOVProfiler(bool EmitNotes, bool EmitData, bool Use402Format,
> +                 bool UseExtraChecksum, bool NoRedZone,
> +                 bool NoFunctionNamesInData)
>          : ModulePass(ID), EmitNotes(EmitNotes), EmitData(EmitData),
> -          Use402Format(use402Format), UseExtraChecksum(useExtraChecksum),
> -          NoRedZone(NoRedZone_) {
> +          Use402Format(Use402Format), UseExtraChecksum(UseExtraChecksum),
> +          NoRedZone(NoRedZone),
> NoFunctionNamesInData(NoFunctionNamesInData) {
>        assert((EmitNotes || EmitData) && "GCOVProfiler asked to do
> nothing?");
>        initializeGCOVProfilerPass(*PassRegistry::getPassRegistry());
>      }
> @@ -100,6 +102,7 @@ namespace {
>      bool Use402Format;
>      bool UseExtraChecksum;
>      bool NoRedZone;
> +    bool NoFunctionNamesInData;
>
>      Module *M;
>      LLVMContext *Ctx;
> @@ -113,9 +116,10 @@ INITIALIZE_PASS(GCOVProfiler, "insert-gc
>  ModulePass *llvm::createGCOVProfilerPass(bool EmitNotes, bool EmitData,
>                                           bool Use402Format,
>                                           bool UseExtraChecksum,
> -                                         bool NoRedZone) {
> +                                         bool NoRedZone,
> +                                         bool NoFunctionNamesInData) {
>    return new GCOVProfiler(EmitNotes, EmitData, Use402Format,
> UseExtraChecksum,
> -                          NoRedZone);
> +                          NoRedZone, NoFunctionNamesInData);
>  }
>
>  namespace {
> @@ -664,7 +668,9 @@ void GCOVProfiler::insertCounterWriteout
>          intptr_t ident = reinterpret_cast<intptr_t>(I->second);
>          Builder.CreateCall2(EmitFunction,
>                              Builder.getInt32(ident),
> -                            Builder.CreateGlobalStringPtr(SP.getName()));
> +                            NoFunctionNamesInData ?
> +
>  Constant::getNullValue(Builder.getInt8PtrTy()) :
> +
>  Builder.CreateGlobalStringPtr(SP.getName()));
>
>          GlobalVariable *GV = I->first;
>          unsigned Arcs =
>
> Modified: llvm/trunk/runtime/libprofile/GCDAProfiling.c
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/GCDAProfiling.c?rev=176173&r1=176172&r2=176173&view=diff
>
> ==============================================================================
> --- llvm/trunk/runtime/libprofile/GCDAProfiling.c (original)
> +++ llvm/trunk/runtime/libprofile/GCDAProfiling.c Wed Feb 27 00:22:56 2013
> @@ -162,17 +162,22 @@ void llvm_gcda_increment_indirect_counte
>
>  void llvm_gcda_emit_function(uint32_t ident, const char *function_name) {
>  #ifdef DEBUG_GCDAPROFILING
> -  printf("llvmgcda: function id=%x\n", ident);
> +  printf("llvmgcda: function id=%x name=%s\n", ident,
> +         function_name ? function_name : "NULL");
>  #endif
>    if (!output_file) return;
>
>    /* function tag */
>    fwrite("\0\0\0\1", 4, 1, output_file);
> -  write_int32(3 + 1 + length_of_string(function_name));
> +  uint32_t len = 3;
> +  if (function_name)
> +    len += 1 + length_of_string(function_name);
> +  write_int32(len);
>    write_int32(ident);
>    write_int32(0);
>    write_int32(0);
> -  write_string(function_name);
> +  if (function_name)
> +    write_string(function_name);
>  }
>
>  void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130227/585a71da/attachment.html>


More information about the llvm-commits mailing list