Hi Ian, I did you told, but I could not find --debug=all option for readelf. However, there is --debug --all option with readelf. I am attaching the output below:
-bash-3.2$ /opt/csw/bin/greadelf --debug --all /b001/_cgo_.o ELF Header: Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: Sparc Version: 0x1 Entry point address: 0x0 Start of program headers: 0 (bytes into file) Start of section headers: 2000 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 40 (bytes) Number of section headers: 20 Section header string table index: 17 Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 00000000 000034 000014 00 AX 0 0 4 [ 2] .rela.text RELA 00000000 000c4c 000024 0c 18 1 4 [ 3] .data PROGBITS 00000000 000048 000020 00 WA 0 0 8 [ 4] .bss NOBITS 00000000 000068 000000 00 WA 0 0 1 [ 5] .rodata.str1.8 PROGBITS 00000000 000068 000010 01 AMS 0 0 8 [ 6] .debug_frame PROGBITS 00000000 000078 000020 00 0 0 4 [ 7] .rela.debug_frame RELA 00000000 000c70 000018 0c 18 6 4 [ 8] .debug_info PROGBITS 00000000 000098 000290 00 0 0 1 [ 9] .rela.debug_info RELA 00000000 000c88 000240 0c 18 8 4 [10] .debug_abbrev PROGBITS 00000000 000328 00011d 00 0 0 1 [11] .debug_aranges PROGBITS 00000000 000445 000020 00 0 0 1 [12] .rela.debug_arang RELA 00000000 000ec8 000018 0c 18 11 4 [13] .debug_line PROGBITS 00000000 000465 000128 00 0 0 1 [14] .rela.debug_line RELA 00000000 000ee0 00000c 0c 18 13 4 [15] .debug_str PROGBITS 00000000 00058d 00017c 01 MS 0 0 1 [16] .comment PROGBITS 00000000 000709 00001b 01 MS 0 0 1 [17] .shstrtab STRTAB 00000000 000724 0000aa 00 0 0 1 [18] .symtab SYMTAB 00000000 000af0 000120 10 19 13 4 [19] .strtab STRTAB 00000000 000c10 000039 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) There are no section groups in this file. There are no program headers in this file. Relocation section '.rela.text' at offset 0xc4c contains 3 entries: Offset Info Type Sym.Value Sym. Name + Addend 00000000 00000509 R_SPARC_HI22 00000000 .rodata.str1.8 + 0 00000004 0000050c R_SPARC_LO10 00000000 .rodata.str1.8 + 0 0000000c 00000e07 R_SPARC_WDISP30 00000000 printf + 0 Relocation section '.rela.debug_frame' at offset 0xc70 contains 2 entries: Offset Info Type Sym.Value Sym. Name + Addend 00000014 00000617 R_SPARC_UA32 00000000 .debug_frame + 0 00000018 00000217 R_SPARC_UA32 00000000 .text + 0 Relocation section '.rela.debug_info' at offset 0xc88 contains 48 entries: Offset Info Type Sym.Value Sym. Name + Addend 00000006 00000817 R_SPARC_UA32 00000000 .debug_abbrev + 0 0000000c 00000b17 R_SPARC_UA32 00000000 .debug_str + 45 00000011 00000b17 R_SPARC_UA32 00000000 .debug_str + 10b 00000015 00000217 R_SPARC_UA32 00000000 .text + 0 00000019 00000217 R_SPARC_UA32 00000000 .text + 14 0000001d 00000a17 R_SPARC_UA32 00000000 .debug_line + 0 0000002b 00000b17 R_SPARC_UA32 00000000 .debug_str + e3 00000032 00000b17 R_SPARC_UA32 00000000 .debug_str + 13f 00000039 00000b17 R_SPARC_UA32 00000000 .debug_str + 121 00000040 00000b17 R_SPARC_UA32 00000000 .debug_str + 14d 00000047 00000b17 R_SPARC_UA32 00000000 .debug_str + 100 00000052 00000b17 R_SPARC_UA32 00000000 .debug_str + 1f 0000005e 00000b17 R_SPARC_UA32 00000000 .debug_str + 1f 0000006b 00000b17 R_SPARC_UA32 00000000 .debug_str + 148 0000007a 00000b17 R_SPARC_UA32 00000000 .debug_str + de 00000089 00000b17 R_SPARC_UA32 00000000 .debug_str + 162 00000098 00000b17 R_SPARC_UA32 00000000 .debug_str + 2c 000000a7 00000b17 R_SPARC_UA32 00000000 .debug_str + 105 000000b6 00000b17 R_SPARC_UA32 00000000 .debug_str + 88 000000c8 00000b17 R_SPARC_UA32 00000000 .debug_str + 96 000000da 00000b17 R_SPARC_UA32 00000000 .debug_str + bc 000000ec 00000b17 R_SPARC_UA32 00000000 .debug_str + 0 000000fe 00000b17 R_SPARC_UA32 00000000 .debug_str + 168 00000110 00000b17 R_SPARC_UA32 00000000 .debug_str + f7 0000012b 00000b17 R_SPARC_UA32 00000000 .debug_str + ae 00000130 00000b17 R_SPARC_UA32 00000000 .debug_str + 40 0000014c 00000b17 R_SPARC_UA32 00000000 .debug_str + 26 00000165 00000b17 R_SPARC_UA32 00000000 .debug_str + 175 00000173 00000b17 R_SPARC_UA32 00000000 .debug_str + 32 0000018c 00000b17 R_SPARC_UA32 00000000 .debug_str + 7d 0000019a 00000b17 R_SPARC_UA32 00000000 .debug_str + 159 000001ae 00000b17 R_SPARC_UA32 00000000 .debug_str + f0 000001bd 00000b17 R_SPARC_UA32 00000000 .debug_str + a7 000001cc 00000b17 R_SPARC_UA32 00000000 .debug_str + 39 000001db 00000b17 R_SPARC_UA32 00000000 .debug_str + 76 000001f1 00000b17 R_SPARC_UA32 00000000 .debug_str + 136 000001ff 00001117 R_SPARC_UA32 00000004 __cgo__0 + 0 0000021a 00000b17 R_SPARC_UA32 00000000 .debug_str + ce 00000228 00001017 R_SPARC_UA32 00000010 __cgodebug_ints + 0 0000023f 00000b17 R_SPARC_UA32 00000000 .debug_str + c7 00000244 00000b17 R_SPARC_UA32 00000000 .debug_str + d 00000252 00000f17 R_SPARC_UA32 00000000 __cgodebug_floats + 0 00000258 00000b17 R_SPARC_UA32 00000000 .debug_str + a1 0000025f 00000217 R_SPARC_UA32 00000000 .text + 0 00000263 00000217 R_SPARC_UA32 00000000 .text + 14 00000270 00000217 R_SPARC_UA32 00000000 .text + 14 00000284 00000b17 R_SPARC_UA32 00000000 .debug_str + 12f 00000288 00000b17 R_SPARC_UA32 00000000 .debug_str + 12f Relocation section '.rela.debug_aranges' at offset 0xec8 contains 2 entries: Offset Info Type Sym.Value Sym. Name + Addend 00000006 00000717 R_SPARC_UA32 00000000 .debug_info + 0 00000010 00000217 R_SPARC_UA32 00000000 .text + 0 Relocation section '.rela.debug_line' at offset 0xee0 contains 1 entries: Offset Info Type Sym.Value Sym. Name + Addend 0000011b 00000217 R_SPARC_UA32 00000000 .text + 0 The decoding of unwind sections for machine type Sparc is not currently supported. Symbol table '.symtab' contains 18 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 FILE LOCAL DEFAULT ABS 2: 00000000 0 SECTION LOCAL DEFAULT 1 3: 00000000 0 SECTION LOCAL DEFAULT 3 4: 00000000 0 SECTION LOCAL DEFAULT 4 5: 00000000 0 SECTION LOCAL DEFAULT 5 6: 00000000 0 SECTION LOCAL DEFAULT 6 7: 00000000 0 SECTION LOCAL DEFAULT 8 8: 00000000 0 SECTION LOCAL DEFAULT 10 9: 00000000 0 SECTION LOCAL DEFAULT 11 10: 00000000 0 SECTION LOCAL DEFAULT 13 11: 00000000 0 SECTION LOCAL DEFAULT 15 12: 00000000 0 SECTION LOCAL DEFAULT 16 13: 00000000 20 FUNC GLOBAL DEFAULT 1 testc 14: 00000000 0 NOTYPE GLOBAL DEFAULT UND printf 15: 00000000 16 OBJECT GLOBAL DEFAULT 3 __cgodebug_floats 16: 00000010 16 OBJECT GLOBAL DEFAULT 3 __cgodebug_ints 17: 00000004 4 OBJECT GLOBAL DEFAULT COM __cgo__0 No version information found in this file. Contents of the .debug_frame section: 00000000 0000000c ffffffff CIE Version: 1 Augmentation: "" Code alignment factor: 1 Data alignment factor: -4 Return address column: 15 DW_CFA_def_cfa: r14 ofs 0 00000010 0000000c 00000000 FDE cie=00000000 pc=00000000..00000014 Contents of the .debug_info section: Compilation Unit @ offset 0x0: Length: 0x28c (32-bit) Version: 2 Abbrev Offset: 0x0 Pointer Size: 4 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit) <c> DW_AT_producer : (indirect string, offset: 0x45): GNU C17 8.2.1 20180814 -mcpu=v9 -gdwarf-2 -g -O2 <10> DW_AT_language : 12 (ANSI C99) <11> DW_AT_comp_dir : (indirect string, offset: 0x10b): /export/home/amandeep <15> DW_AT_low_pc : 0x0 <19> DW_AT_high_pc : 0x14 <1d> DW_AT_stmt_list : 0x0 <1><21>: Abbrev Number: 2 (DW_TAG_base_type) <22> DW_AT_byte_size : 4 <23> DW_AT_encoding : 5 (signed) <24> DW_AT_name : int <1><28>: Abbrev Number: 3 (DW_TAG_base_type) <29> DW_AT_byte_size : 4 <2a> DW_AT_encoding : 7 (unsigned) <2b> DW_AT_name : (indirect string, offset: 0xe3): unsigned int <1><2f>: Abbrev Number: 3 (DW_TAG_base_type) <30> DW_AT_byte_size : 4 <31> DW_AT_encoding : 5 (signed) <32> DW_AT_name : (indirect string, offset: 0x13f): long int <1><36>: Abbrev Number: 3 (DW_TAG_base_type) <37> DW_AT_byte_size : 8 <38> DW_AT_encoding : 5 (signed) <39> DW_AT_name : (indirect string, offset: 0x121): long long int <1><3d>: Abbrev Number: 3 (DW_TAG_base_type) <3e> DW_AT_byte_size : 16 <3f> DW_AT_encoding : 4 (float) <40> DW_AT_name : (indirect string, offset: 0x14d): long double <1><44>: Abbrev Number: 3 (DW_TAG_base_type) <45> DW_AT_byte_size : 1 <46> DW_AT_encoding : 6 (signed char) <47> DW_AT_name : (indirect string, offset: 0x100): char <1><4b>: Abbrev Number: 4 (DW_TAG_pointer_type) <4c> DW_AT_byte_size : 4 <4d> DW_AT_type : <0x44> <1><51>: Abbrev Number: 5 (DW_TAG_typedef) <52> DW_AT_name : (indirect string, offset: 0x1f): __FILE <56> DW_AT_decl_file : 3 <57> DW_AT_decl_line : 21 <58> DW_AT_decl_column : 27 <59> DW_AT_type : <0x5d> <1><5d>: Abbrev Number: 6 (DW_TAG_structure_type) <5e> DW_AT_name : (indirect string, offset: 0x1f): __FILE <62> DW_AT_byte_size : 16 <63> DW_AT_decl_file : 2 <64> DW_AT_decl_line : 29 <65> DW_AT_decl_column : 8 <66> DW_AT_sibling : <0x122> <2><6a>: Abbrev Number: 7 (DW_TAG_member) <6b> DW_AT_name : (indirect string, offset: 0x148): _cnt <6f> DW_AT_decl_file : 2 <70> DW_AT_decl_line : 35 <71> DW_AT_decl_column : 7 <72> DW_AT_type : <0x21> <76> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0) <2><79>: Abbrev Number: 7 (DW_TAG_member) <7a> DW_AT_name : (indirect string, offset: 0xde): _ptr <7e> DW_AT_decl_file : 2 <7f> DW_AT_decl_line : 36 <80> DW_AT_decl_column : 17 <81> DW_AT_type : <0x122> <85> DW_AT_data_member_location: 2 byte block: 23 4 (DW_OP_plus_uconst: 4) <2><88>: Abbrev Number: 7 (DW_TAG_member) <89> DW_AT_name : (indirect string, offset: 0x162): _base <8d> DW_AT_decl_file : 2 <8e> DW_AT_decl_line : 38 <8f> DW_AT_decl_column : 17 <90> DW_AT_type : <0x122> <94> DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8) <2><97>: Abbrev Number: 7 (DW_TAG_member) <98> DW_AT_name : (indirect string, offset: 0x2c): _flag <9c> DW_AT_decl_file : 2 <9d> DW_AT_decl_line : 39 <9e> DW_AT_decl_column : 16 <9f> DW_AT_type : <0x128> <a3> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12) <2><a6>: Abbrev Number: 7 (DW_TAG_member) <a7> DW_AT_name : (indirect string, offset: 0x105): _file <ab> DW_AT_decl_file : 2 <ac> DW_AT_decl_line : 40 <ad> DW_AT_decl_column : 16 <ae> DW_AT_type : <0x128> <b2> DW_AT_data_member_location: 2 byte block: 23 d (DW_OP_plus_uconst: 13) <2><b5>: Abbrev Number: 8 (DW_TAG_member) <b6> DW_AT_name : (indirect string, offset: 0x88): __orientation <ba> DW_AT_decl_file : 2 <bb> DW_AT_decl_line : 42 <bc> DW_AT_decl_column : 11 <bd> DW_AT_type : <0x28> <c1> DW_AT_byte_size : 4 <c2> DW_AT_bit_size : 2 <c3> DW_AT_bit_offset : 16 <c4> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12) <2><c7>: Abbrev Number: 8 (DW_TAG_member) <c8> DW_AT_name : (indirect string, offset: 0x96): __ionolock <cc> DW_AT_decl_file : 2 <cd> DW_AT_decl_line : 43 <ce> DW_AT_decl_column : 11 <cf> DW_AT_type : <0x28> <d3> DW_AT_byte_size : 4 <d4> DW_AT_bit_size : 1 <d5> DW_AT_bit_offset : 18 <d6> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12) <2><d9>: Abbrev Number: 8 (DW_TAG_member) <da> DW_AT_name : (indirect string, offset: 0xbc): __seekable <de> DW_AT_decl_file : 2 <df> DW_AT_decl_line : 44 <e0> DW_AT_decl_column : 11 <e1> DW_AT_type : <0x28> <e5> DW_AT_byte_size : 4 <e6> DW_AT_bit_size : 1 <e7> DW_AT_bit_offset : 19 <e8> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12) <2><eb>: Abbrev Number: 8 (DW_TAG_member) <ec> DW_AT_name : (indirect string, offset: 0x0): __extendedfd <f0> DW_AT_decl_file : 2 <f1> DW_AT_decl_line : 45 <f2> DW_AT_decl_column : 11 <f3> DW_AT_type : <0x28> <f7> DW_AT_byte_size : 4 <f8> DW_AT_bit_size : 1 <f9> DW_AT_bit_offset : 20 <fa> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12) <2><fd>: Abbrev Number: 8 (DW_TAG_member) <fe> DW_AT_name : (indirect string, offset: 0x168): __xf_nocheck <102> DW_AT_decl_file : 2 <103> DW_AT_decl_line : 46 <104> DW_AT_decl_column : 11 <105> DW_AT_type : <0x28> <109> DW_AT_byte_size : 4 <10a> DW_AT_bit_size : 1 <10b> DW_AT_bit_offset : 21 <10c> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12) <2><10f>: Abbrev Number: 8 (DW_TAG_member) <110> DW_AT_name : (indirect string, offset: 0xf7): __filler <114> DW_AT_decl_file : 2 <115> DW_AT_decl_line : 47 <116> DW_AT_decl_column : 11 <117> DW_AT_type : <0x28> <11b> DW_AT_byte_size : 4 <11c> DW_AT_bit_size : 10 <11d> DW_AT_bit_offset : 22 <11e> DW_AT_data_member_location: 2 byte block: 23 c (DW_OP_plus_uconst: 12) <2><121>: Abbrev Number: 0 <1><122>: Abbrev Number: 4 (DW_TAG_pointer_type) <123> DW_AT_byte_size : 4 <124> DW_AT_type : <0x128> <1><128>: Abbrev Number: 3 (DW_TAG_base_type) <129> DW_AT_byte_size : 1 <12a> DW_AT_encoding : 8 (unsigned char) <12b> DW_AT_name : (indirect string, offset: 0xae): unsigned char <1><12f>: Abbrev Number: 5 (DW_TAG_typedef) <130> DW_AT_name : (indirect string, offset: 0x40): FILE <134> DW_AT_decl_file : 4 <135> DW_AT_decl_line : 83 <136> DW_AT_decl_column : 16 <137> DW_AT_type : <0x51> <1><13b>: Abbrev Number: 9 (DW_TAG_array_type) <13c> DW_AT_type : <0x51> <140> DW_AT_sibling : <0x14b> <2><144>: Abbrev Number: 10 (DW_TAG_subrange_type) <145> DW_AT_type : <0x28> <149> DW_AT_upper_bound : 19 <2><14a>: Abbrev Number: 0 <1><14b>: Abbrev Number: 11 (DW_TAG_variable) <14c> DW_AT_name : (indirect string, offset: 0x26): __iob <150> DW_AT_decl_file : 4 <151> DW_AT_decl_line : 155 <152> DW_AT_decl_column : 15 <153> DW_AT_type : <0x13b> <157> DW_AT_external : 1 <158> DW_AT_declaration : 1 <1><159>: Abbrev Number: 9 (DW_TAG_array_type) <15a> DW_AT_type : <0x128> <15e> DW_AT_sibling : <0x164> <2><162>: Abbrev Number: 12 (DW_TAG_subrange_type) <2><163>: Abbrev Number: 0 <1><164>: Abbrev Number: 11 (DW_TAG_variable) <165> DW_AT_name : (indirect string, offset: 0x175): _sibuf <169> DW_AT_decl_file : 5 <16a> DW_AT_decl_line : 208 <16b> DW_AT_decl_column : 23 <16c> DW_AT_type : <0x159> <170> DW_AT_external : 1 <171> DW_AT_declaration : 1 <1><172>: Abbrev Number: 11 (DW_TAG_variable) <173> DW_AT_name : (indirect string, offset: 0x32): _sobuf <177> DW_AT_decl_file : 5 <178> DW_AT_decl_line : 208 <179> DW_AT_decl_column : 33 <17a> DW_AT_type : <0x159> <17e> DW_AT_external : 1 <17f> DW_AT_declaration : 1 <1><180>: Abbrev Number: 9 (DW_TAG_array_type) <181> DW_AT_type : <0x122> <185> DW_AT_sibling : <0x18b> <2><189>: Abbrev Number: 12 (DW_TAG_subrange_type) <2><18a>: Abbrev Number: 0 <1><18b>: Abbrev Number: 11 (DW_TAG_variable) <18c> DW_AT_name : (indirect string, offset: 0x7d): _bufendtab <190> DW_AT_decl_file : 5 <191> DW_AT_decl_line : 240 <192> DW_AT_decl_column : 23 <193> DW_AT_type : <0x180> <197> DW_AT_external : 1 <198> DW_AT_declaration : 1 <1><199>: Abbrev Number: 11 (DW_TAG_variable) <19a> DW_AT_name : (indirect string, offset: 0x159): _lastbuf <19e> DW_AT_decl_file : 5 <19f> DW_AT_decl_line : 241 <1a0> DW_AT_decl_column : 15 <1a1> DW_AT_type : <0x1a7> <1a5> DW_AT_external : 1 <1a6> DW_AT_declaration : 1 <1><1a7>: Abbrev Number: 4 (DW_TAG_pointer_type) <1a8> DW_AT_byte_size : 4 <1a9> DW_AT_type : <0x12f> <1><1ad>: Abbrev Number: 13 (DW_TAG_variable) <1ae> DW_AT_name : (indirect string, offset: 0xf0): optarg <1b2> DW_AT_decl_file : 5 <1b3> DW_AT_decl_line : 320 <1b5> DW_AT_decl_column : 14 <1b6> DW_AT_type : <0x4b> <1ba> DW_AT_external : 1 <1bb> DW_AT_declaration : 1 <1><1bc>: Abbrev Number: 13 (DW_TAG_variable) <1bd> DW_AT_name : (indirect string, offset: 0xa7): optind <1c1> DW_AT_decl_file : 5 <1c2> DW_AT_decl_line : 321 <1c4> DW_AT_decl_column : 12 <1c5> DW_AT_type : <0x21> <1c9> DW_AT_external : 1 <1ca> DW_AT_declaration : 1 <1><1cb>: Abbrev Number: 13 (DW_TAG_variable) <1cc> DW_AT_name : (indirect string, offset: 0x39): opterr <1d0> DW_AT_decl_file : 5 <1d1> DW_AT_decl_line : 321 <1d3> DW_AT_decl_column : 20 <1d4> DW_AT_type : <0x21> <1d8> DW_AT_external : 1 <1d9> DW_AT_declaration : 1 <1><1da>: Abbrev Number: 13 (DW_TAG_variable) <1db> DW_AT_name : (indirect string, offset: 0x76): optopt <1df> DW_AT_decl_file : 5 <1e0> DW_AT_decl_line : 321 <1e2> DW_AT_decl_column : 28 <1e3> DW_AT_type : <0x21> <1e7> DW_AT_external : 1 <1e8> DW_AT_declaration : 1 <1><1e9>: Abbrev Number: 14 (DW_TAG_subroutine_type) <1ea> DW_AT_sibling : <0x1f0> <2><1ee>: Abbrev Number: 15 (DW_TAG_unspecified_parameters) <2><1ef>: Abbrev Number: 0 <1><1f0>: Abbrev Number: 16 (DW_TAG_variable) <1f1> DW_AT_name : (indirect string, offset: 0x136): __cgo__0 <1f5> DW_AT_decl_file : 6 <1f6> DW_AT_decl_line : 1 <1f7> DW_AT_decl_column : 20 <1f8> DW_AT_type : <0x203> <1fc> DW_AT_external : 1 <1fd> DW_AT_location : 5 byte block: 3 0 0 0 4 (DW_OP_addr: 4) <1><203>: Abbrev Number: 4 (DW_TAG_pointer_type) <204> DW_AT_byte_size : 4 <205> DW_AT_type : <0x1e9> <1><209>: Abbrev Number: 9 (DW_TAG_array_type) <20a> DW_AT_type : <0x36> <20e> DW_AT_sibling : <0x219> <2><212>: Abbrev Number: 10 (DW_TAG_subrange_type) <213> DW_AT_type : <0x28> <217> DW_AT_upper_bound : 1 <2><218>: Abbrev Number: 0 <1><219>: Abbrev Number: 16 (DW_TAG_variable) <21a> DW_AT_name : (indirect string, offset: 0xce): __cgodebug_ints <21e> DW_AT_decl_file : 6 <21f> DW_AT_decl_line : 2 <220> DW_AT_decl_column : 11 <221> DW_AT_type : <0x209> <225> DW_AT_external : 1 <226> DW_AT_location : 5 byte block: 3 0 0 0 10 (DW_OP_addr: 10) <1><22c>: Abbrev Number: 9 (DW_TAG_array_type) <22d> DW_AT_type : <0x23c> <231> DW_AT_sibling : <0x23c> <2><235>: Abbrev Number: 10 (DW_TAG_subrange_type) <236> DW_AT_type : <0x28> <23a> DW_AT_upper_bound : 1 <2><23b>: Abbrev Number: 0 <1><23c>: Abbrev Number: 3 (DW_TAG_base_type) <23d> DW_AT_byte_size : 8 <23e> DW_AT_encoding : 4 (float) <23f> DW_AT_name : (indirect string, offset: 0xc7): double <1><243>: Abbrev Number: 16 (DW_TAG_variable) <244> DW_AT_name : (indirect string, offset: 0xd): __cgodebug_floats <248> DW_AT_decl_file : 6 <249> DW_AT_decl_line : 6 <24a> DW_AT_decl_column : 8 <24b> DW_AT_type : <0x22c> <24f> DW_AT_external : 1 <250> DW_AT_location : 5 byte block: 3 0 0 0 0 (DW_OP_addr: 0) <1><256>: Abbrev Number: 17 (DW_TAG_subprogram) <257> DW_AT_external : 1 <258> DW_AT_name : (indirect string, offset: 0xa1): testc <25c> DW_AT_decl_file : 1 <25d> DW_AT_decl_line : 6 <25e> DW_AT_decl_column : 6 <25f> DW_AT_low_pc : 0x0 <263> DW_AT_high_pc : 0x14 <267> DW_AT_frame_base : 2 byte block: 7e 0 (DW_OP_breg14 (r14): 0) <26a> DW_AT_GNU_all_call_sites: 1 <26b> DW_AT_sibling : <0x281> <2><26f>: Abbrev Number: 18 (DW_TAG_GNU_call_site) <270> DW_AT_low_pc : 0x14 <274> DW_AT_GNU_tail_call: 1 <275> DW_AT_abstract_origin: <0x281> <3><279>: Abbrev Number: 19 (DW_TAG_GNU_call_site_parameter) <27a> DW_AT_location : 1 byte block: 58 (DW_OP_reg8 (r8)) <27c> DW_AT_GNU_call_site_value: 2 byte block: 78 0 (DW_OP_breg8 (r8): 0) <3><27f>: Abbrev Number: 0 <2><280>: Abbrev Number: 0 <1><281>: Abbrev Number: 20 (DW_TAG_subprogram) <282> DW_AT_external : 1 <283> DW_AT_declaration : 1 <284> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x12f): printf <288> DW_AT_name : (indirect string, offset: 0x12f): printf <28c> DW_AT_decl_file : 4 <28d> DW_AT_decl_line : 215 <28e> DW_AT_decl_column : 12 <1><28f>: Abbrev Number: 0 Contents of the .debug_abbrev section: Number TAG (0x0) 1 DW_TAG_compile_unit [has children] DW_AT_producer DW_FORM_strp DW_AT_language DW_FORM_data1 DW_AT_comp_dir DW_FORM_strp DW_AT_low_pc DW_FORM_addr DW_AT_high_pc DW_FORM_addr DW_AT_stmt_list DW_FORM_data4 DW_AT value: 0 DW_FORM value: 0 2 DW_TAG_base_type [no children] DW_AT_byte_size DW_FORM_data1 DW_AT_encoding DW_FORM_data1 DW_AT_name DW_FORM_string DW_AT value: 0 DW_FORM value: 0 3 DW_TAG_base_type [no children] DW_AT_byte_size DW_FORM_data1 DW_AT_encoding DW_FORM_data1 DW_AT_name DW_FORM_strp DW_AT value: 0 DW_FORM value: 0 4 DW_TAG_pointer_type [no children] DW_AT_byte_size DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT value: 0 DW_FORM value: 0 5 DW_TAG_typedef [no children] DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_decl_column DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT value: 0 DW_FORM value: 0 6 DW_TAG_structure_type [has children] DW_AT_name DW_FORM_strp DW_AT_byte_size DW_FORM_data1 DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_decl_column DW_FORM_data1 DW_AT_sibling DW_FORM_ref4 DW_AT value: 0 DW_FORM value: 0 7 DW_TAG_member [no children] DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_decl_column DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT_data_member_location DW_FORM_block1 DW_AT value: 0 DW_FORM value: 0 8 DW_TAG_member [no children] DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_decl_column DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT_byte_size DW_FORM_data1 DW_AT_bit_size DW_FORM_data1 DW_AT_bit_offset DW_FORM_data1 DW_AT_data_member_location DW_FORM_block1 DW_AT value: 0 DW_FORM value: 0 9 DW_TAG_array_type [has children] DW_AT_type DW_FORM_ref4 DW_AT_sibling DW_FORM_ref4 DW_AT value: 0 DW_FORM value: 0 10 DW_TAG_subrange_type [no children] DW_AT_type DW_FORM_ref4 DW_AT_upper_bound DW_FORM_data1 DW_AT value: 0 DW_FORM value: 0 11 DW_TAG_variable [no children] DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_decl_column DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT_external DW_FORM_flag DW_AT_declaration DW_FORM_flag DW_AT value: 0 DW_FORM value: 0 12 DW_TAG_subrange_type [no children] DW_AT value: 0 DW_FORM value: 0 13 DW_TAG_variable [no children] DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data2 DW_AT_decl_column DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT_external DW_FORM_flag DW_AT_declaration DW_FORM_flag DW_AT value: 0 DW_FORM value: 0 14 DW_TAG_subroutine_type [has children] DW_AT_sibling DW_FORM_ref4 DW_AT value: 0 DW_FORM value: 0 15 DW_TAG_unspecified_parameters [no children] DW_AT value: 0 DW_FORM value: 0 16 DW_TAG_variable [no children] DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_decl_column DW_FORM_data1 DW_AT_type DW_FORM_ref4 DW_AT_external DW_FORM_flag DW_AT_location DW_FORM_block1 DW_AT value: 0 DW_FORM value: 0 17 DW_TAG_subprogram [has children] DW_AT_external DW_FORM_flag DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_decl_column DW_FORM_data1 DW_AT_low_pc DW_FORM_addr DW_AT_high_pc DW_FORM_addr DW_AT_frame_base DW_FORM_block1 DW_AT_GNU_all_call_sites DW_FORM_flag DW_AT_sibling DW_FORM_ref4 DW_AT value: 0 DW_FORM value: 0 18 DW_TAG_GNU_call_site [has children] DW_AT_low_pc DW_FORM_addr DW_AT_GNU_tail_call DW_FORM_flag DW_AT_abstract_origin DW_FORM_ref4 DW_AT value: 0 DW_FORM value: 0 19 DW_TAG_GNU_call_site_parameter [no children] DW_AT_location DW_FORM_block1 DW_AT_GNU_call_site_value DW_FORM_block1 DW_AT value: 0 DW_FORM value: 0 20 DW_TAG_subprogram [no children] DW_AT_external DW_FORM_flag DW_AT_declaration DW_FORM_flag DW_AT_MIPS_linkage_name DW_FORM_strp DW_AT_name DW_FORM_strp DW_AT_decl_file DW_FORM_data1 DW_AT_decl_line DW_FORM_data1 DW_AT_decl_column DW_FORM_data1 DW_AT value: 0 DW_FORM value: 0 Contents of the .debug_aranges section: Length: 28 Version: 2 Offset into .debug_info: 0x0 Pointer Size: 4 Segment Size: 0 Address Length 00000000 00000014 00000000 00000000 Raw dump of debug contents of section .debug_line: Offset: 0x0 Length: 292 DWARF Version: 2 Prologue Length: 268 Minimum Instruction Length: 4 Initial value of 'is_stmt': 1 Line Base: -5 Line Range: 14 Opcode Base: 13 Opcodes: Opcode 1 has 0 args Opcode 2 has 1 args Opcode 3 has 1 args Opcode 4 has 1 args Opcode 5 has 1 args Opcode 6 has 0 args Opcode 7 has 0 args Opcode 8 has 0 args Opcode 9 has 1 args Opcode 10 has 0 args Opcode 11 has 0 args Opcode 12 has 1 args The Directory Table (offset 0x1b): 1 /export/home/amandeep 2 /usr/include 3 /usr/gnu/lib/gcc/sparc-sun-solaris2.10/8.2.1/include-fixed/iso 4 /usr/gnu/lib/gcc/sparc-sun-solaris2.10/8.2.1/include-fixed The File Name Table (offset 0xb9): Entry Dir Time Size Name 1 1 0 0 sol10.go 2 2 0 0 stdio_impl.h 3 2 0 0 stdio_tag.h 4 3 0 0 stdio_iso.h 5 4 0 0 stdio.h 6 0 0 0 cgo-dwarf-inference Line Number Statements: [0x00000116] Set column to 14 [0x00000118] Extended opcode 2: set Address to 0x0 [0x0000011f] Special opcode 10: advance Address by 0 to 0x0 and Line by 5 to 6 [0x00000120] Set column to 5 [0x00000122] Special opcode 6: advance Address by 0 to 0x0 and Line by 1 to 7 [0x00000123] Advance PC by 20 to 0x14 [0x00000125] Extended opcode 1: End of Sequence Contents of the .debug_str section: 0x00000000 5f5f6578 74656e64 65646664 005f5f63 __extendedfd.__c 0x00000010 676f6465 6275675f 666c6f61 7473005f godebug_floats._ 0x00000020 5f46494c 45005f5f 696f6200 5f666c61 _FILE.__iob._fla 0x00000030 67005f73 6f627566 006f7074 65727200 g._sobuf.opterr. 0x00000040 46494c45 00474e55 20433137 20382e32 FILE.GNU C17 8.2 0x00000050 2e312032 30313830 38313420 2d6d6370 .1 20180814 -mcp 0x00000060 753d7639 202d6764 77617266 2d32202d u=v9 -gdwarf-2 - 0x00000070 67202d4f 32006f70 746f7074 005f6275 g -O2.optopt._bu 0x00000080 66656e64 74616200 5f5f6f72 69656e74 fendtab.__orient 0x00000090 6174696f 6e005f5f 696f6e6f 6c6f636b ation.__ionolock 0x000000a0 00746573 7463006f 7074696e 6400756e .testc.optind.un 0x000000b0 7369676e 65642063 68617200 5f5f7365 signed char.__se 0x000000c0 656b6162 6c650064 6f75626c 65005f5f ekable.double.__ 0x000000d0 63676f64 65627567 5f696e74 73005f70 cgodebug_ints._p 0x000000e0 74720075 6e736967 6e656420 696e7400 tr.unsigned int. 0x000000f0 6f707461 7267005f 5f66696c 6c657200 optarg.__filler. 0x00000100 63686172 005f6669 6c65002f 6578706f char._file./expo 0x00000110 72742f68 6f6d652f 616d616e 64656570 rt/home/amandeep 0x00000120 006c6f6e 67206c6f 6e672069 6e740070 .long long int.p 0x00000130 72696e74 66005f5f 63676f5f 5f30006c rintf.__cgo__0.l 0x00000140 6f6e6720 696e7400 5f636e74 006c6f6e ong int._cnt.lon 0x00000150 6720646f 75626c65 005f6c61 73746275 g double._lastbu 0x00000160 66005f62 61736500 5f5f7866 5f6e6f63 f._base.__xf_noc 0x00000170 6865636b 005f7369 62756600 heck._sibuf. Also, looks like Solaris 11 is very different than Solaris 10. Please see the prompt below where "sol10.go" is the file from the first message: amandeep@s113ldom1:~$ go build -x sol10.go WORK=/tmp/go-build038354192 mkdir -p $WORK/b001/ cat >$WORK/b001/importcfg.link << 'EOF' # internal packagefile command-line-arguments=/home/amandeep/.cache/go-build/02/0272a12b534156aa38d92948433fc12ef8c60940db073e83182436827d642e97-d EOF mkdir -p $WORK/b001/exe/ cp /home/amandeep/.cache/go-build/02/0272a12b534156aa38d92948433fc12ef8c60940db073e83182436827d642e97-d $WORK/b001/_pkg1_.a cd $WORK/b001/ ar x ./_pkg1_.a _cgo_flags cd . ar d $WORK/b001/_pkg1_.a _cgo_flags /usr/gnu/bin/gccgo -o $WORK/b001/exe/a.out "-Wl,-(" -Wl,--whole-archive $WORK/b001/_pkg1_.a -Wl,--no-whole-archive "-Wl,-)" /usr/gnu/libexec/gcc/sparc-sun-solaris2.11/8.2.1/buildid -w $WORK/b001/exe/a.out # internal cp $WORK/b001/exe/a.out sol10 rm -r $WORK/b001/ On Friday, September 14, 2018 at 2:52:21 PM UTC-7, Ian Lance Taylor wrote: > > On Fri, Sep 14, 2018 at 2:16 PM, <aman...@cohesity.com <javascript:>> > wrote: > > It would be the same. Please see below. > > > > -bash-3.2$ gcc --version > > gcc (GCC) 8.2.1 20180814 > > Copyright (C) 2018 Free Software Foundation, Inc. > > This is free software; see the source for copying conditions. There is > NO > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > PURPOSE. > > > Hmmm, not sure what is happening. Especially not sure why it would > fail on Solaris 10 but work on Solaris 11, as you suggested earlier. > I have a feeling this is going to be some configuration error > somewhere. > > I guess the next step in debugging would be to run this command, > copied from your earlier message, and then look at x.o to see how > __cgo__0 is defined in the debug info. If you have the readelf > program from the GNU binutils you could run readelf --debug=all x.o. > > Ian > > > gcc -w -Wno-error -o x.o -gdwarf-2 -c -xc -I /b001/ -g -O2 - <<EOF > > #line 1 "cgo-builtin-prolog" > #include <stddef.h> /* for ptrdiff_t and size_t below */ > > /* Define intgo when compiling with GCC. */ > typedef ptrdiff_t intgo; > > typedef struct { const char *p; intgo n; } _GoString_; > typedef struct { char *p; intgo n; intgo c; } _GoBytes_; > _GoString_ GoString(char *p); > _GoString_ GoStringN(char *p, int l); > _GoBytes_ GoBytes(void *p, int n); > char *CString(_GoString_); > void *CBytes(_GoBytes_); > void *_CMalloc(size_t); > > __attribute__ ((unused)) > static size_t _GoStringLen(_GoString_ s) { return s.n; } > > __attribute__ ((unused)) > static const char *_GoStringPtr(_GoString_ s) { return s.p; } > #line 3 "/export/home/amandeep/sol10.go" > > #include <stdio.h> > > void testc() { > printf("Hello cgo"); > } > > #line 1 "cgo-generated-wrapper" > #line 1 "cgo-dwarf-inference" > __typeof__(testc) *__cgo__0; > long long __cgodebug_ints[] = { > 0, > 1 > }; > double __cgodebug_floats[] = { > 0, > 1 > }; > EOF > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.