sections-ext.test 3.93 KB
## This is a test case for --section-symbols, --section-relocations and
## --section-data command line flags and their aliases.

# RUN: llvm-readobj -S --st --sr --sd %p/Inputs/trivial.obj.elf-i386

## Check the two-letter aliases above (--st, --sr, --sd) are equivalent to their
## full flag names.

# RUN: llvm-readobj -S --st %p/Inputs/trivial.obj.elf-i386 > %t.readobj-st-alias
# RUN: llvm-readobj -S --section-symbols %p/Inputs/trivial.obj.elf-i386 > %t.readobj-st-no-alias
# RUN: diff %t.readobj-st-alias %t.readobj-st-no-alias

# RUN: llvm-readobj -S --sr %p/Inputs/trivial.obj.elf-i386 > %t.readobj-sr-alias
# RUN: llvm-readobj -S --section-relocations %p/Inputs/trivial.obj.elf-i386 > %t.readobj-sr-no-alias
# RUN: diff %t.readobj-sr-alias %t.readobj-sr-no-alias

# RUN: llvm-readobj -S --sd %p/Inputs/trivial.obj.elf-i386 > %t.readobj-sd-alias
# RUN: llvm-readobj -S --section-data %p/Inputs/trivial.obj.elf-i386 > %t.readobj-sd-no-alias
# RUN: diff %t.readobj-sd-alias %t.readobj-sd-no-alias

# CHECK:      Sections [
# CHECK-NEXT:   Section {
# CHECK-NEXT:     Index: 0
# CHECK-NEXT:     Name:  (0)
# CHECK-NEXT:     Type: SHT_NULL (0x0)
# CHECK-NEXT:     Flags [ (0x0)
# CHECK-NEXT:     ]
# CHECK-NEXT:     Address: 0x0
# CHECK-NEXT:     Offset: 0x0
# CHECK-NEXT:     Size: 0
# CHECK-NEXT:     Link: 0
# CHECK-NEXT:     Info: 0
# CHECK-NEXT:     AddressAlignment: 0
# CHECK-NEXT:     EntrySize: 0
# CHECK-NEXT:     Relocations [
# CHECK-NEXT:     ]
# CHECK-NEXT:     Symbols [
# CHECK-NEXT:     ]
# CHECK-NEXT:     SectionData (
# CHECK-NEXT:     )
# CHECK-NEXT:   }
# CHECK-NEXT:   Section {
# CHECK-NEXT:     Index: 1
# CHECK-NEXT:     Name: .text (5)
# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
# CHECK-NEXT:     Flags [ (0x6)
# CHECK-NEXT:       SHF_ALLOC (0x2)
# CHECK-NEXT:       SHF_EXECINSTR (0x4)
# CHECK-NEXT:     ]
# CHECK-NEXT:     Address: 0x0
# CHECK-NEXT:     Offset: 0x40
# CHECK-NEXT:     Size: 42
# CHECK-NEXT:     Link: 0
# CHECK-NEXT:     Info: 0
# CHECK-NEXT:     AddressAlignment: 16
# CHECK-NEXT:     EntrySize: 0
# CHECK-NEXT:     Relocations [
# CHECK-NEXT:     ]
# CHECK-NEXT:     Symbols [
# CHECK-NEXT:       Symbol {
# CHECK-NEXT:         Name: .text (0)
# CHECK-NEXT:         Value: 0x0
# CHECK-NEXT:         Size: 0
# CHECK-NEXT:         Binding: Local (0x0)
# CHECK-NEXT:         Type: Section (0x3)
# CHECK-NEXT:         Other: 0
# CHECK-NEXT:         Section: .text (0x1)
# CHECK-NEXT:       }
# CHECK-NEXT:       Symbol {
# CHECK-NEXT:         Name: main (12)
# CHECK-NEXT:         Value: 0x0
# CHECK-NEXT:         Size: 42
# CHECK-NEXT:         Binding: Global (0x1)
# CHECK-NEXT:         Type: Function (0x2)
# CHECK-NEXT:         Other: 0
# CHECK-NEXT:         Section: .text (0x1)
# CHECK-NEXT:       }
# CHECK-NEXT:     ]
# CHECK-NEXT:     SectionData (
# CHECK-NEXT:       0000: 5383EC08 E8000000 005B81C3 03000000  |S........[......|
# CHECK-NEXT:       0010: 8D830000 00008904 24E8FCFF FFFFE8FC  |........$.......|
# CHECK-NEXT:       0020: FFFFFF31 C083C408 5BC3               |...1....[.|
# CHECK-NEXT:     )
# CHECK-NEXT:   }
# CHECK-NEXT:   Section {
# CHECK-NEXT:     Index: 2
# CHECK-NEXT:     Name: .rel.text (1)
# CHECK-NEXT:     Type: SHT_REL (0x9)
# CHECK-NEXT:     Flags [ (0x0)
# CHECK-NEXT:     ]
# CHECK-NEXT:     Address: 0x0
# CHECK-NEXT:     Offset: 0x360
# CHECK-NEXT:     Size: 32
# CHECK-NEXT:     Link: 8
# CHECK-NEXT:     Info: 1
# CHECK-NEXT:     AddressAlignment: 4
# CHECK-NEXT:     EntrySize: 8
# CHECK-NEXT:     Relocations [
# CHECK-NEXT:       0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0
# CHECK-NEXT:       0x12 R_386_GOTOFF .L.str 0x0
# CHECK-NEXT:       0x1A R_386_PLT32 puts 0x0
# CHECK-NEXT:       0x1F R_386_PLT32 SomeOtherFunction 0x0
# CHECK-NEXT:     ]
# CHECK-NEXT:     Symbols [
# CHECK-NEXT:     ]
# CHECK-NEXT:     SectionData (
# CHECK-NEXT:       0000: 0C000000 0A0A0000 12000000 09020000  |................|
# CHECK-NEXT:       0010: 1A000000 040B0000 1F000000 04090000  |................|
# CHECK-NEXT:     )
# CHECK-NEXT:   }