ABataev added a comment.

Additional note. Seems to me, it has something to do with the partial linking. 
According to ld documentation, it is recommended to use `-Ur` option for 
partial linking of the C++ object files to resolve global constructors.

  -Ur
  For anything other than C++ programs, this option is equivalent to '-r': it 
generates relocatable output--i.e., an output file that can in turn serve as 
input to ld. When linking C++ programs, `-Ur' does resolve references to 
constructors, unlike '-r'. It does not work to use '-Ur' on files that were 
themselves linked with `-Ur'; once the constructor table has been built, it 
cannot be added to. Use `-Ur' only for the last partial link, and '-r' for the 
others.

The problem I saw is exactly connected with the global constructors, which are 
not called after partial linking.
Seems to me, we partially link objects files for C++ with `-Ur` option but we 
cannot say if this the last time we perform partial linking or not (we may try 
to bundle/unbundle objects several times, especially when we'll try to support 
linking with libraries). Better not to use partial linking in bundler.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65819/new/

https://reviews.llvm.org/D65819



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to