Fangrui Song | ba51fd5 | 2019-06-26 08:09:08 | [diff] [blame] | 1 | # REQUIRES: x86 |
| 2 | # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o |
Fangrui Song | 251640a | 2022-02-23 03:20:55 | [diff] [blame] | 3 | # RUN: ld.lld --gdb-index -e 0 %t.o %t.o -o /dev/null 2>&1 | count 0 |
Fangrui Song | ba51fd5 | 2019-06-26 08:09:08 | [diff] [blame] | 4 | |
| 5 | ## .debug_info has a relocation to .text.foo . The second %t.o is discarded. |
| 6 | ## Check we don't error on the relocation. |
| 7 | # CHECK: .rela.debug_info { |
| 8 | # CHECK-NEXT: 0xC R_X86_64_64 .text.foo 0x0 |
| 9 | |
| 10 | .section .text.foo,"axG",@progbits,foo,comdat |
| 11 | .globl foo |
| 12 | .Lfunc_begin0: |
| 13 | foo: |
| 14 | ret |
| 15 | .Lfunc_end0: |
| 16 | |
| 17 | .section .debug_abbrev,"",@progbits |
| 18 | .byte 1 # Abbreviation Code |
| 19 | .byte 17 # DW_TAG_compile_unit |
| 20 | .byte 1 # DW_CHILDREN_yes |
| 21 | .byte 17 # DW_AT_low_pc |
| 22 | .byte 1 # DW_FORM_addr |
| 23 | .byte 18 # DW_AT_high_pc |
| 24 | .byte 6 # DW_FORM_data4 |
| 25 | .ascii "\264B" # DW_AT_GNU_pubnames |
| 26 | .byte 25 # DW_FORM_flag_present |
| 27 | .byte 0 # EOM(1) |
| 28 | .byte 0 # EOM(2) |
| 29 | .byte 2 # Abbreviation Code |
| 30 | .byte 46 # DW_TAG_subprogram |
| 31 | .byte 0 # DW_CHILDREN_no |
| 32 | .byte 3 # DW_AT_name |
| 33 | .byte 8 # DW_FORM_string |
| 34 | .byte 0 # EOM(1) |
| 35 | .byte 0 # EOM(2) |
| 36 | .byte 0 |
| 37 | |
| 38 | .section .debug_info,"",@progbits |
| 39 | .Lcu_begin0: |
| 40 | .long .Lcu_end0 - .Lcu_begin0 - 4 |
| 41 | .short 4 # DWARF version number |
| 42 | .long 0 # Offset Into Abbrev. Section |
Fangrui Song | b96fc48 | 2022-02-23 05:42:15 | [diff] [blame] | 43 | .byte 8 # Address Size |
Fangrui Song | ba51fd5 | 2019-06-26 08:09:08 | [diff] [blame] | 44 | .Ldie0: |
| 45 | .byte 1 # Abbrev [1] DW_TAG_compile_unit |
| 46 | .quad .Lfunc_begin0 # DW_AT_low_pc |
| 47 | .long .Lfunc_end0 - .Lfunc_begin0 # DW_AT_high_pc |
| 48 | .byte 2 # Abbrev [2] DW_TAG_subprogram |
| 49 | .asciz "foo" # DW_AT_name |
| 50 | .byte 0 |
Fangrui Song | ba51fd5 | 2019-06-26 08:09:08 | [diff] [blame] | 51 | .Lcu_end0: |
| 52 | |
| 53 | .section .debug_gnu_pubnames,"",@progbits |
| 54 | .long .LpubNames_end0 - .LpubNames_begin0 |
| 55 | .LpubNames_begin0: |
| 56 | .short 2 # Version |
| 57 | .long .Lcu_begin0 # CU Offset |
| 58 | .long .Lcu_end0 - .Lcu_begin0 |
| 59 | .long .Ldie0 - .Lcu_begin0 |
| 60 | .byte 48 # Attributes: FUNCTION, EXTERNAL |
| 61 | .asciz "foo" # External Name |
| 62 | .long 0 |
| 63 | .LpubNames_end0: |