[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / whole-archive.s
blobc65f116965f7673a9219517c8f376c4538fffd95
1 // REQUIRES: x86
3 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
4 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
5 // RUN: %p/Inputs/whole-archive.s -o %ta.o
6 // RUN: rm -f %t.a
7 // RUN: llvm-ar rcs %t.a %ta.o
9 // Should not add symbols from the archive by default as they are not required
10 // RUN: ld.lld -o %t3 %t.o %t.a
11 // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=NOTADDED %s
12 // NOTADDED: Symbols [
13 // NOTADDED-NOT: Name: _bar
14 // NOTADDED: ]
16 // Should add symbols from the archive if --whole-archive is used
17 // RUN: ld.lld -o %t3 %t.o --whole-archive %t.a
18 // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=ADDED %s
19 // ADDED: Symbols [
20 // ADDED: Name: _bar
21 // ADDED: ]
23 // --no-whole-archive should restore default behaviour
24 // RUN: ld.lld -o %t3 %t.o --whole-archive --no-whole-archive %t.a
25 // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=NOTADDED %s
27 // --whole-archive and --no-whole-archive should affect only archives which follow them
28 // RUN: ld.lld -o %t3 %t.o %t.a --whole-archive --no-whole-archive
29 // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=NOTADDED %s
30 // RUN: ld.lld -o %t3 %t.o --whole-archive %t.a --no-whole-archive
31 // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=ADDED %s
33 // --whole-archive should also work with thin archives
34 // RUN: rm -f %tthin.a
35 // RUN: llvm-ar --format=gnu rcsT %tthin.a %ta.o
36 // RUN: ld.lld -o %t3 %t.o --whole-archive %tthin.a
37 // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=ADDED %s
39 .globl _start
40 _start: