From 0875794a962c041bde76423e980875a467bb0bbe Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 28 Mar 2011 20:21:04 +0000 Subject: gdb/ GDB internal type support for STT_GNU_IFUNC. * elfread.c (record_minimal_symbol): Support mst_text_gnu_ifunc. (elf_symtab_read): Set mst_text_gnu_ifunc for BSF_GNU_INDIRECT_FUNCTION. * eval.c (evaluate_subexp_standard): Support TYPE_GNU_IFUNC. * gdbtypes.c (init_type): Support TYPE_FLAG_GNU_IFUNC, builtin_func_func, nodebug_text_gnu_ifunc_symbol and nodebug_got_plt_symbol. * gdbtypes.h (enum type_flag_value): New entry TYPE_FLAG_GNU_IFUNC. (TYPE_GNU_IFUNC): New. (struct main_type): New field flag_gnu_ifunc. (struct builtin_type): New field builtin_func_func. (struct objfile_type): New fields nodebug_text_gnu_ifunc_symbol and nodebug_got_plt_symbol. * minsyms.c (lookup_minimal_symbol_text): Support mst_text_gnu_ifunc. (in_gnu_ifunc_stub): New. (prim_record_minimal_symbol, find_solib_trampoline_target): Support mst_text_gnu_ifunc. * parse.c (write_exp_msymbol): New variable ifunc_msym. Detect and support mst_text_gnu_ifunc. Support mst_slot_got_plt. * solib-svr4.c (svr4_in_dynsym_resolve_code): Return true also for in_gnu_ifunc_stub. * symmisc.c (dump_msymbols): Support mst_text_gnu_ifunc. * symtab.c (search_symbols): Likewise. * symtab.h (enum minimal_symbol_type): New fields mst_text_gnu_ifunc and mst_slot_got_plt. (in_gnu_ifunc_stub): New declaration. --- gdb/minsyms.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'gdb/minsyms.c') diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 4551b07..534a8b2 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -334,8 +334,9 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf) msymbol = msymbol->hash_next) { if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0 && - (MSYMBOL_TYPE (msymbol) == mst_text || - MSYMBOL_TYPE (msymbol) == mst_file_text)) + (MSYMBOL_TYPE (msymbol) == mst_text + || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc + || MSYMBOL_TYPE (msymbol) == mst_file_text)) { switch (MSYMBOL_TYPE (msymbol)) { @@ -697,6 +698,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR pc) return lookup_minimal_symbol_by_pc_section (pc, NULL); } +/* Return non-zero iff PC is in an STT_GNU_IFUNC function resolver. */ + +int +in_gnu_ifunc_stub (CORE_ADDR pc) +{ + struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc); + + return msymbol && MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc; +} + /* Find the minimal symbol named NAME, and return both the minsym struct and its objfile. This only checks the linkage name. Sets *OBJFILE_P and returns the minimal symbol, if it is found. If it @@ -766,6 +777,7 @@ prim_record_minimal_symbol (const char *name, CORE_ADDR address, switch (ms_type) { case mst_text: + case mst_text_gnu_ifunc: case mst_file_text: case mst_solib_trampoline: section = SECT_OFF_TEXT (objfile); @@ -1231,7 +1243,8 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) { ALL_MSYMBOLS (objfile, msymbol) { - if (MSYMBOL_TYPE (msymbol) == mst_text + if ((MSYMBOL_TYPE (msymbol) == mst_text + || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc) && strcmp (SYMBOL_LINKAGE_NAME (msymbol), SYMBOL_LINKAGE_NAME (tsymbol)) == 0) return SYMBOL_VALUE_ADDRESS (msymbol); -- cgit v1.1