<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 7, 2018 at 11:35 AM, Mehdi AMINI <span dir="ltr"><<a href="mailto:joker.eph@gmail.com" target="_blank">joker.eph@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span class="gmail-">> <span style="font-size:12.8px">>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.</span><div><span style="font-size:12.8px"><br></span></div></span><div><span style="font-size:12.8px">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.</span></div><div><span style="font-size:12.8px">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.</span></div><div><br></div><div>Does it make sense?</div></div></blockquote><div><br></div><div>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. :)</div><div><br></div><div>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 + visibility=hidden?</div></div></div></div>