Bug 23749 - Symbol resolves to ifunc resolver for local functions
Summary: Symbol resolves to ifunc resolver for local functions
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-08 20:07 UTC by Keith Seitz
Modified: 2018-10-10 19:38 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Seitz 2018-10-08 20:07:54 UTC
GDB is currently not doing ifunc resolving properly for static functions.

This can be demonstrated with the C++ compile test suite (gdb.compile/compile-cplus*.exp), in which a lot of tests are failing because the address of memcpy being passed to the compiler plug-in is actually the ifunc resolver function.

This happens because the (minimal) symbol for memcpy is not marked as an ifunc:

[from elread.c:elf_symtab_read]

          else if (sym->section->flags & SEC_CODE)
            {
              if (sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE))
                {
                  if (sym->flags & BSF_GNU_INDIRECT_FUNCTION)
                    ms_type = mst_text_gnu_ifunc;
                  else
                    ms_type = mst_text;
                }

The resolver function has flags BSF_LOCAL|BSF_GNU_INDIRECT_FUNCTION. Consequently, it is never noted as an indirect function, and GDB never attempts to find the "real" symbol.

It may be necessary to add mst_file_text_gnu_ifunc minsym type.