https://sourceware.org/bugzilla/show_bug.cgi?id=19842
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amodra at gmail dot com --- Comment #18 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Cary Coutant from comment #17) > > For ld, non-LTO definition takes precedence over LTO one. > > What symbol resolution does ld tell the compiler for the LTO > definition? The LTO design was intended to preserve the same binding > order that would have been observed in a non-LTO build (to the extent > possible). Try your example without -flto at all. > > If ld tells the compiler that the LTO definition is PREVAILING_DEF, it > will provide a new definition, but not in a COMDAT group. But that > definition won't be WEAK, so the order wouldn't matter and it should > still bind to the LTO definition. That suggests to me that ld is > telling it that the LTO definition is PREEMPTED_REG. But that doesn't > preserve the expected binding order. commit 3a5dbfb2502e7a49422f13c9cec2becfd46f44f1 Author: Alan Modra <amo...@gmail.com> Date: Tue Jun 21 14:55:26 2011 +0000 * elflink.c (_bfd_elf_merge_symbol): Allow type changes for plugin symbols. Fix segfault on linker scrip defined syms. has /* Skip weak definitions of symbols that are already defined. */ if (newdef && olddef && newweak) { /* Don't skip new non-IR weak syms. */ if (!(oldbfd != NULL && (oldbfd->flags & BFD_PLUGIN) != 0 && (abfd->flags & BFD_PLUGIN) == 0)) { newdef = FALSE; *skip = TRUE; } which prefers regular definition over definition in IR. > (Does ld *ever* say an LTO symbol is PREVAILING_DEF?) Yes. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils