r235537 - Set normal LLVM function attributes on global initializer functions

Filipe Cabecinhas filcab at gmail.com
Mon May 4 12:22:56 PDT 2015


ASAN_OPTIONS="file='%t.supp'" should work.
I changed a bunch of tests to do this, but IIRC, there might some later
tests that I haven't changed/committed.

Check out http://reviews.llvm.org/D6680 (r224529 in compiler-rt).

  Filipe

On Wed, Apr 22, 2015 at 3:30 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:

>
> On Wed, Apr 22, 2015 at 2:44 PM, Reid Kleckner <rnk at google.com> wrote:
>
>> This ended up breaking some sanitizer attribute tests that aren't run on
>> Windows because the blacklist file syntax treats colons specially, and they
>> are part of Windows paths. I fixed the tests on Linux, but can someone come
>> up with a fix to the blacklist file syntax to make these tests work?
>>
>
> I believe it's not the colon, but backslashes in windows paths (special
> case list entries are assumed to be regular expressions). Hrm.
>
>
>>
>> On Wed, Apr 22, 2015 at 12:37 PM, Reid Kleckner <reid at kleckner.net>
>> wrote:
>>
>>> Author: rnk
>>> Date: Wed Apr 22 14:37:32 2015
>>> New Revision: 235537
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=235537&view=rev
>>> Log:
>>> Set normal LLVM function attributes on global initializer functions
>>>
>>> Otherwise -fno-omit-frame-pointer and other flags like it aren't
>>> applied.
>>>
>>> Basic idea taken from Gao's patch, thanks!
>>>
>>> Differential Revision: http://reviews.llvm.org/D9203
>>>
>>> Modified:
>>>     cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
>>>     cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp
>>>     cfe/trunk/test/CodeGenCXX/global-init.cpp
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=235537&r1=235536&r2=235537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Wed Apr 22 14:37:32 2015
>>> @@ -259,6 +259,8 @@ llvm::Function *CodeGenModule::CreateGlo
>>>        Fn->setSection(Section);
>>>    }
>>>
>>> +  SetLLVMFunctionAttributes(nullptr,
>>> getTypes().arrangeNullaryFunction(), Fn);
>>> +
>>>    Fn->setCallingConv(getRuntimeCC());
>>>
>>>    if (!getLangOpts().Exceptions)
>>>
>>> Modified: cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp?rev=235537&r1=235536&r2=235537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp (original)
>>> +++ cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp Wed Apr 22
>>> 14:37:32 2015
>>> @@ -43,4 +43,4 @@ void func() {
>>>    static A a1, a2;
>>>  }
>>>
>>> -// CHECK: attributes [[NUW]] = { nounwind }
>>> +// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
>>>
>>> Modified: cfe/trunk/test/CodeGenCXX/global-init.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-init.cpp?rev=235537&r1=235536&r2=235537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/test/CodeGenCXX/global-init.cpp (original)
>>> +++ cfe/trunk/test/CodeGenCXX/global-init.cpp Wed Apr 22 14:37:32 2015
>>> @@ -1,5 +1,8 @@
>>>  // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm
>>> -fexceptions %s -o - |FileCheck %s
>>>  // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o -
>>> |FileCheck -check-prefix CHECK-NOEXC %s
>>> +// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm \
>>> +// RUN:     -momit-leaf-frame-pointer -mdisable-fp-elim %s -o - \
>>> +// RUN:   | FileCheck -check-prefix CHECK-FP %s
>>>
>>>  struct A {
>>>    A();
>>> @@ -195,11 +198,15 @@ namespace test7 {
>>>  // CHECK-NEXT:   sub
>>>  // CHECK-NEXT:   store i32 {{.*}}, i32* @_ZN5test1L1yE
>>>
>>> -// CHECK: define internal void @_GLOBAL__sub_I_global_init.cpp()
>>> section "__TEXT,__StaticInit,regular,pure_instructions" {
>>> +// CHECK: define internal void @_GLOBAL__sub_I_global_init.cpp()
>>> #{{[0-9]+}} section "__TEXT,__StaticInit,regular,pure_instructions" {
>>>  // CHECK:   call void [[TEST1_Y_INIT]]
>>>  // CHECK:   call void [[TEST1_Z_INIT]]
>>>
>>>  // rdar://problem/8090834: this should be nounwind
>>>  // CHECK-NOEXC: define internal void @_GLOBAL__sub_I_global_init.cpp()
>>> [[NUW:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {
>>>
>>> -// CHECK-NOEXC: attributes [[NUW]] = { nounwind }
>>> +// CHECK-NOEXC: attributes [[NUW]] = { nounwind{{.*}} }
>>> +
>>> +// PR21811: attach the appropriate attribute to the global init function
>>> +// CHECK-FP: define internal void @_GLOBAL__sub_I_global_init.cpp()
>>> [[NUX:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {
>>> +// CHECK-FP: attributes [[NUX]] = { nounwind
>>> {{.*}}"no-frame-pointer-elim-non-leaf"{{.*}} }
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>
>>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150504/386e4fce/attachment.html>


More information about the cfe-commits mailing list