symtab.test 1.97 KB
## Test the s and S modifiers. Build and do not build a symbol table.

# RUN: yaml2obj %s -o %t.o
# RUN: touch %t-other.txt

## Default:
# RUN: rm -f %t-default.a
# RUN: llvm-ar rc %t-default.a %t.o
# RUN: llvm-nm --print-armap %t-default.a \
# RUN:   | FileCheck %s --check-prefix=SYMTAB

## Use a modifer:
# RUN: rm -f %t-symtab.a
# RUN: llvm-ar rcs %t-symtab.a %t.o
# RUN: llvm-nm --print-armap %t-symtab.a \
# RUN:   | FileCheck %s --check-prefix=SYMTAB

# RUN: rm -f %t-no-symtab.a
# RUN: llvm-ar rcS %t-no-symtab.a %t.o
# RUN: llvm-nm --print-armap %t-no-symtab.a \
# RUN:   | FileCheck %s --check-prefix=NO-SYMTAB

## Use both modifers:
# RUN: rm -f %t-symtab-last.a
# RUN: llvm-ar rcSs %t-symtab-last.a %t.o
# RUN: llvm-nm --print-armap %t-symtab-last.a \
# RUN:   | FileCheck %s --check-prefix=SYMTAB

# RUN: rm -f %t-no-symtab-last.a
# RUN: llvm-ar rcsS %t-no-symtab-last.a %t.o
# RUN: llvm-nm --print-armap %t-no-symtab-last.a \
# RUN:   | FileCheck %s --check-prefix=NO-SYMTAB

## Use an existing archive:
# RUN: rm -f %t-to-symtab.a
# RUN: llvm-ar rcS %t-to-symtab.a %t.o
# RUN: llvm-ar rs %t-to-symtab.a %t-other.txt
# RUN: llvm-nm --print-armap %t-to-symtab.a \
# RUN:   | FileCheck %s --check-prefix=SYMTAB

# RUN: llvm-ar rs %t-to-symtab.a %t-other.txt
# RUN: llvm-nm --print-armap %t-to-symtab.a \
# RUN:   | FileCheck %s --check-prefix=SYMTAB

# RUN: rm -f %t-to-no-symtab.a
# RUN: llvm-ar rcs %t-to-no-symtab.a %t.o
# RUN: llvm-ar rS %t-to-no-symtab.a %t-other.txt
# RUN: llvm-nm --print-armap %t-to-no-symtab.a \
# RUN:   | FileCheck %s --check-prefix=NO-SYMTAB

# RUN: llvm-ar rS %t-to-no-symtab.a %t-other.txt
# RUN: llvm-nm --print-armap %t-to-no-symtab.a \
# RUN:   | FileCheck %s --check-prefix=NO-SYMTAB

# SYMTAB:        symbol in
# NO-SYMTAB-NOT: symbol in

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Name: .text
    Type: SHT_PROGBITS
Symbols:
  - Name:    symbol
    Binding: STB_GLOBAL
    Section: .text