This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/14080] New: extern "C" {} fuctions treated as C++ in dwarf2 section


Version: gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Source:
extern "C" {
    void first_function() {}
}
void second_function(){};

nm result:
00000000 T first_function
00000006 T _Z15second_functionv

dwarf section (readelf -w):
Compilation Unit @ 0:
   Length:        87
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 0
     DW_AT_high_pc     : 0xb 11
     DW_AT_low_pc      : 0 0
     DW_AT_name        : (indirect string, offset: 0x7e): main.cc
     DW_AT_comp_dir    : (indirect string, offset: 0x3c): /.
automount/novo116/root/export/home/fmike/work/tests/linuxextern
     DW_AT_producer    : (indirect string, offset: 0x9b): GNU C++ 3.2.2 20030222 
(Red Hat Linux 3.2.2-5)
     DW_AT_language    : 4      (C++)
 <1><25>: Abbrev Number: 2 (DW_TAG_subprogram)
     DW_AT_external    : 1
     DW_AT_name        : (indirect string, offset: 0x0): first_function
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 2
     DW_AT_low_pc      : 0 0
     DW_AT_high_pc     : 0x5 5
     DW_AT_frame_base  : 1 byte block: 55       (DW_OP_reg5; )
 <1><37>: Abbrev Number: 3 (DW_TAG_subprogram)
     DW_AT_external    : 1
     DW_AT_name        : (indirect string, offset: 0xf): second_function
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 4
     DW_AT_MIPS_linkage_name: (indirect string, offset: 0x86): 
_Z15second_functionv
     DW_AT_low_pc      : 0x6 6
     DW_AT_high_pc     : 0xb 11
     DW_AT_frame_base  : 1 byte block: 55       (DW_OP_reg5; )
 <1><4d>: Abbrev Number: 4 (DW_TAG_structure_type)
     DW_AT_name        : (indirect string, offset: 0x24): 
__fundamental_type_info
     DW_AT_declaration : 1
 <1><53>: Abbrev Number: 5 (DW_TAG_base_type)
     DW_AT_name        : (indirect string, offset: 0x1f): bool
     DW_AT_byte_size   : 1
     DW_AT_encoding    : 2      (boolean)

--------------

DW_AT_language is C++ for both functions and the only way to separate them is to 
check DW_AT_MIPS_linkage_name.
Is it a bug or a feature :) ?? Could I rely on DW_AT_MIPS_linkage_name absence 
to detect if fuction is extern if DW_AT_language is C++?

-- 
           Summary: extern "C" {} fuctions treated as C++ in dwarf2 section
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fmike at mail dot ru
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14080


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]