Sorry this has taken so long. In future, please feel free to ping me as much as once a week, in email and/or IRC.

On 09/23/2016 08:41 PM, Alexandre Oliva wrote:
support aliases and trampolines in dwarf2

I know that "trampoline" is the term used in the DWARF standard, but in GCC it typically means specifically code for nested functions created at runtime, as in https://gcc.gnu.org/onlinedocs/gccint/Trampolines.html

So I'd prefer to use "thunk" as the generic term in this patch, as cgraph does.

+  /* C1 and C2 ctors may be trampolines to C4; D0, D1 and D2 dtors may
+     be trampolines to D4.  Check their mangled names, so that the
+     test will work even during LTO compilations, when the cdtor
+     clones retrofitted into trampolines might not be right after the
+     unified one in the DECL_CHAIN, and we don't have C++-specific
+     data structures or lang hooks to check that the cdtors are of
+     different kinds and belong to the same class.

This will be simpler with richi's LTO debug work, but that hasn't gone in yet. Until then, we probably want to emit what we can in early debug (i.e. from the front end rather than cgraph), and not worry too much about LTO.

This is more or less what richi was saying in https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01629.html .

-  return lang_hooks.dwarf_name (decl, scope ? 1 : 0);
+  const char *name = lang_hooks.dwarf_name (decl, scope ? 1 : 0);
+  if (name && name[0] == '*')
+    name++;

This is TARGET_STRIP_NAME_ENCODING. I'm also surprised that the dwarf_name langhook would return such an encoded name.

+  /* ??? It would be nice if we could just link back to the symbol
+     declaration, but DW_AT_specification is not a welcome attribute
+     for a DW_TAG_imported_declaration.  */
+  if (0 && old_alias_die)
+    {
+      add_AT_die_ref (alias_die, DW_AT_specification, old_alias_die);
+      return;
+    }

Strictly speaking, neither is DW_AT_external or DW_AT_artificial.

Where we're using an alias to define a function rather than give it its own separate definition, I'm not sure DW_AT_imported_declaration is the right representation; this is a distinct function, the alias is just an implementation detail.

libcc1 C++ support review to follow.

Jason

Reply via email to