Compiler projects using llvm
## This test verifies that llvm-objcopy and llvm-strip do not remove
## undefined symbols if --keep-undefined is specified.

# RUN: yaml2obj %s -o %t
# RUN: llvm-objcopy --strip-all --keep-undefined %t %t.stripped
# RUN: llvm-readobj --symbols %t.stripped | FileCheck %s

# RUN: llvm-strip --keep-undefined %t -o %t.stripped.2
# RUN: cmp %t.stripped %t.stripped.2

# CHECK:       Symbols [
# CHECK-NEXT:    Symbol {
# CHECK-NEXT:      Name: _u (1)
# CHECK-NEXT:      Extern
# CHECK-NEXT:      Type: Undef (0x0)
# CHECK-NEXT:      Section:  (0x0)
# CHECK-NEXT:      RefType: UndefinedNonLazy (0x0)
# CHECK-NEXT:      Flags [ (0x220)
# CHECK-NEXT:        AltEntry (0x200)
# CHECK-NEXT:        NoDeadStrip (0x20)
# CHECK-NEXT:      ]
# CHECK-NEXT:      Value: 0x4
# CHECK-NEXT:    }
# CHECK-NEXT:  ]

--- !mach-o
FileHeader:
  magic:           0xFEEDFACF
  cputype:         0x1000007
  cpusubtype:      0x3
  filetype:        0x1
  ncmds:           3
  sizeofcmds:      256
  flags:           0x2000
  reserved:        0x0
LoadCommands:
  - cmd:             LC_SEGMENT_64
    cmdsize:         152
    segname:         ''
    vmaddr:          0
    vmsize:          0
    fileoff:         288
    filesize:        0
    maxprot:         7
    initprot:        7
    nsects:          1
    flags:           0
    Sections:
      - sectname:        __text
        segname:         __TEXT
        addr:            0x0
        size:            0
        offset:          0x120
        align:           0
        reloff:          0x0
        nreloc:          0
        flags:           0x80000000
        reserved1:       0x0
        reserved2:       0x0
        reserved3:       0x0
        content:         ''
  - cmd:             LC_SYMTAB
    cmdsize:         24
    symoff:          288
    nsyms:           2
    stroff:          320
    strsize:         8
  - cmd:             LC_DYSYMTAB
    cmdsize:         80
    ilocalsym:       0
    nlocalsym:       1
    iextdefsym:      1
    nextdefsym:      0
    iundefsym:       1
    nundefsym:       1
    tocoff:          0
    ntoc:            0
    modtaboff:       0
    nmodtab:         0
    extrefsymoff:    0
    nextrefsyms:     0
    indirectsymoff:  0
    nindirectsyms:   0
    extreloff:       0
    nextrel:         0
    locreloff:       0
    nlocrel:         0
LinkEditData:
  NameList:
    - n_strx:          4
      n_type:          0xE
      n_sect:          1
      n_desc:          32
      n_value:         0
    - n_strx:          1
      n_type:          0x1
      n_sect:          0
      n_desc:          544
      n_value:         4
  StringTable:
    - ''
    - _u
    - _d
    - ''
...