[cfe-users] thinlto and c++ static initialization analysis

2019-07-18 Thread Jerry Scharf via cfe-users
I am looking at trying out thinlto on our large c++ programs. We have 
had to do a bunch of careful things to make sure things get linked in 
the right order to get the static initialization to work right.


Two questions:

Will thinlto honor the command line ordering of files that we set?

In theory, with lto one could build the dependency graph of 
initializations and guarantee the correct ordering. Has anyone worked on 
this and are there any plans for this in the future?


thanks in advance,

jerry


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


Re: [cfe-users] thinlto and c++ static initialization analysis

2019-07-18 Thread Christian Gagneraud via cfe-users
On Thu, 18 Jul 2019 at 21:15, Jerry Scharf via cfe-users
 wrote:
>
> I am looking at trying out thinlto on our large c++ programs. We have
> had to do a bunch of careful things to make sure things get linked in
> the right order to get the static initialization to work right.
>
> Two questions:
>
> Will thinlto honor the command line ordering of files that we set?

You're relying on undefined behaviour. If thinlto honor the command
line ordering *today*, there's no guarantee that it will in the
future.
Best to fix the code instead of relying on compiler implementation.

You could use the "undefined" sanitizer to detect so called "static
initialisation 'fiasco' (problem)"
(https://isocpp.org/wiki/faq/ctors#static-init-order)

My 2 cents.
___
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users