1# Test object with an artifically constructed type unit header to verify 2# that the length field is correctly used to verify the validity of the 3# type_offset field. 4# 5# To generate the test object: 6# llvm-mc -triple x86_64-unknown-linux typeunit-header.s -filetype=obj \ 7# -o typeunit-header.elf-x86-64 8# 9# We only have an abbreviation for the type unit die which is all we need. 10# Real type unit dies have quite different attributes of course, but we 11# just need to demonstrate an issue with validating length, so we just give it 12# a single visibility attribute. 13 .section .debug_abbrev,"",@progbits 14 .byte 0x01 # Abbrev code 15 .byte 0x41 # DW_TAG_type_unit 16 .byte 0x01 # DW_CHILDREN_yes 17 .byte 0x17 # DW_AT_visibility 18 .byte 0x0b # DW_FORM_data1 19 .byte 0x00 # EOM(1) 20 .byte 0x00 # EOM(2) 21 .byte 0x02 # Abbrev code 22 .byte 0x13 # DW_TAG_structure_type 23 .byte 0x00 # DW_CHILDREN_no (no members) 24 .byte 0x17 # DW_AT_visibility 25 .byte 0x0b # DW_FORM_data1 26 .byte 0x00 # EOM(1) 27 .byte 0x00 # EOM(2) 28 .byte 0x00 # EOM(3) 29 30 .section .debug_types,"",@progbits 31# DWARF v4 Type unit header - DWARF32 format. 32TU_4_32_start: 33 .long TU_4_32_end-TU_4_32_version # Length of Unit 34TU_4_32_version: 35 .short 4 # DWARF version number 36 .long .debug_abbrev # Offset Into Abbrev. Section 37 .byte 8 # Address Size (in bytes) 38 .quad 0x0011223344556677 # Type Signature 39 .long TU_4_32_type-TU_4_32_start # Type offset 40# The type-unit DIE, which has just a visibility attribute. 41 .byte 1 # Abbreviation code 42 .byte 1 # DW_VIS_local 43# The type DIE, which also just has a one-byte visibility attribute. 44TU_4_32_type: 45 .byte 2 # Abbreviation code 46 .byte 1 # DW_VIS_local 47 .byte 0 # NULL 48 .byte 0 # NULL 49TU_4_32_end: 50