Anonymous user
Calling Global Constructors: Difference between revisions
→Clang: add my observations for dealing with clang
[unchecked revision] | [unchecked revision] |
No edit summary |
(→Clang: add my observations for dealing with clang) |
||
Line 281:
== Clang ==
'''Note:''' Since Clang attemps to be largely compatible with GCC, the information listed there can possibly be adapted easily. If you give it a try, please document the findings here.
From what I can tell, clang doesn't require you to specify the correct crt{begin,end}.o in the objects you pass to your linker, provided you pass crt[in].o in correct place. clang, being able to output to many targets, doesn't always have a usable crt{begin,end}.o at hand, which it seems to somehow compile on demand. Calling _init doesn't seem to be a requirement, too. An additional call to _init doesn't execute it twice, so it's still safe to call manually.
In summary, in order to adapt this from GCC to clang, take out crt{begin,end}.o from your linker line and you should be fine.
== Other Compilers / Platforms ==
|