Bruno Cardoso Lopes | de9cab9 | 2016-10-21 01:49:14 +0000 | [diff] [blame] | 1 | // REQUIRES: system-darwin |
| 2 | |
| 3 | // -no_deduplicate is only present from ld64 version 262 and later. |
| 4 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 5 | // RUN: -mlinker-version=261 -O0 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s |
| 6 | |
| 7 | // Add -no_deduplicate when either -O0 or -O1 is explicitly specified |
| 8 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 9 | // RUN: -mlinker-version=262 -O0 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s |
| 10 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 11 | // RUN: -mlinker-version=262 -O1 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s |
| 12 | |
| 13 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 14 | // RUN: -mlinker-version=262 -O2 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s |
| 15 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 16 | // RUN: -mlinker-version=262 -O3 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s |
| 17 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 18 | // RUN: -mlinker-version=262 -Os 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s |
| 19 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 20 | // RUN: -mlinker-version=262 -O4 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s |
| 21 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 22 | // RUN: -mlinker-version=262 -Ofast 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s |
| 23 | |
| 24 | // Add -no_deduplicate when no -O option is specified *and* this is a compile+link |
| 25 | // (implicit -O0) |
| 26 | // RUN: %clang -target x86_64-apple-darwin10 -### %s \ |
| 27 | // RUN: -mlinker-version=262 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s |
| 28 | |
| 29 | // Do *not* add -no_deduplicate when no -O option is specified and this is just a link |
| 30 | // (since we can't imply -O0) |
| 31 | // RUN: rm -f %t.o %t.bin |
| 32 | // RUN: %clang -target x86_64-apple-darwin10 -c -o %t.o %s |
| 33 | // RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \ |
| 34 | // RUN: -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s |
| 35 | // RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \ |
| 36 | // RUN: -O0 -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s |
| 37 | // RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \ |
| 38 | // RUN: -O1 -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s |
| 39 | // RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \ |
| 40 | // RUN: -O2 -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s |
| 41 | |
| 42 | // LINK_NODEDUP: {{ld(.exe)?"}} |
| 43 | // LINK_NODEDUP: "-no_deduplicate" |
| 44 | |
| 45 | // LINK_DEDUP: {{ld(.exe)?"}} |
| 46 | // LINK_DEDUP-NOT: "-no_deduplicate" |