Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 1 | // RUN: %clangxx_cfi -o %t1 %s |
| 2 | // RUN: %t1 c 1 2>&1 | FileCheck --check-prefix=CFI %s |
| 3 | // RUN: %t1 s 2 2>&1 | FileCheck --check-prefix=CFI %s |
| 4 | |
| 5 | // This test uses jump tables containing PC-relative references to external |
| 6 | // symbols, which the Mach-O object writer does not currently support. |
| 7 | // XFAIL: darwin |
| 8 | |
| 9 | #include <stdlib.h> |
| 10 | #include <stdio.h> |
| 11 | #include <math.h> |
| 12 | |
| 13 | int main(int argc, char **argv) { |
| 14 | // CFI: 1 |
| 15 | fprintf(stderr, "1\n"); |
| 16 | |
| 17 | double (*fn)(double); |
| 18 | if (argv[1][0] == 's') |
| 19 | fn = sin; |
| 20 | else |
| 21 | fn = cos; |
| 22 | |
| 23 | fn(atof(argv[2])); |
| 24 | |
| 25 | // CFI: 2 |
| 26 | fprintf(stderr, "2\n"); |
| 27 | } |