brintos

brintos / llvm-project-archived public Read only

0
0
Text · 27.6 KiB · 5252be1 Raw
605 lines · yaml
1## Test that yaml2obj emits .debug_aranges section.2 3## a) Generate the .debug_aranges section from the "DWARF" entry.4 5## Generate and verify a big endian DWARF32 .debug_aranges section.6 7# RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB -DFORMAT=DWARF32 %s -o %t.be.o8# RUN: llvm-readobj --sections --section-data %t.be.o | \9# RUN:   FileCheck -DADDRALIGN=1 -DSIZE=96 %s --check-prefixes=DWARF-HEADER,DWARF-BE-CONTENT10 11#          DWARF-HEADER: Index: 112#     DWARF-HEADER-NEXT: Name: .debug_aranges (1)13#     DWARF-HEADER-NEXT: Type: SHT_PROGBITS (0x1)14#     DWARF-HEADER-NEXT: Flags [ (0x0)15#     DWARF-HEADER-NEXT: ]16#     DWARF-HEADER-NEXT: Address: 0x017#     DWARF-HEADER-NEXT: Offset: 0x4018#     DWARF-HEADER-NEXT: Size: [[SIZE]]19#     DWARF-HEADER-NEXT: Link: 020#     DWARF-HEADER-NEXT: Info: 021#     DWARF-HEADER-NEXT: AddressAlignment: [[ADDRALIGN]]22#     DWARF-HEADER-NEXT: EntrySize: 023# DWARF-BE-CONTENT-NEXT: SectionData (24# DWARF-BE-CONTENT-NEXT:   0000: 0000002C 00020000 00000400 0000000025##                               |        |   |        | |  |26##                               |        |   |        | |  +------- Padding zeros (4-byte)27##                               |        |   |        | +- SegSize (1-byte) 0x0028##                               |        |   |        +- AddrSize (1-byte) 0x0429##                               |        |   +-------- CuOffset (4-byte) 0x0030##                               |        +--- Version (2-byte) 0x0231##                               +------- InitialLength (4-byte) 0x2c32##33# DWARF-BE-CONTENT-NEXT:   0010: 00001234 00000020 00000000 0000000034##                               |        |        |35##                               |        |        +---------------- Terminating Entry36##                               |        +------- Length (4-byte) 0x2037##                               +------- Address (4-byte) 0x123438##39# DWARF-BE-CONTENT-NEXT:   0020: 0000002C 00020000 00650800 0000000040##                               |        |   |        | |  |41##                               |        |   |        | |  +------- Padding zeros (4-byte)42##                               |        |   |        | +- SegSize (1-byte) 0x0043##                               |        |   |        +- AddrSize (1-byte) 0x0844##                               |        |   +-------- CuOffset (4-byte) 0x0045##                               |        +--- Version (2-byte) 0x0246##                               +------- InitialLength (4-byte) 0x2c47##48# DWARF-BE-CONTENT-NEXT:   0030: 00000000 00005678 00000000 0000002049##                               |                 |50##                               |                 +---------------- Length (8-byte) 0x2051##                               +---------------- Address (8-byte) 0x567852##53# DWARF-BE-CONTENT-NEXT:   0040: 00000000 56780000 00000000 0000001054##                               |                 |55##                               |                 +---------------- Length (8-byte) 0x1056##                               +---------------- Address (8-byte) 0x567857##58# DWARF-BE-CONTENT-NEXT:   0050: 00000000 00000000 00000000 0000000059##                               |60##                               +---------------------------------- Terminating entry61##62# DWARF-BE-CONTENT-NEXT: )63 64--- !ELF65FileHeader:66  Class: ELFCLASS6467  Data:  [[ENDIAN]]68  Type:  ET_EXEC69DWARF:70  debug_aranges:71    - Format:               [[FORMAT]]72      Length:               0x2c73      Version:              274      CuOffset:             075      AddressSize:          0x0476      SegmentSelectorSize:  0x0077      Descriptors:78        - Address: 0x0000123479          Length:  0x2080    - Format:              [[FORMAT]]81      Length:              0x2c82      Version:             283      CuOffset:            0x6584      AddressSize:         0x0885      SegmentSelectorSize: 0x0086      Descriptors:87        - Address: 0x000000000000567888          Length:  0x2089        - Address: 0x000000005678000090          Length:  0x1091 92## Generate and verify a little endian DWARF32 .debug_aranges section.93 94# RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2LSB -DFORMAT=DWARF32 %s -o %t.le.o95# RUN: llvm-readobj --sections --section-data %t.le.o | \96# RUN:   FileCheck -DADDRALIGN=1 -DSIZE=96 %s --check-prefixes=DWARF-HEADER,DWARF-LE-CONTENT97 98# DWARF-LE-CONTENT-NEXT: SectionData (99# DWARF-LE-CONTENT-NEXT:   0000: 2C000000 02000000 00000400 00000000100##                               |        |   |        | |  |101##                               |        |   |        | |  +------- Padding zeros (4-byte)102##                               |        |   |        | +- SegSize (1-byte) 0x00103##                               |        |   |        +- AddrSize (1-byte) 0x04104##                               |        |   +-------- CuOffset (4-byte) 0x00105##                               |        +--- Version (2-byte) 0x02106##                               +------- InitialLength (4-byte) 0x2c107##108# DWARF-LE-CONTENT-NEXT:   0010: 34120000 20000000 00000000 00000000109##                               |        |        |110##                               |        |        +---------------- Terminating Entry111##                               |        +------- Length (4-byte) 0x20112##                               +------- Address (4-byte) 0x1234113##114# DWARF-LE-CONTENT-NEXT:   0020: 2C000000 02006500 00000800 00000000115##                               |        |   |        | |  |116##                               |        |   |        | |  +------- Padding zeros (4-byte)117##                               |        |   |        | +- SegSize (1-byte) 0x00118##                               |        |   |        +- AddrSize (1-byte) 0x08119##                               |        |   +-------- CuOffset (4-byte) 0x00120##                               |        +--- Version (2-byte) 0x02121##                               +------- InitialLength (4-byte) 0x2c122##123# DWARF-LE-CONTENT-NEXT:   0030: 78560000 00000000 20000000 00000000124##                               |                 |125##                               |                 +---------------- Length (8-byte) 0x20126##                               +---------------- Address (8-byte) 0x5678127##128# DWARF-LE-CONTENT-NEXT:   0040: 00007856 00000000 10000000 00000000129##                               |                 |130##                               |                 +---------------- Length (8-byte) 0x10131##                               +---------------- Address (8-byte) 0x5678132##133# DWARF-LE-CONTENT-NEXT:   0050: 00000000 00000000 00000000 00000000134##                               |135##                               +---------------------------------- Terminating entry136##137# DWARF-LE-CONTENT-NEXT: )138 139## Generate and verify a big endian DWARF64 .debug_aranges section.140 141# RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB -DFORMAT=DWARF64 %s -o %t.be.dwarf64.o142# RUN: llvm-readobj --sections --section-data %t.be.dwarf64.o | \143# RUN:   FileCheck -DADDRALIGN=1 -DSIZE=120 %s --check-prefixes=DWARF-HEADER,DWARF64-BE-CONTENT144 145# DWARF64-BE-CONTENT-NEXT: SectionData (146# DWARF64-BE-CONTENT-NEXT:   0000: FFFFFFFF 00000000 0000002C 00020000147##                                 |        |                 |   |148##                                 |        |                 |   +--- CuOffset (8-byte) 0x00149##                                 |        |                 +--- Version (2-byte) 0x02150##                                 |        +---------------- Length (8-byte) 0x2c151##                                 +------- DWARF64 Prefix (4-byte) UINT32_MAX152##153# DWARF64-BE-CONTENT-NEXT:   0010: 00000000 00000400 00001234 00000020154##                                 |            | |  |        |155##                                 |            | |  |        +------- Length (4-byte) 0x20156##                                 |            | |  +------- Address (4-byte) 0x1234157##                                 |            | +- SegSize (1-byte) 0x00158##                                 |            +- AddrSize (1-byte) 0x04159##                                 +------------ Lower bytes of CuOffset160##161# DWARF64-BE-CONTENT-NEXT:   0020: 00000000 00000000 FFFFFFFF 00000000162##                                 |                 |        +------- Length (8-byte) 0x2c163##                                 |                 +------- DWARF64 Prefix164##                                 +---------------- Terminating Entry (8-byte) 0x00165##166# DWARF64-BE-CONTENT-NEXT:   0030: 0000002C 00020000 00000000 00650800167##                                 |        |   |                 | |168##                                 |        |   |                 | +- SegSize (1-byte) 0x00169##                                 |        |   |                 +- AddrSize (1-byte) 0x08170##                                 |        |   +----------------- CuOffset (8-byte) 0x65171##                                 |        +--- Version (2-byte) 0x02172##                                 +------- Lower bytes of Length173##174# DWARF64-BE-CONTENT-NEXT:   0040: 00000000 00000000 00000000 00005678175##                                 |                 |176##                                 |                 +---------------- Address (8-byte) 0x5678177##                                 +---------------- Padding zeros (8-byte)178##179# DWARF64-BE-CONTENT-NEXT:   0050: 00000000 00000020 00000000 56780000180##                                 |                 |181##                                 |                 +---------------- Address (8-byte) 0x56780000182##                                 +---------------- Length (8-byte) 0x20183##184# DWARF64-BE-CONTENT-NEXT:   0060: 00000000 00000010 00000000 00000000185##                                 |                 |186##                                 |                 +---------------- Terminating Entry (16-byte) 0x00187##                                 +---------------- Length (8-byte) 0x10188##189# DWARF64-BE-CONTENT-NEXT:   0070: 00000000 00000000190##                                 |191##                                 +---------------- The last bytes of terminating entry.192# DWARF64-BE-CONTENT-NEXT: )193 194## Generate and verify a little endian DWARF64 .debug_aranges section.195 196# RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2LSB -DFORMAT=DWARF64 %s -o %t.le.dwarf64.o197# RUN: llvm-readobj --sections --section-data %t.le.dwarf64.o | \198# RUN:   FileCheck -DADDRALIGN=1 -DSIZE=120 %s --check-prefixes=DWARF-HEADER,DWARF64-LE-CONTENT199 200# DWARF64-LE-CONTENT-NEXT: SectionData (201# DWARF64-LE-CONTENT-NEXT:   0000: FFFFFFFF 2C000000 00000000 02000000202##                                 |        |                 |   |203##                                 |        |                 |   +--- CuOffset (8-byte) 0x00204##                                 |        |                 +--- Version (2-byte) 0x02205##                                 |        +---------------- Length (8-byte) 0x2c206##                                 +------- DWARF64 Prefix (4-byte) UINT32_MAX207##208# DWARF64-LE-CONTENT-NEXT:   0010: 00000000 00000400 34120000 20000000209##                                 |            | |  |        |210##                                 |            | |  |        +------- Length (4-byte) 0x20211##                                 |            | |  +------- Address (4-byte) 0x1234212##                                 |            | +- SegSize (1-byte) 0x00213##                                 |            +- AddrSize (1-byte) 0x04214##                                 +------------ Lower bytes of CuOffset215##216# DWARF64-LE-CONTENT-NEXT:   0020: 00000000 00000000 FFFFFFFF 2C000000217##                                 |                 |        +------- Length (8-byte) 0x2c218##                                 |                 +------- DWARF64 Prefix219##                                 +---------------- Terminating Entry (8-byte) 0x00220##221# DWARF64-LE-CONTENT-NEXT:   0030: 00000000 02006500 00000000 00000800222##                                 |        |   |                 | |223##                                 |        |   |                 | +- SegSize (1-byte) 0x00224##                                 |        |   |                 +- AddrSize (1-byte) 0x08225##                                 |        |   +----------------- CuOffset (8-byte) 0x65226##                                 |        +--- Version (2-byte) 0x02227##                                 +------- Lower bytes of Length228##229# DWARF64-LE-CONTENT-NEXT:   0040: 00000000 00000000 78560000 00000000230##                                 |                 |231##                                 |                 +---------------- Address (8-byte) 0x5678232##                                 +---------------- Padding zeros (8-byte)233##234# DWARF64-LE-CONTENT-NEXT:   0050: 20000000 00000000 00007856 00000000235##                                 |                 |236##                                 |                 +---------------- Address (8-byte) 0x56780000237##                                 +---------------- Length (8-byte) 0x20238##239# DWARF64-LE-CONTENT-NEXT:   0060: 10000000 00000000 00000000 00000000240##                                 |                 |241##                                 |                 +---------------- Terminating Entry (16-byte) 0x00242##                                 +---------------- Length (8-byte) 0x10243##244# DWARF64-LE-CONTENT-NEXT:   0070: 00000000 00000000245##                                 |246##                                 +---------------- The last bytes of terminating entry.247# DWARF64-LE-CONTENT-NEXT: )248 249## b) Generate the .debug_aranges section from raw section content.250 251# RUN: yaml2obj --docnum=2 %s -o %t2.o252# RUN: llvm-readobj --sections --section-data %t2.o | \253# RUN:   FileCheck %s -DADDRALIGN=0 -DSIZE=3 --check-prefixes=DWARF-HEADER,ARBITRARY-CONTENT254 255#      ARBITRARY-CONTENT: SectionData (256# ARBITRARY-CONTENT-NEXT:   0000: 112233257# ARBITRARY-CONTENT-NEXT: )258 259--- !ELF260FileHeader:261  Class: ELFCLASS64262  Data:  ELFDATA2MSB263  Type:  ET_EXEC264Sections:265  - Name:    .debug_aranges266    Type:    SHT_PROGBITS267    Content: "112233"268 269## c) Generate the .debug_aranges section when the "Size" is specified.270 271# RUN: yaml2obj --docnum=3 %s -o %t3.o272# RUN: llvm-readobj --hex-dump=.debug_aranges %t3.o | FileCheck %s --check-prefix=SIZE273 274#       SIZE: Hex dump of section '.debug_aranges':275#  SIZE-NEXT: 0x00000000 00000000 00000000 00000000 00000000 ................276# SIZE-EMPTY:277 278--- !ELF279FileHeader:280  Class: ELFCLASS64281  Data:  ELFDATA2MSB282  Type:  ET_EXEC283Sections:284  - Name: .debug_aranges285    Type: SHT_PROGBITS286    Size: 0x10287 288## d) Test that yaml2obj emits an error message when both the "Size" and the289## "debug_aranges" entry are specified at the same time.290 291# RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=ERROR292 293# ERROR: yaml2obj: error: cannot specify section '.debug_aranges' contents in the 'DWARF' entry and the 'Content' or 'Size' in the 'Sections' entry at the same time294 295--- !ELF296FileHeader:297  Class: ELFCLASS64298  Data:  ELFDATA2MSB299  Type:  ET_EXEC300Sections:301  - Name: .debug_aranges302    Type: SHT_PROGBITS303    Size: 0x10304DWARF:305  debug_aranges:306    - Length:              0x2c307      Version:             2308      CuOffset:            0309      AddressSize:         0x08310      SegmentSelectorSize: 0x00311      Descriptors:312        - Address: 0x0000000000001234313          Length:  0x20314 315## e) Test that yaml2obj emits an error message when both the "Content" and the316## "debug_aranges" entry are specified at the same time.317 318# RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=ERROR319 320--- !ELF321FileHeader:322  Class: ELFCLASS64323  Data:  ELFDATA2MSB324  Type:  ET_EXEC325Sections:326  - Name:    .debug_aranges327    Type:    SHT_PROGBITS328    Content: "00"329DWARF:330  debug_aranges:331    - Length:              0x2c332      Version:             2333      CuOffset:            0334      AddressSize:         0x08335      SegmentSelectorSize: 0x00336      Descriptors:337        - Address: 0x0000000000001234338          Length:  0x20339 340## f) Test that all the properties can be overridden by the section header when341## the "debug_aranges" entry doesn't exist.342 343# RUN: yaml2obj --docnum=6 %s -o %t6.o344# RUN: llvm-readelf --sections %t6.o | FileCheck %s --check-prefix=OVERRIDDEN345 346#      OVERRIDDEN: [Nr] Name           Type   Address          Off    Size   ES Flg Lk Inf Al347#      OVERRIDDEN: [ 1] .debug_aranges STRTAB 0000000000002020 000050 000030 01   A  2   1  2348# OVERRIDDEN-NEXT: [ 2] .sec           STRTAB 0000000000000000 000080 000000 00      0   0  0349 350--- !ELF351FileHeader:352  Class: ELFCLASS64353  Data:  ELFDATA2MSB354  Type:  ET_EXEC355Sections:356  - Name:         .debug_aranges357    Type:         SHT_STRTAB         # SHT_PROGBITS by default.358    Flags:        [SHF_ALLOC]        # 0 by default.359    Link:         .sec               # 0 by default.360    EntSize:      1                  # 0 by default.361    Info:         1                  # 0 by default.362    AddressAlign: 2                  # 0 by default.363    Address:      0x0000000000002020 # 0x00 by default.364    Offset:       0x00000050         # 0x40 for the first section.365    Size:         0x30               # Set the "Size" so that we can reuse the check tag "OVERRIDDEN".366  - Name:         .sec               # Linked by .debug_aranges.367    Type:         SHT_STRTAB368 369## g) Test that all the properties can be overridden by the section header when370## the "debug_aranges" entry exists.371 372# RUN: yaml2obj --docnum=7 %s -o %t7.o373# RUN: llvm-readelf --sections %t7.o | FileCheck %s --check-prefix=OVERRIDDEN374 375--- !ELF376FileHeader:377  Class: ELFCLASS64378  Data:  ELFDATA2MSB379  Type:  ET_EXEC380Sections:381  - Name:         .debug_aranges382    Type:         SHT_STRTAB         # SHT_PROGBITS by default.383    Flags:        [SHF_ALLOC]        # 0 by default.384    Link:         .sec               # 0 by default.385    EntSize:      1                  # 0 by default.386    Info:         1                  # 0 by default.387    AddressAlign: 2                  # 1 by default.388    Address:      0x0000000000002020 # 0x00 by default.389    Offset:       0x00000050         # 0x40 for the first section.390  - Name:         .sec               # Linked by .debug_aranges.391    Type:         SHT_STRTAB392DWARF:393  debug_aranges:394    - Length:              0x2c395      Version:             2396      CuOffset:            0397      AddressSize:         0x08398      SegmentSelectorSize: 0x00399      Descriptors:400        - Address: 0x0000000000001234401          Length:  0x20402 403## h) Test that yaml2obj still generates a .debug_aranges section if we assign an invalid value404## to 'AddrSize' when the 'Descriptors' list is empty.405 406# RUN: yaml2obj --docnum=8 %s -o %t8.o407# RUN: llvm-readelf --hex-dump=.debug_aranges %t8.o | \408# RUN:   FileCheck %s --check-prefix=ADDR-SIZE409 410#      ADDR-SIZE: Hex dump of section '.debug_aranges':411# ADDR-SIZE-NEXT: 0x00000000 2c000000 02000000 00000700 00000000412##                                                 ^~ address_size (1-byte) 0x07413# ADDR-SIZE-NEXT: 0x00000010 00000000 00000000 00000000414 415--- !ELF416FileHeader:417  Class: ELFCLASS64418  Data:  ELFDATA2LSB419  Type:  ET_EXEC420DWARF:421  debug_aranges:422    - Length:              0x2c423      Version:             2424      CuOffset:            0425      AddressSize:         0x07 ## Invalid address_size.426      SegmentSelectorSize: 0427      Descriptors:         []428 429## i) Test that yaml2obj emits an error message if we try to assign an invalid value to430## 'AddrSize' when the 'Descriptors' list isn't empty.431 432# RUN: not yaml2obj --docnum=9 %s 2>&1 | \433# RUN:   FileCheck %s --check-prefix=INVALID-SIZE434 435# INVALID-SIZE: yaml2obj: error: unable to write debug_aranges address: invalid integer write size: 7436 437--- !ELF438FileHeader:439  Class: ELFCLASS64440  Data:  ELFDATA2LSB441  Type:  ET_EXEC442DWARF:443  debug_aranges:444    - Length:              0x2c445      Version:             2446      CuOffset:            0447      AddressSize:         0x07 ## Invalid address_size.448      SegmentSelectorSize: 0449      Descriptors:450        - Address: 0x1234451          Length:  0x1000452 453## j) Test the default value of address_size and segment_selector_size in a 64/32-bit object file.454 455# RUN: yaml2obj --docnum=10 -DCLASS=ELFCLASS64 %s -o %t10.64-bit.o456# RUN: llvm-readelf --hex-dump=.debug_aranges %t10.64-bit.o | \457# RUN:   FileCheck %s --check-prefix=DEFAULT64458 459#      DEFAULT64: Hex dump of section '.debug_aranges':460# DEFAULT64-NEXT: 0x00000000 2c000000 02000000 00000800 00000000 ,...............461##                           ^-------                            unit_length (4-byte)462##                                    ^---                       version (2-byte)463##                                        ^--------              debug_info_offset (4-byte)464##                                                 ^-            address_size (1-byte)465##                                                   ^-          segment_selector_size (1-byte)466##                                                      ^------- padding (4-byte)467# DEFAULT64-NEXT: 0x00000010 34120000 00000000 00100000 00000000 4...............468##                           ^----------------                   address (8-byte)469##                                             ^---------------- length (8-byte)470# DEFAULT64-NEXT: 0x00000020 00000000 00000000 00000000 00000000 ................471##                           ^---------------------------------- terminating entry (16-byte)472 473# RUN: yaml2obj --docnum=10 -DCLASS=ELFCLASS32 %s -o %t10.32-bit.o474# RUN: llvm-readelf --hex-dump=.debug_aranges %t10.32-bit.o | \475# RUN:   FileCheck %s --check-prefix=DEFAULT32476 477#      DEFAULT32: Hex dump of section '.debug_aranges':478# DEFAULT32-NEXT: 0x00000000 2c000000 02000000 00000400 00000000 ,...............479##                           ^-------                            unit_length (4-byte)480##                                    ^---                       version (2-byte)481##                                        ^--------              debug_info_offset (4-byte)482##                                                 ^-            address_size (1-byte)483##                                                   ^-          segment_selector_size (1-byte)484##                                                      ^------- padding (4-byte)485# DEFAULT32-NEXT: 0x00000010 34120000 00100000 00000000 00000000 4...............486##                           ^-------                            address (4-byte)487##                                    ^-------                   length (4-byte)488##                                             ^---------------- terminating entry (8-byte)489 490--- !ELF491FileHeader:492  Class: [[CLASS]]493  Data:  ELFDATA2LSB494  Type:  ET_EXEC495DWARF:496  debug_aranges:497    - Length:              0x2c498      Version:             2499      CuOffset:            0500      Descriptors:501        - Address: 0x1234502          Length:  0x1000503 504## k) Test that yaml2obj is able to determine the correct length for the address range table505## if the 'Length' field isn't specified.506 507# RUN: yaml2obj --docnum=11 -DCLASS=ELFCLASS64 -DADDRSIZE=4 %s -o %t11.64-bit.o508# RUN: llvm-readelf --hex-dump=.debug_aranges %t11.64-bit.o | \509# RUN:   FileCheck %s --check-prefix=LENGTH64510 511#      LENGTH64: Hex dump of section '.debug_aranges':512# LENGTH64-NEXT: 0x00000000 2c000000 02000000 00000800 00000000 ,...............513##                          ^-------                            unit_length (4-byte)514##                                   ^---                       version (2-byte)515##                                       ^--------              debug_info_offset (4-byte)516##                                                ^-            address_size (1-byte)517##                                                  ^-          segment_selector_size (1-byte)518##                                                     ^------- padding (4-byte)519# LENGTH64-NEXT: 0x00000010 34120000 00000000 00100000 00000000 4...............520##                          ^----------------                   address (8-byte)521##                                            ^---------------- length (8-byte)522# LENGTH64-NEXT: 0x00000020 00000000 00000000 00000000 00000000 ................523##                          ^---------------------------------- terminating entry (16-byte)524# LENGTH64-NEXT: 0x00000030 ffffffff 1c000000 00000000 02000000 ................525##                          ^-------------------------          unit_length (12-byte)526##                                                     ^---     version (2-byte)527##                                                         ^--- debug_info_offset (8-byte)528# LENGTH64-NEXT: 0x00000040 00000000 00000400 34120000 21430000 ........4...!C..529##                          -------------530##                                       ^-                     address_size (1-byte)531##                                         ^-                   segment_selector_size (1-byte)532##                                            ^-------          address (4-byte)533##                                                     ^------- length (4-byte)534# LENGTH64-NEXT: 0x00000050 00000000 00000000                   ........535##                          ^----------------                   terminating entry (8-byte)536 537# RUN: yaml2obj --docnum=11 -DCLASS=ELFCLASS32 -DADDRSIZE=8 %s -o %t11.32-bit.o538# RUN: llvm-readelf --hex-dump=.debug_aranges %t11.32-bit.o | \539# RUN:   FileCheck %s --check-prefix=LENGTH32540 541#      LENGTH32: Hex dump of section '.debug_aranges':542# LENGTH32-NEXT: 0x00000000 1c000000 02000000 00000400 00000000 ................543##                          ^-------                            unit_length (4-byte)544##                                   ^---                       version (2-byte)545##                                       ^--------              debug_info_offset (4-byte)546##                                                ^-            address_size (1-byte)547##                                                  ^-          segment_selector_size (1-byte)548##                                                     ^------- padding (4-byte)549# LENGTH32-NEXT: 0x00000010 34120000 00100000 00000000 00000000 4...............550##                          ^-------                            address (4-byte)551##                                   ^-------                   length (4-byte)552##                                            ^---------------- terminating entry (8-byte)553# LENGTH32-NEXT: 0x00000020 ffffffff 34000000 00000000 02000000 ....4...........554##                          ^-------------------------          unit_length (12-byte)555##                                                     ^---     version (2-byte)556##                                                         ^--- debug_info_offset (8-byte)557# LENGTH32-NEXT: 0x00000030 00000000 00000800 00000000 00000000 ................558##                          -------------559##                                       ^-                     address_size (1-byte)560##                                         ^-                   segment_selector_size (1-byte)561##                                            ^---------------- padding (8-byte)562# LENGTH32-NEXT: 0x00000040 34120000 00000000 21430000 00000000 4.......!C......563##                          ^----------------                   address (8-byte)564##                                            ^---------------- length (8-byte)565# LENGTH32-NEXT: 0x00000050 00000000 00000000 00000000 00000000 ................566##                          ^---------------------------------- terminating entry (16-byte)567 568--- !ELF569FileHeader:570  Class: [[CLASS]]571  Data:  ELFDATA2LSB572  Type:  ET_EXEC573DWARF:574  debug_aranges:575    - Version:  2576      CuOffset: 0577      Descriptors:578        - Address: 0x1234579          Length:  0x1000580    - Format:      DWARF64581      Version:     2582      AddressSize: [[ADDRSIZE]]583      CuOffset:    0584      Descriptors:585        - Address: 0x1234586          Length:  0x4321587 588## l) Test that the .debug_aranges section header is emitted if the "debug_aranges"589## entry is empty.590 591# RUN: yaml2obj --docnum=12 %s -o %t12.o592# RUN: llvm-readobj --sections --section-data %t12.o | \593# RUN:   FileCheck -DSIZE=0 -DADDRALIGN=1 %s --check-prefixes=DWARF-HEADER,EMPTY-CONTENT594 595# EMPTY-CONTENT-NEXT: SectionData (596# EMPTY-CONTENT-NEXT: )597 598--- !ELF599FileHeader:600  Class: ELFCLASS64601  Data:  ELFDATA2LSB602  Type:  ET_EXEC603DWARF:604  debug_aranges: []605