[patch+7.12.1 1/2] Code cleanup: write_exp_msymbol: +is_tls

Jan Kratochvil jan.kratochvil@redhat.com
Sun Oct 9 18:56:00 GMT 2016


Hi,

no functionality change, for patch 2/2.


Jan
-------------- next part --------------
gdb/ChangeLog
2016-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* parse.c (write_exp_msymbol): New variable is_tls, use it.

--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -484,11 +484,13 @@ write_exp_msymbol (struct parser_state *ps,
   struct obj_section *section = MSYMBOL_OBJ_SECTION (objfile, msymbol);
   enum minimal_symbol_type type = MSYMBOL_TYPE (msymbol);
   CORE_ADDR pc;
+  const int is_tls = (section != NULL
+		      && section->the_bfd_section->flags & SEC_THREAD_LOCAL);
 
   /* The minimal symbol might point to a function descriptor;
      resolve it to the actual code address instead.  */
   pc = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, &current_target);
-  if (pc != addr)
+  if (!is_tls && pc != addr)
     {
       struct bound_minimal_symbol ifunc_msym = lookup_minimal_symbol_by_pc (pc);
 
@@ -520,7 +522,7 @@ write_exp_msymbol (struct parser_state *ps,
   write_exp_elt_longcst (ps, (LONGEST) addr);
   write_exp_elt_opcode (ps, OP_LONG);
 
-  if (section && section->the_bfd_section->flags & SEC_THREAD_LOCAL)
+  if (is_tls)
     {
       write_exp_elt_opcode (ps, UNOP_MEMVAL_TLS);
       write_exp_elt_objfile (ps, objfile);


More information about the Gdb-patches mailing list