[arm-gnu] .debug_type missing from elf output
Leo Havmøller
LEH at rtx.dk
Thu Apr 12 04:29:53 UTC 2012
Hello Mr. O'Donell,
Thank you for your response.
I have tested with the compiler/linker options used in the real project, and found that --gc-sections is the curprit.
If you use:
arm-none-eabi-gcc -gdwarf-4 -Wl,--gc-sections -T generic-hosted.ld -o test test.c arm-none-eabi-readelf -a test | grep types
Then the .debug_types section is missing from the elf output.
Section headers without --gc-sections (OK):
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 008000 000698 00 AX 0 0 4
[ 2] .eh_frame PROGBITS 00000698 008698 000004 00 A 0 0 4
[ 3] .rodata PROGBITS 0000069c 00869c 00005c 00 WAX 0 0 4
[ 4] .data PROGBITS 000006f8 0086f8 000440 00 WA 0 0 8
[ 5] .bss NOBITS 00000b38 008b38 000028 00 WA 0 0 8
[ 6] .debug_aranges PROGBITS 00000000 008b38 000020 00 0 0 1
[ 7] .debug_info PROGBITS 00000000 008b58 000055 00 0 0 1
[ 8] .debug_abbrev PROGBITS 00000000 008bad 000083 00 0 0 1
[ 9] .debug_line PROGBITS 00000000 008c30 000037 00 0 0 1
[10] .debug_frame PROGBITS 00000000 008c68 0001bc 00 0 0 4
[11] .debug_str PROGBITS 00000000 008e24 000022 01 MS 0 0 1
[12] .ARM.attributes ARM_ATTRIBUTES 00000000 008e46 00002e 00 0 0 1
[13] .debug_types PROGBITS 00000000 008e74 000051 00 0 0 1
[14] .comment PROGBITS 00000000 008ec5 000030 01 MS 0 0 1
[15] .shstrtab STRTAB 00000000 008ef5 0000b1 00 0 0 1
[16] .symtab SYMTAB 00000000 009278 000a30 10 17 102 4
[17] .strtab STRTAB 00000000 009ca8 0004f8 00 0 0 1
Section headers with --gc-sections (.debug_types removed):
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 008000 000698 00 AX 0 0 4
[ 2] .eh_frame PROGBITS 00000698 008698 000004 00 A 0 0 4
[ 3] .rodata PROGBITS 0000069c 00869c 00005c 00 WAX 0 0 4
[ 4] .data PROGBITS 000006f8 0086f8 000440 00 WA 0 0 8
[ 5] .bss NOBITS 00000b38 008b38 000020 00 WA 0 0 8
[ 6] .debug_aranges PROGBITS 00000000 008b38 000020 00 0 0 1
[ 7] .debug_info PROGBITS 00000000 008b58 000055 00 0 0 1
[ 8] .debug_abbrev PROGBITS 00000000 008bad 000083 00 0 0 1
[ 9] .debug_line PROGBITS 00000000 008c30 000037 00 0 0 1
[10] .debug_frame PROGBITS 00000000 008c68 0001bc 00 0 0 4
[11] .debug_str PROGBITS 00000000 008e24 000022 01 MS 0 0 1
[12] .comment PROGBITS 00000000 008e46 000030 01 MS 0 0 1
[13] .ARM.attributes ARM_ATTRIBUTES 00000000 008e76 00002e 00 0 0 1
[14] .shstrtab STRTAB 00000000 008ea4 0000a4 00 0 0 1
[15] .symtab SYMTAB 00000000 0091f0 0009f0 10 16 100 4
[16] .strtab STRTAB 00000000 009be0 0004e9 00 0 0 1
This problem is seen with arm-2011.09-69-arm-none-eabi. Was OK with arm-2011.03-42-arm-none-eabi.
Best regards
RTX Telecom A/S
Leo Havmøller.
> -----Original Message-----
> From: Carlos O'Donell [mailto:carlos_odonell at mentor.com]
> Sent: 11. april 2012 19:42
> To: Leo Havmøller
> Cc: arm-gnu at codesourcery.com
> Subject: Re: [arm-gnu] .debug_type missing from elf output
>
> On 3/23/2012 9:35 AM, Leo Havmøller wrote:
> > With arm-2011.09-69-arm-none-eabi, the entire .debug_types section is
> missing from the elf output (compiling with -gdwarf-4).
> >
> > OK with arm-2011.03-42-arm-none-eabi.
>
> I can't reproduce that with a simple application, and you haven't
> provided enough information for anyone else to verify.
>
> With 2011.09-69:
>
> struct s
> {
> int x;
> int y : 5;
> int z;
> };
> struct s i;
>
> int main (void)
> {
> }
>
> arm-none-eabi-gcc -gdwarf-4 -T generic-hosted.ld -o test test.c arm-
> none-eabi-readelf -a test | grep types
> [13] .debug_types PROGBITS 00000000 008e8e 000051 00
> 0 0 1
>
> arm-none-eabi-objdump --dwarf test
> ...
> Contents of the .debug_types section:
>
> Compilation Unit @ offset 0x0:
> Length: 0x4d (32-bit)
> Version: 4
> Abbrev Offset: 0
> Pointer Size: 4
> Signature: a5e49293c4185192
> Type Offset: 0x1d
> <0><17>: Abbrev Number: 1 (DW_TAG_type_unit)
> <18> DW_AT_language : 1 (ANSI C)
> <19> DW_AT_stmt_list : 0x0
> <1><1d>: Abbrev Number: 2 (DW_TAG_structure_type)
> <1e> DW_AT_name : s
> <20> DW_AT_byte_size : 12
> <21> DW_AT_decl_file : 1
> <22> DW_AT_decl_line : 1
> <23> DW_AT_sibling : <0x49>
> <2><27>: Abbrev Number: 3 (DW_TAG_member)
> <28> DW_AT_name : x
> <2a> DW_AT_decl_file : 1
> <2b> DW_AT_decl_line : 3
> <2c> DW_AT_type : <0x49>
> <30> DW_AT_data_member_location: 0
> <2><31>: Abbrev Number: 4 (DW_TAG_member)
> <32> DW_AT_name : y
> <34> DW_AT_decl_file : 1
> <35> DW_AT_decl_line : 4
> <36> DW_AT_type : <0x49>
> <3a> DW_AT_byte_size : 4
> <3b> DW_AT_bit_size : 5
> <3c> DW_AT_bit_offset : 27
> <3d> DW_AT_data_member_location: 4
> <2><3e>: Abbrev Number: 3 (DW_TAG_member)
> <3f> DW_AT_name : z
> <41> DW_AT_decl_file : 1
> <42> DW_AT_decl_line : 5
> <43> DW_AT_type : <0x49>
> <47> DW_AT_data_member_location: 8
> <1><49>: Abbrev Number: 5 (DW_TAG_base_type)
> <4a> DW_AT_byte_size : 4
> <4b> DW_AT_encoding : 5 (signed)
> <4c> DW_AT_name : int
> ...
>
> Cheers,
> Carlos.
> --
> Carlos O'Donell
> Mentor Graphics / CodeSourcery
> carlos_odonell at mentor.com
> carlos at codesourcery.com
> +1 (613) 963 1026
More information about the arm-gnu
mailing list