commit 1c8822f0eba9797ca937fd899c960a1b355d0563
Author: Jason Merrill <jason@redhat.com>
Date: Mon Apr 23 16:29:36 2012 -0400
* config/i386/i386.c (ix86_code_end): Set DECL_IGNORED_P on the
pc thunk.
* dwarf2out.c (output_aranges): Skip DECL_IGNORED_P functions.
(dwarf2out_finish): Likewise.
@@ -8612,6 +8612,7 @@ ix86_code_end (void)
NULL_TREE, void_type_node);
TREE_PUBLIC (decl) = 1;
TREE_STATIC (decl) = 1;
+ DECL_IGNORED_P (decl) = 1;
#if TARGET_MACHO
if (TARGET_MACHO)
@@ -8085,6 +8085,8 @@ output_aranges (unsigned long aranges_length)
FOR_EACH_VEC_ELT (dw_fde_ref, fde_vec, fde_idx, fde)
{
+ if (DECL_IGNORED_P (fde->decl))
+ continue;
if (!fde->in_std_section)
{
dw2_asm_output_addr (DWARF2_ADDR_SIZE, fde->dw_fde_begin,
@@ -21895,6 +21897,8 @@ dwarf2out_finish (const char *filename)
FOR_EACH_VEC_ELT (dw_fde_ref, fde_vec, fde_idx, fde)
{
+ if (DECL_IGNORED_P (fde->decl))
+ continue;
if (!fde->in_std_section)
add_ranges_by_labels (comp_unit_die (), fde->dw_fde_begin,
fde->dw_fde_end, &range_list_added);
new file mode 100644
@@ -0,0 +1,11 @@
+// Test that we don't add the x86 PC thunk to .debug_ranges
+// { dg-do compile { target i?86-*-* } }
+// { dg-options "-g -fpic" }
+// { dg-final { scan-assembler-times "LFB3" 1 } }
+
+template <class T> void f(T t) { }
+
+int main()
+{
+ f(42);
+}