[llvm-dev] ThinLTO and linkonce_odr + unnamed_addr

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 7 13:23:03 PST 2018

On Wed, Feb 7, 2018 at 11:35 AM, Mehdi AMINI <joker.eph at gmail.com> wrote:

> > From looking at the code, it seems like LLVM is basically opting MachO
> into -fvisibility-inlines-hidden all the time, i.e. if the function is
> linkonce, it's discardable, so mark it hidden to pretend the compiler
> inlined it and discarded it. However, this isn't conforming, because the
> addresses of inline functions will no longer compare equal across DSOs.
> I think there is a nuance, it is marking these as "auto-hide": it just
> means that the address is not taken in the current compilation unit IIRC.
> The linker decides that it can hide it in the DSO if none of the
> compilation unit is using the address based on this auto-hide flag.
> Does it make sense?

Yeah, I missed that. .weak_def_can_be_hidden is a MachO thing that I'm not
familiar with. It's nice that the format supports it. :)

Perhaps instead we should make ThinLTO responsible for doing the
auto-hiding, then? It could do the check of, are all declarations marked
local_unnamed_addr, if so, make it weak_odr + unnamed_addr +
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180207/3362dcd9/attachment.html>

More information about the llvm-dev mailing list