Home | History | Annotate | Download | only in llvm-objcopy
      1 # RUN: yaml2obj %s > %t
      2 
      3 # RUN: rm -f %t.a
      4 # RUN: llvm-ar crs %t.a %t
      5 # RUN: cp %t.a %t.copy.a
      6 # RUN: llvm-objcopy %t.a %t2.a
      7 # RUN: llvm-objcopy %t %t2
      8 # RUN: llvm-ar p %t2.a > %t3
      9 # RUN: cmp %t2 %t3
     10 
     11 # RUN: llvm-readobj -sections %t2 | FileCheck %s
     12 # RUN: llvm-nm -print-armap %t.a | FileCheck --check-prefix=INDEX-TABLE %s
     13 # RUN: llvm-nm -print-armap %t2.a | FileCheck --check-prefix=INDEX-TABLE %s
     14 # Verify that llvm-objcopy has not modifed the input.
     15 # RUN: cmp %t.copy.a %t.a
     16 
     17 # INDEX-TABLE: Archive map
     18 # INDEX-TABLE-NEXT: foo in
     19 
     20 # RUN: rm -f %t.no.index.a
     21 # RUN: llvm-ar crS %t.no.index.a %t
     22 # RUN: llvm-objcopy %t.no.index.a %t2.no.index.a
     23 # RUN: llvm-ar p %t2.no.index.a > %t4
     24 
     25 # RUN: llvm-nm -print-armap %t.no.index.a | FileCheck --check-prefix=NO-INDEX-TABLE %s
     26 # RUN: llvm-nm -print-armap %t2.no.index.a | FileCheck --check-prefix=NO-INDEX-TABLE %s
     27 # RUN: cmp %t2 %t4
     28 
     29 # NO-INDEX-TABLE-NOT: Archive map
     30 # NO-INDEX-TABLE-NOT: foo in
     31 
     32 !ELF
     33 FileHeader:
     34   Class:           ELFCLASS64
     35   Data:            ELFDATA2LSB
     36   Type:            ET_EXEC
     37   Machine:         EM_X86_64
     38 Sections:
     39   - Name:            .bss
     40     Type:            SHT_NOBITS
     41     Flags:           [ SHF_ALLOC ]
     42     AddressAlign:    0x0000000000000010
     43     Size:            64
     44   - Name:            .text
     45     Type:            SHT_PROGBITS
     46     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
     47     AddressAlign:    0x0000000000000010
     48     Content:         "00000000"
     49 Symbols:
     50    Global:
     51      - Name:     foo
     52        Type:     STT_FUNC
     53        Section:  .text
     54        Value:    0x1004
     55 
     56 # CHECK: Type: SHT_NULL
     57 
     58 # CHECK:      Name: .bss
     59 # CHECK-NEXT: Type: SHT_NOBITS
     60 # CHECK-NEXT: Flags [
     61 # CHECK-NEXT:   SHF_ALLOC
     62 # CHECK-NEXT: ]
     63 # CHECK-NEXT: Address:
     64 # CHECK-NEXT: Offset:
     65 # CHECK-NEXT: Size: 64
     66 
     67 # CHECK:      Name: .text
     68 # CHECK-NEXT: Type: SHT_PROGBITS
     69 # CHECK-NEXT: Flags [
     70 # CHECK-NEXT:   SHF_ALLOC
     71 # CHECK-NEXT:   SHF_EXECINSTR
     72 # CHECK-NEXT: ]
     73 # CHECK-NEXT: Address:
     74 # CHECK-NEXT: Offset:
     75 # CHECK-NEXT: Size: 4
     76 
     77 # CHECK:      Name: .symtab
     78 # CHECK-NEXT: Type: SHT_SYMTAB
     79 # CHECK-NEXT: Flags [ (0x0)
     80 # CHECK-NEXT: ]
     81 # CHECK-NEXT: Address:
     82 # CHECK-NEXT: Offset:
     83 # CHECK-NEXT: Size: 48
     84 
     85 # CHECK:      Name: .strtab
     86 # CHECK-NEXT: Type: SHT_STRTAB
     87 # CHECK-NEXT: Flags [ (0x0)
     88 # CHECK-NEXT: ]
     89 # CHECK-NEXT: Address:
     90 # CHECK-NEXT: Offset:
     91 # CHECK-NEXT: Size: 6
     92 
     93 # CHECK:      Name: .shstrtab
     94 # CHECK-NEXT: Type: SHT_STRTAB
     95 # CHECK-NEXT: Flags [
     96 # CHECK-NEXT: ]
     97 # CHECK-NEXT: Address:
     98 # CHECK-NEXT: Offset:
     99 # CHECK-NEXT: Size: 38
    100