Home | History | Annotate | Download | only in llvm-objcopy
      1 # RUN: yaml2obj %s > %t
      2 # RUN: llvm-objcopy --redefine-sym foo=oof --redefine-sym empty= %t %t2
      3 # RUN: llvm-readobj -symbols %t2 | FileCheck %s
      4 # RUN: not llvm-objcopy --redefine-sym barbar %t %t2 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT
      5 # RUN: not llvm-objcopy --redefine-sym foo=f1 --redefine-sym foo=f2 %t %t2 2>&1 | FileCheck %s --check-prefix=MULTIPLE-REDEFINITION
      6 
      7 !ELF
      8 FileHeader:
      9   Class:           ELFCLASS64
     10   Data:            ELFDATA2LSB
     11   Type:            ET_EXEC
     12   Machine:         EM_X86_64
     13 Sections:
     14   - Name:            .text
     15     Type:            SHT_PROGBITS
     16     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
     17     Address:         0x1000
     18     AddressAlign:    0x0000000000000010
     19     Content:         "0000000000000000"
     20   - Name:            .data
     21     Type:            SHT_PROGBITS
     22     Flags:           [ SHF_ALLOC ]
     23     Address:         0x2000
     24     AddressAlign:    0x0000000000000010
     25     Content:         "0000000000000000"
     26 Symbols:
     27   Global:
     28     - Name:     foo
     29       Type:     STT_FUNC
     30       Section:  .text
     31       Value:    0x1004
     32     - Name:     bar
     33       Type:     STT_OBJECT
     34       Section:  .data
     35       Value:    0x2000
     36       Size:     4
     37     - Name:     empty
     38       Type:     STT_FUNC
     39       Section:  .text
     40       Value:    0x1008
     41 
     42 #CHECK: Symbols [
     43 #CHECK-NEXT:  Symbol {
     44 #CHECK-NEXT:    Name:
     45 #CHECK-NEXT:    Value: 0x0
     46 #CHECK-NEXT:    Size: 0
     47 #CHECK-NEXT:    Binding: Local
     48 #CHECK-NEXT:    Type: None
     49 #CHECK-NEXT:    Other: 0
     50 #CHECK-NEXT:    Section: Undefined
     51 #CHECK-NEXT:  }
     52 #CHECK-NEXT:  Symbol {
     53 #CHECK-NEXT:    Name: oof
     54 #CHECK-NEXT:    Value: 0x1004
     55 #CHECK-NEXT:    Size: 0
     56 #CHECK-NEXT:    Binding: Global
     57 #CHECK-NEXT:    Type: Function
     58 #CHECK-NEXT:    Other: 0
     59 #CHECK-NEXT:    Section: .text
     60 #CHECK-NEXT:  }
     61 #CHECK-NEXT:  Symbol {
     62 #CHECK-NEXT:    Name: bar
     63 #CHECK-NEXT:    Value: 0x2000
     64 #CHECK-NEXT:    Size: 4
     65 #CHECK-NEXT:    Binding: Global
     66 #CHECK-NEXT:    Type: Object
     67 #CHECK-NEXT:    Other: 0
     68 #CHECK-NEXT:    Section: .data
     69 #CHECK-NEXT:  }
     70 #CHECK-NEXT:  Symbol {
     71 #CHECK-NEXT:    Name: 
     72 #CHECK-NEXT:    Value: 0x1008
     73 #CHECK-NEXT:    Size: 0
     74 #CHECK-NEXT:    Binding: Global
     75 #CHECK-NEXT:    Type: Function
     76 #CHECK-NEXT:    Other: 0
     77 #CHECK-NEXT:    Section: .text
     78 #CHECK-NEXT:  }
     79 
     80 #BAD-FORMAT: Bad format for --redefine-sym
     81 #MULTIPLE-REDEFINITION: Multiple redefinition of symbol foo
     82