Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to compile the code in MacOS? #5

Open
songtianyi opened this issue Jan 5, 2018 · 3 comments
Open

how to compile the code in MacOS? #5

songtianyi opened this issue Jan 5, 2018 · 3 comments

Comments

@songtianyi
Copy link

gcc output

spectre.c:83:21: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
                        time1 = __rdtscp(&junk); /* READ TIMER */
                                         ^~~~~
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.1.0/include/ia32intrin.h:71:24: note: passing argument to parameter '__A' here
__rdtscp(unsigned int *__A) {
                       ^
spectre.c:85:21: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
                        time2 = __rdtscp(&junk) - time1; /* READ TIMER & COMPUTE ELAPSED TIME */
                                         ^~~~~
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.1.0/include/ia32intrin.h:71:24: note: passing argument to parameter '__A' here
__rdtscp(unsigned int *__A) {
                       ^
@cch123
Copy link

cch123 commented Jan 5, 2018

ignore warning

./a.out

@Eugnis
Copy link
Owner

Eugnis commented Jan 5, 2018

Try this implementation with pthread.h Should work on macos https://gist.github.com/Eugnis/3ba3f048988e7be76737ab87da64bb26
Compile on MacOS clang -O0 spectre-thread.c -o spectre && ./spectre

@douglasheld
Copy link

I found it to work today on MacOS with no modifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants