4
4
// mode to a new platform, but is not in and of itself a test of the profiling
5
5
// runtime.
6
6
7
- // REQUIRES: darwin
7
+ // REQUIRES: darwin, target={{arm64.*}}
8
8
9
9
// Align counters and data to the maximum expected page size (16K).
10
10
// RUN: %clang -g -o %t %s \
@@ -44,8 +44,8 @@ int create_tmpfile(char *path) {
44
44
return EXIT_FAILURE ;
45
45
}
46
46
47
- // Write the data first (at offset 0x4000 , after the counters).
48
- if (data_len != pwrite (fd , & data , data_len , 0x4000 )) {
47
+ // Write the data first (at offset 0x1000 , after the counters).
48
+ if (data_len != pwrite (fd , & data , data_len , cnts_len )) {
49
49
perror ("write" );
50
50
return EXIT_FAILURE ;
51
51
}
@@ -55,8 +55,8 @@ int create_tmpfile(char *path) {
55
55
// Requirements (on Darwin):
56
56
// - &cnts_start must be page-aligned.
57
57
// - The length and offset-into-fd must be page-aligned.
58
- int * counter_map = (int * )mmap (& cnts_start , 0x4000 , PROT_READ | PROT_WRITE ,
59
- MAP_FIXED | MAP_SHARED , fd , 0 );
58
+ int * counter_map = (int * )mmap (& cnts_start , cnts_len , PROT_READ | PROT_WRITE ,
59
+ MAP_FIXED | MAP_SHARED , fd , 0 );
60
60
if (counter_map != & cnts_start ) {
61
61
perror ("mmap" );
62
62
return EXIT_FAILURE ;
@@ -97,7 +97,7 @@ int validate_tmpfile(char *path) {
97
97
}
98
98
99
99
// Verify that the rest of the counters (after counter 9) are 0.
100
- const int num_cnts = 0x4000 / sizeof (int );
100
+ const int num_cnts = cnts_len / sizeof (int );
101
101
for (int i = 10 ; i < num_cnts ; ++ i ) {
102
102
if (buf [i ] != 0 ) {
103
103
fprintf (stderr ,
@@ -131,8 +131,9 @@ int main(int argc, char **argv) {
131
131
fprintf (stderr , "__pcnts is not page-aligned: 0x%lx.\n" , cnts_start_int );
132
132
return EXIT_FAILURE ;
133
133
}
134
- if (data_start_int % pagesz != 0 ) {
135
- fprintf (stderr , "__pdata is not page-aligned: 0x%lx.\n" , data_start_int );
134
+ if (data_start_int % 0x4000 != 0 ) {
135
+ fprintf (stderr , "__pdata is not correctly aligned: 0x%lx.\n" ,
136
+ data_start_int );
136
137
return EXIT_FAILURE ;
137
138
}
138
139
if (cnts_start_int + 0x4000 != data_start_int ) {
0 commit comments