reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
## Test that --section works correctly for -d with -r.
# RUN: yaml2obj %s -o %t.o

## Show that only the specified sections are disassembled.
## Also show that no relocation sections are dumped because none are
## specified.
# RUN: llvm-objdump -d -r %t.o --section=.text --section=.rodata \
# RUN:   | FileCheck %s --check-prefixes=DISASM,RELOC --implicit-check-not=.text2

# DISASM:       Disassembly of section .text:
# DISASM-EMPTY:
# DISASM-NEXT:  0000000000000400 .text:
# DISASM-NEXT:  400: e8 00 00 00 00                callq   0 <.text+0x5>
# RELOC-NEXT:                      00000401:  R_X86_64_PC32        foo+1
# RELOC-NEXT:                      00000401:  R_X86_64_GOT32       foo
# DISASM:       Disassembly of section .rodata:
# DISASM-EMPTY:
# DISASM-NEXT:  0000000000000000 .rodata:
# DISASM-NEXT:  0: 00 00                           addb    %al, (%rax)
# RELOC-NEXT:              0000000000000000:  R_X86_64_NONE        foo
# DISASM-NEXT:  2: 00 00                           addb    %al, (%rax)

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Name:         .text
    Type:         SHT_PROGBITS
    Flags:        [SHF_ALLOC, SHF_EXECINSTR]
    Address:      0x400
    AddressAlign: 0x10
    Content:      'e800000000'
  - Name:         .text2
    Type:         SHT_PROGBITS
    Flags:        [SHF_ALLOC, SHF_EXECINSTR]
    Address:      0x401
    Content:      '90e800000000'
  - Name:         .rela.text
    Type:         SHT_RELA
    Info:         .text
    Relocations:
      - Offset: 1
        Symbol: foo
        Addend: 1
        Type:   R_X86_64_PC32
  - Name:         .another.rela.text
    Type:         SHT_RELA
    Info:         .text
    Relocations:
      - Offset: 1
        Symbol: foo
        Type:   R_X86_64_GOT32
  - Name:         .rela.text2
    Type:         SHT_RELA
    Info:         .text2
    Relocations:
      - Offset: 1
        Symbol: foo
        Addend: 2
        Type:   R_X86_64_PLT32
  - Name:       .rodata
    Type:       SHT_PROGBITS
    Flags:      [SHF_ALLOC]
    Size:       4
  - Name:       .rela.rodata
    Type:       SHT_RELA
    Info:       .rodata
    Relocations:
      - Offset: 0
        Symbol: foo
        Type: R_X86_64_NONE
Symbols:
  - Name: foo

## Test that --section works when dumping relocation sections.
# RUN: llvm-objdump -r %t.o --section=.another.rela.text --section=.rela.rodata \
# RUN:   | FileCheck %s --check-prefix=DUMP-RELOCS --implicit-check-not=R_X86_64 \
# RUN:                  --implicit-check-not="RELOCATION RECORDS"

# DUMP-RELOCS: RELOCATION RECORDS FOR [.text]:
# DUMP-RELOCS: 00000001 R_X86_64_GOT32 foo
# DUMP-RELOCS: RELOCATION RECORDS FOR [.rodata]:
# DUMP-RELOCS: 00000000 R_X86_64_NONE foo

## Test that --section works with --full-contents.
# RUN: llvm-objdump -s %t.o --section=.text --section=.rela.text2 \
# RUN:   | FileCheck %s --check-prefix=CONTENTS \
# RUN:                  --implicit-check-not=.text \
# RUN:                  --implicit-check-not=.rodata

# CONTENTS: Contents of section .text:
# CONTENTS: Contents of section .rela.text2: