1## This test checks the warning message when no user specified sections are
2## found in the object file.
3
4## Test relocatable file.
5# RUN: yaml2obj --docnum=1 %s -o %t.1.o
6# RUN: yaml2obj --docnum=2 %s -o %t.2.o
7
8## - Warn for one section is found case.
9# RUN: llvm-objdump --reloc --section=single %t.2.o 2>&1 \
10# RUN:   | FileCheck --check-prefix=SINGLE-WARN %s
11
12## - Don't warn twice for duplicate missing sections.
13# RUN: llvm-objdump --reloc --section=single --section=single %t.2.o 2>&1 \
14# RUN:   | FileCheck --check-prefixes=SINGLE-WARN --implicit-check-not=warning: %s
15
16## - Don't warn if any user specified section is found.
17# RUN: llvm-objdump --reloc --section=.text1 --section=.text2 %t.2.o \
18# RUN:   | FileCheck --implicit-check-not=warning: %s
19
20## - Warn for each specified section if none of them are found.
21# RUN: llvm-objdump --reloc --section=multi1 --section=multi2 %t.2.o 2>&1 \
22# RUN:   | FileCheck --check-prefix=MULTI-WARN %s
23
24## - Don't warn if the specified section has no name.
25# RUN: llvm-objdump --reloc --section="" %t.2.o 2>&1 \
26# RUN:   | FileCheck --implicit-check-not=warning: %s
27
28## - Warning for --section is applicable for various other options.
29# RUN: llvm-objdump --section-headers --section=single %t.2.o 2>&1 \
30# RUN:   | FileCheck --check-prefix=SINGLE-WARN %s
31# RUN: llvm-objdump --full-contents --section=single %t.2.o 2>&1 \
32# RUN:   | FileCheck --check-prefix=SINGLE-WARN %s
33
34## Test archive file.
35# RUN: rm -f %t.a
36# RUN: llvm-ar rc %t.a %t.1.o %t.2.o
37
38## - Warn for one section is found case.
39# RUN: llvm-objdump --reloc --section=single %t.a 2>&1 \
40# RUN:   | FileCheck --check-prefix=SINGLE-WARN %s
41
42## - Don't warn if any user specified section is found.
43# RUN: llvm-objdump --reloc --section=.text1 %t.a \
44# RUN:   | FileCheck --implicit-check-not=warning: %s
45
46## - Warn for each specified section if none of them are found.
47# RUN: llvm-objdump --reloc --section=multi1 --section=multi2 %t.a 2>&1 \
48# RUN:   | FileCheck --check-prefix=MULTI-WARN %s
49
50
51# SINGLE-WARN: warning: section 'single' mentioned in a -j/--section option, but not found in any input file
52# MULTI-WARN:      warning: section 'multi1' mentioned in a -j/--section option, but not found in any input file
53# MULTI-WARN-NEXT: warning: section 'multi2' mentioned in a -j/--section option, but not found in any input file
54
55--- !ELF
56FileHeader:
57  Class:   ELFCLASS64
58  Data:    ELFDATA2LSB
59  Type:    ET_REL
60  Machine: EM_X86_64
61Sections:
62- Name:    .text1
63  Type:    SHT_PROGBITS
64
65--- !ELF
66FileHeader:
67  Class:   ELFCLASS64
68  Data:    ELFDATA2LSB
69  Type:    ET_REL
70  Machine: EM_X86_64
71Sections:
72- Name:    .text2
73  Type:    SHT_PROGBITS
74