[llvm-dev] ThinLTO and linkonce_odr + unnamed_addr

Rafael Avila de Espindola via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 9 11:46:45 PST 2018


Reid Kleckner <rnk at google.com> writes:

> 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.

That is not correct. With -fvisibility-inlines-hidden the symbol is
always hidden and code doing comparison breaks.

With local_unnamed_addr if *all* compilation units don't have pointer
comparisons, the result is hidden. If any has a comparison the symbol is
kept and the comparison still works,

Cheers,
Rafael


More information about the llvm-dev mailing list