On Aug 5, 2016, Jason Merrill <ja...@redhat.com> wrote: >> With this patch, when we can't emit a DW_AT_const_value, we emit each >> "member" of the pointer to member function "record" as a >> DW_OP_stack_value DW_OP_piece, as long as the referenced member >> function is output in the same translation unit, otherwise we'd get >> relocations to external symbols, something to avoid in debug sections.
> I wonder if it would make sense to use weak references... I found the chunk of code that caused us to drop references to symbols not defined in the current translation unit. The comments at the end of const_ok_for_output_1 don't sound not exactly hopeful: /* Avoid references to external symbols in debug info, on several targets the linker might even refuse to link when linking a shared library, and in many other cases the relocations for .debug_info/.debug_loc are dropped, so the address becomes zero anyway. Hidden symbols, guaranteed to be defined within the same shared library or executable are fine. */ Anyway, this change is something that could certainly be addressed as a separate patch, since it would have effects over a lot more than just pointers to member functions. -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer