[cfe-dev] Clang equivalent to __attribute__(init_priority)?

Jeffrey Walton noloader at gmail.com
Tue Sep 3 23:04:29 PDT 2013


On Tue, Sep 3, 2013 at 11:02 PM, Eric Christopher <echristo at gmail.com> wrote:
> On darwin you can only depend upon constructor priority order within
> an individual module, not across modules. I'm not sure if that's
> what's going on in your case, but it's been the cause before.
Thanks Eric.

Damn, I missed that when I read
http://gcc.gnu.org/ml/gcc-help/2011-05/msg00221.html.

Jeff

> On Tue, Sep 3, 2013 at 6:42 PM, Jeffrey Walton <noloader at gmail.com> wrote:
>> I'm catching a crash due to a library's use of a global string. The
>> library provides it, and I [indirectly] consume it. I understand why
>> the crash happens and that's not a problem.
>>
>> What's giving me trouble is __attribute__(init_priority) [1]. It does
>> not appear to be honored, and I'm not getting a warning about it (or a
>> failed compile like __attribute__(aligned)).
>>
>> Is there anyway to force the construction of an object in Clang similar to GCC?
>>
>> Thanks,
>>
>> Jeff
>>
>> [1] http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html
>>
>> $ clang++ -v
>> Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
>> Target: x86_64-apple-darwin12.4.0
>> Thread model: posix
>>
>> $ echo | clang++ -dM -E - | grep GNU
>> #define __GNUC_MINOR__ 2
>> #define __GNUC_PATCHLEVEL__ 1
>> #define __GNUC_STDC_INLINE__ 1
>> #define __GNUC__ 4



More information about the cfe-dev mailing list