[cfe-dev] Should a "typeinfo" variable be "linkonce_odr constant" or just "constant"

Kostya Serebryany kcc at google.com
Wed Aug 13 13:10:47 PDT 2014


Andres, anyone?


On Tue, Aug 5, 2014 at 10:20 AM, Reid Kleckner <rnk at google.com> wrote:

> Anders Carlsson added this logic to CGRTTI.cpp in r124096.  Currently it
> lives in ItaniumCXXABI.cpp.
>
> Anders, why is this necessary?
>
>
> On Tue, Aug 5, 2014 at 7:06 AM, Kostya Serebryany <kcc at google.com> wrote:
>
>> Hello Clang folks,
>>
>> I have a question about typeinfo variables:
>>
>> % cat a1.cc
>> struct AAA {
>>  public:
>>   virtual ~ AAA ();
>> };
>> AAA::~AAA() { }
>> void foo () { throw AAA (); }
>>
>> % clang++ a1.cc -S -o - -emit-llvm    | grep '_ZTI3AAA.=.[^{]*' -o
>> _ZTI3AAA = constant
>>
>> % clang++ a1.cc -S -o - -emit-llvm  -fno-rtti  | grep '_ZTI3AAA.=.[^{]*'
>> -o
>> _ZTI3AAA = linkonce_odr constant
>>
>> As you can see, depending on the compilation mode (-fno-rtti) the
>> definition of _ZTI3AAA
>> (typeinfo for AAA) is different.  Is that expected?
>>
>> This difference causes problem for AddressSanitizer, if one part of the
>> code is built with
>> -fno-rtti and another part w/o -fno-rtti.
>> asan instruments global constants but can not instrument linkonce_odr
>> variables,
>> as a result we mix an instrumented and a non-instrumented global in the
>> same binary.
>> https://code.google.com/p/address-sanitizer/issues/detail?id=327
>>
>> Thanks,
>>
>> --kcc
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140813/3e51ec95/attachment.html>


More information about the cfe-dev mailing list