brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.7 KiB · 6f0912e Raw
200 lines · plain
1## This test checks warning messages if --start-address/--stop-address2## do not intersect with address ranges of sections that have the SHF_ALLOC3## flag.4 5# RUN: yaml2obj --docnum=1 %s -o %t6# RUN: yaml2obj --docnum=2 %s -o %t.27# RUN: yaml2obj --docnum=3 %s -o %t.o8# RUN: yaml2obj --docnum=4 %s -o %t.39 10## Warn if no section covers any part of the specified range.11 12## - Section ends at start of range:13##           | range |14## | section |15# RUN: llvm-objdump --file-headers --start-address=0x1004 --stop-address=0x1006 %t 2>&1 \16# RUN:   | FileCheck %s --check-prefix=WARN17 18## - Range is between two sections:19##             | range |20## | section |           | section |21# RUN: llvm-objdump --file-headers --start-address=0x1005 --stop-address=0x1006 %t 2>&1 \22# RUN:   | FileCheck %s --check-prefix=WARN23 24## - Range appears after any section:25##                  | range |26## | section |27# RUN: llvm-objdump --file-headers --start-address=0x1405 --stop-address=0x1406 %t 2>&1 \28# RUN:   | FileCheck %s --check-prefix=WARN29 30## - Range starts at 0. (--start-address defaults to 0).31# RUN: llvm-objdump --file-headers --stop-address=0x1000 %t 2>&1 \32# RUN:   | FileCheck %s --check-prefix=WARN-STOP-ONLY33 34## - Range ends at UINT64_MAX. (--stop-address defaults to UINT64_MAX)35# RUN: llvm-objdump --file-headers --start-address=0x1500 %t 2>&1 \36# RUN:   | FileCheck %s --check-prefix=WARN-START-ONLY37 38## No warning if a section covers at least part of the specified range.39 40## - Ranges are identical:41## | range   |42## | section |43# RUN: llvm-objdump --file-headers --start-address=0x1000 --stop-address=0x1004 %t 2>&1 \44# RUN:   | FileCheck %s --implicit-check-not=warning:45 46## - Range is entirely within section:47##  | range |48## | section |49# RUN: llvm-objdump --file-headers --start-address=0x1001 --stop-address=0x1003 %t 2>&1 \50# RUN:   | FileCheck %s --implicit-check-not=warning:51 52## - Section is entirely within range:53## |   range   |54##  | section |55# RUN: llvm-objdump --file-headers --start-address=0xfff --stop-address=0x1005 %t 2>&1 \56# RUN:   | FileCheck %s --implicit-check-not=warning:57 58## - Section and range share same start, section larger:59## | range |60## | section |61# RUN: llvm-objdump --file-headers --start-address=0x1000 --stop-address=0x1003 %t 2>&1 \62# RUN:   | FileCheck %s --implicit-check-not=warning:63 64## - Section and range share same start, range larger:65## | range        |66## | section |67# RUN: llvm-objdump --file-headers --start-address=0x1000 --stop-address=0x1005 %t 2>&1 \68# RUN:   | FileCheck %s --implicit-check-not=warning:69 70## - Section and range share same end, section larger:71##   | range |72## | section |73# RUN: llvm-objdump --file-headers --start-address=0x1001 --stop-address=0x1004 %t 2>&1 \74# RUN:   | FileCheck %s --implicit-check-not=warning:75 76## - Section and range share same end, range larger:77## | range    |78##  | section |79# RUN: llvm-objdump --file-headers --start-address=0xfff --stop-address=0x1004 %t 2>&1 \80# RUN:   | FileCheck %s --implicit-check-not=warning:81 82## - Section and range partially overlap, range first:83## | range |84##   | section |85# RUN: llvm-objdump --file-headers --start-address=0xfff --stop-address=0x1003 %t 2>&1 \86# RUN:   | FileCheck %s --implicit-check-not=warning:87 88## - Section and range partially overlap, section first:89##       | range |90## | section |91# RUN: llvm-objdump --file-headers --start-address=0x1001 --stop-address=0x1005 %t 2>&1 \92# RUN:   | FileCheck %s --implicit-check-not=warning:93 94## - Range starts before first section and ends after second:95## |            range               |96##   | section |    | section |97# RUN: llvm-objdump --file-headers --start-address=0xfff --stop-address=0x1405 %t 2>&1 \98# RUN:   | FileCheck %s --implicit-check-not=warning:99 100## Warn only for the input file that does not have the specified range.101# RUN: llvm-objdump --file-headers --start-address=0x2001 --stop-address=0x2005 %t %t.2 2>&1 \102# RUN:   | FileCheck %s --check-prefix=MULTI-INPUT103 104## Warn if the specified range is in a segment but not in any section.105# RUN: llvm-objdump --file-headers --start-address=0x1008 --stop-address=0x1009 %t 2>&1 \106# RUN:   | FileCheck %s --check-prefix=WARN107 108## Warning for --start-address/--stop-address works regardless of the other options used including --section.109# RUN: llvm-objdump --syms --section=.text2 --start-address=0x1004 --stop-address=0x1005 %t 2>&1 \110# RUN:   | FileCheck %s --check-prefix=WARN111 112## Sections without the SHF_ALLOC flag are ignored in address range calculation.113# RUN: llvm-objdump --file-headers --start-address=0x1 --stop-address=0x3 %t.3 2>&1 \114# RUN:   | FileCheck %s --check-prefix=WARN115 116## No warning for relocatable objects.117# RUN: llvm-objdump --file-headers --start-address=0x1004 --stop-address=0x1005 %t.o 2>&1 \118# RUN:   | FileCheck %s --implicit-check-not=warning:119 120## No warning if neither --start-address nor --stop-address are specified.121# RUN: llvm-objdump --file-headers %t 2>&1 | FileCheck %s --implicit-check-not=warning:122 123# WARN: warning: {{.*}}: no section overlaps the range {{.*}} specified by --start-address/--stop-address124# WARN-STOP-ONLY: warning: {{.*}}: no section has address less than 0x1000 specified by --stop-address125# WARN-START-ONLY: warning: {{.*}}: no section has address greater than or equal to 0x1500 specified by --start-address126 127# MULTI-INPUT: file format128# MULTI-INPUT: warning: {{.*}}: no section overlaps the range [0x2001,0x2005) specified by --start-address/--stop-address129# MULTI-INPUT: file format130# MULTI-INPUT-NOT: warning:131 132--- !ELF133FileHeader:134  Class:   ELFCLASS64135  Data:    ELFDATA2LSB136  Type:    ET_EXEC137  Machine: EM_X86_64138Sections:139  - Name:    .text140    Type:    SHT_PROGBITS141    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]142    Address: 0x1000143    Size:    4144  - Name:    .text2145    Type:    SHT_PROGBITS146    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]147    Address: 0x1400148    Size:    4149ProgramHeaders:150  - Type:     PT_LOAD151    Flags:    [ PF_X, PF_R ]152    VAddr:    0x1000153    FileSize: 0x500154    FirstSec: .text155    LastSec:  .text2156 157--- !ELF158FileHeader:159  Class:   ELFCLASS64160  Data:    ELFDATA2LSB161  Type:    ET_DYN162  Machine: EM_X86_64163Sections:164  - Name:    .text165    Type:    SHT_PROGBITS166    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]167    Address: 0x2000168    Size:    4169ProgramHeaders:170  - Type:     PT_LOAD171    Flags:    [ PF_X, PF_R ]172    VAddr:    0x1000173    FileSize: 0x4174    FirstSec: .text175    LastSec:  .text176 177--- !ELF178FileHeader:179  Class:   ELFCLASS64180  Data:    ELFDATA2LSB181  Type:    ET_REL182  Machine: EM_X86_64183Sections:184  - Name:    .text185    Type:    SHT_PROGBITS186    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]187    Address: 0x1000188    Size:    4189 190--- !ELF191FileHeader:192  Class:   ELFCLASS64193  Data:    ELFDATA2LSB194  Type:    ET_DYN195  Machine: EM_X86_64196Sections:197  - Name:    .non.alloc198    Type:    SHT_PROGBITS199    Size:    2200