xref: /llvm-project/clang/test/Driver/arch-specific-libdir.c (revision b876596a76cdc183439b36455d26883b67f8ee51)
1 // Test that the driver adds an arch-specific subdirectory in
2 // {RESOURCE_DIR}/lib/linux to the search path.
3 //
4 // RUN: %clang %s -### --target=i386-unknown-linux \
5 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
6 // RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s
7 
8 // RUN: %clang %s -### --target=i386-unknown-linux \
9 // RUN:     -resource-dir=%S/Inputs/resource_dir 2>&1 \
10 // RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
11 
12 // RUN: %clang %s -### --target=i686-unknown-linux \
13 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
14 // RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s
15 
16 // RUN: %clang %s -### --target=i686-unknown-linux \
17 // RUN:     -resource-dir=%S/Inputs/resource_dir 2>&1 \
18 // RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
19 
20 // RUN: %clang %s -### --target=x86_64-unknown-linux \
21 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
22 // RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-x86_64 %s
23 
24 // RUN: %clang %s -### --target=x86_64-unknown-linux \
25 // RUN:     -resource-dir=%S/Inputs/resource_dir 2>&1 \
26 // RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
27 
28 // RUN: %clang %s -### --target=arm-unknown-linux \
29 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
30 // RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-arm %s
31 
32 // RUN: %clang %s -### --target=arm-unknown-linux \
33 // RUN:     -resource-dir=%S/Inputs/resource_dir 2>&1 \
34 // RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
35 
36 // RUN: %clang %s -### --target=aarch64-unknown-linux \
37 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_arch_subdir 2>&1 \
38 // RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-aarch64 %s
39 
40 // RUN: %clang %s -### --target=aarch64-unknown-linux \
41 // RUN:     -resource-dir=%S/Inputs/resource_dir 2>&1 \
42 // RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
43 
44 // FILEPATH: "-x" "c" "[[FILE_PATH:.*]]{{(/|\\\\).*}}.c"
45 // ARCHDIR-i386:    -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)i386}}
46 // ARCHDIR-x86_64:  -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}
47 // ARCHDIR-arm:     -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)arm}}
48 // ARCHDIR-aarch64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}}
49 //
50 // Have a stricter check for no-archdir - that the driver doesn't add any
51 // subdirectory from the provided resource directory.
52 // NO-ARCHDIR-NOT: -L[[FILE_PATH]]/Inputs/resource_dir"
53