brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.3 KiB · d961fe7 Raw
187 lines · plain
1## Evaluates the hex writer behavior with empty sections and segments.2##3## Show that the presence of an empty section placed at the same address of a4## filled section doesn't affect the hex output. Also, show that the presence of5## an empty section placed behind the filled section doesn't affect the hex6## output. And, show that this happens regardless of the section ordering in the7## section header table. (Two filled sections, and four empty sections, to8## realize this test.)9##10## Then, show the same kind of behaviors for segments. (One filled section, four11## empty sections, each in a single segment.)12 13# RUN: yaml2obj %s -o %t14# RUN: llvm-objcopy -O ihex %t - | FileCheck %s --implicit-check-not={{.}}15 16## .data0 address17# CHECK:         :0200000433339418## .data0 offset, contents, checksum19# CHECK-NEXT:    :020000000123DA20 21## .data1 address22# CHECK-NEXT:    :0200000444447223## .data1 offset, contents, checksum24# CHECK-NEXT:    :0200000045675225 26## .data2 address27# CHECK-NEXT:    :0200000477770C28## .data2 offset, contents, checksum29# CHECK-NEXT:    :0200000089ABCA30 31## End of file32# CHECK-NEXT:    :00000001FF33 34--- !ELF35FileHeader:36  Class:           ELFCLASS3237  Data:            ELFDATA2LSB38  Type:            ET_EXEC39  Machine:         EM_ARM40Sections:41## An empty section that's placed at the same address as a populated section.42## This won't be in the output. It also won't affect how the subsequent section43## is written.44  - Name:          .empty_at_data045    Type:          SHT_PROGBITS46    Flags:         [ SHF_ALLOC ]47    Address:       0x3333000048    Size:          049## A section populated with data. This is in the output.50  - Name:          .data051    Type:          SHT_PROGBITS52    Flags:         [ SHF_ALLOC ]53    Address:       0x3333000054    Content:       "0123"55## An empty section that's placed at the end of .data0. This won't be in the56## output.57  - Name:          .empty_behind_data058    Type:          SHT_PROGBITS59    Flags:         [ SHF_ALLOC ]60    Address:       0x3333000261    Size:          062## An empty section declared before .data1, but placed behind .data1. This63## won't be in the output.64  - Name:          .empty_behind_data165    Type:          SHT_PROGBITS66    Flags:         [ SHF_ALLOC ]67    Address:       0x4444000268    Size:          069## A section populated with data. This is in the output.70  - Name:          .data171    Type:          SHT_PROGBITS72    Flags:         [ SHF_ALLOC ]73    Address:       0x4444000074    Content:       "4567"75## An empty section declared after .data1, but placed at the start of .data1.76## This won't be in the output.77  - Name:          .empty_at_data178    Type:          SHT_PROGBITS79    Flags:         [ SHF_ALLOC ]80    Address:       0x4444000081    Size:          082## An empty section that's isolated (by address) from all others. This won't be83## in the output.84  - Name:         .empty_isolated85    Type:         SHT_PROGBITS86    Flags:        [ SHF_ALLOC ]87    Address:      0x7FFFFFFF88    AddressAlign: 0x189    Size:         090## The sections below are placed into segments of varying configurations.91## Populated section in its own segment. This is in the output.92  - Name:          .data293    Type:          SHT_PROGBITS94    Flags:         [ SHF_ALLOC ]95    Address:       0x7777000096    Content:       "89AB"97## Empty section in its own segment. That segment is declared before the .data298## segment in the program headers, and placed at an address just behind .data2.99## This won't be in the output.100  - Name:          .empty0101    Type:          SHT_PROGBITS102    Flags:         [ SHF_ALLOC ]103    Address:       0x88880000104    Size:          0105## Empty section in its own segment. That segment is declared before the .data2106## segment in the program headers, and placed at the same address as .data2.107## This won't be in the output.108  - Name:          .empty1109    Type:          SHT_PROGBITS110    Flags:         [ SHF_ALLOC ]111    Address:       0x99990000112    Size:          0113## Empty section in its own segment. That segment is declared after the .data2114## segment in the program headers, and placed at the same address as .data2.115## This won't be in the output.116  - Name:          .empty2117    Type:          SHT_PROGBITS118    Flags:         [ SHF_ALLOC ]119    Address:       0xAAAA0000120    Size:          0121## Empty section in its own segment. That segment is declared after the .data2122## segment in the program headers, and placed at an address just behind .data2.123## This won't be in the output.124  - Name:          .empty3125    Type:          SHT_PROGBITS126    Flags:         [ SHF_ALLOC ]127    Address:       0xBBBB0000128    Size:          0129ProgramHeaders:130## .data0 sections, with empty bookends.131  - Type:          PT_LOAD132    Flags:         [ PF_R ]133    PAddr:         0x33330000134    VAddr:         0x33330000135    FirstSec:      .empty_at_data0136    LastSec:       .empty_behind_data0137## .data1 sections, with empty bookends.138  - Type:          PT_LOAD139    Flags:         [ PF_R ]140    PAddr:         0x44440000141    VAddr:         0x44440000142    FirstSec:      .empty_behind_data1143    LastSec:       .empty_at_data1144## .empty_isolated section.145  - Type:          PT_LOAD146    Flags:         [ PF_R ]147    PAddr:         0x7FFFFFFF148    VAddr:         0x7FFFFFFF149    FirstSec:      .empty_isolated150    LastSec:       .empty_isolated151## Segments below include a single empty segment, and are positioned around152## .data2 in various ways.  Declared before, placed behind .data2 segment.153  - Type:          PT_LOAD154    Flags:         [ PF_R ]155    PAddr:         0x77770002156    VAddr:         0x77770002157    FirstSec:      .empty0158    LastSec:       .empty0159## Declared before, placed at .data2 segment.160  - Type:          PT_LOAD161    Flags:         [ PF_R ]162    PAddr:         0x77770000163    VAddr:         0x77770000164    FirstSec:      .empty1165    LastSec:       .empty1166## Segment for .data2.167  - Type:          PT_LOAD168    Flags:         [ PF_R ]169    PAddr:         0x77770000170    VAddr:         0x77770000171    FirstSec:      .data2172    LastSec:       .data2173## Declared after, placed at .data2 segment.174  - Type:          PT_LOAD175    Flags:         [ PF_R ]176    PAddr:         0x77770000177    VAddr:         0x77770000178    FirstSec:      .empty2179    LastSec:       .empty2180## Declared after, placed behind .data2 segment.181  - Type:          PT_LOAD182    Flags:         [ PF_R ]183    PAddr:         0x77770002184    VAddr:         0x77770002185    FirstSec:      .empty3186    LastSec:       .empty3187