emulated-tls + LTO

The gold plugin supports many of the backend options. But Clang doesn’t pass all of them to the plugin as it does to the backend.

For example, to support -emulated-tls with LTO, Clang needs to pass -emulated-tls to the LTO backend. Shall I just change the driver to add -plugin-opt=-emulated-tls or is the best practice to embed this in the IR?

I think that particular option would need to be embedded in the IR. In general, if an option is normally passed only at compile time, it would need to have some representation in the IR.

Peter

-emulated-tls is particularly interesting for LTO because it is
automatically set by the fronted during compilation for Android and
OpenBSD (see clang lib/Driver/ToolChains/Clang.cpp). At the very
least, perhaps this can be set in tools::AddGoldPlugin as well to keep
the same default behavior under LTO?

- stephen