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

Use Clang's linker to make AVX instructions work #774

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

certik
Copy link
Member

@certik certik commented May 15, 2015

Fixes #748

However, I am not happy that we need to patch every package that uses our gcc. Rather, this patch should probably go into some base template, so that all packages use it.

This was referenced May 15, 2015
@certik
Copy link
Member Author

certik commented May 18, 2015

@ahmadia, @cekees what is the best way to handle this? The -Wa,-q flag needs to be added to every package that is compiled with gcc and with -march=native on OS X. Without it, the linking fails with missing AVX instructions (the flag forces gcc to use the correct OS X linker which understands these instructions):

[bddc] /var/tmp//ccYZ86gg.s:46:no such instruction: `vmovsd (%r14,%rax,8), %xmm0'
[bddc] /var/tmp//ccYZ86gg.s:57:no such instruction: `vmovsd (%r11,%r9,8), %xmm1'
[bddc] /var/tmp//ccYZ86gg.s:61:no such instruction: `vcomisd %xmm0, %xmm1'
[bddc] /var/tmp//ccYZ86gg.s:69:no such instruction: `vmovsd (%r11,%r15,8), %xmm2'
[bddc] /var/tmp//ccYZ86gg.s:74:no such instruction: `vcomisd %xmm2, %xmm0'
[bddc] /var/tmp//ccYZ86gg.s:87:no such instruction: `vmovsd (%r9), %xmm3'
...

So only if gcc and OS X is used, the flag should be set in all CXXFLAGS, CFLAGS and FFLAGS. The problem only manifests if the -march=native option is used, but I think it doesn't hurt to use the flag always.

One way is to set this in the base template yaml for OS X, and then change all Hashstack to only keep appending to CXXFLAGS, CFLAGS and FFLAGS, instead of replacing what was there (the current approach).

@cekees
Copy link
Contributor

cekees commented May 27, 2015

I'm not familiar with the -Wa,-q option. If it doesn't hurt anything, maybe we should have an os x profile that adds it and -march=native to the prologue.

@certik
Copy link
Member Author

certik commented May 27, 2015

Right. Except that we still need to update all Hashstack to keep appending to CXXFLAGS, CFLAGS and FFLAGS as I mentioned above.

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

Successfully merging this pull request may close these issues.

OS X 10.10 using '-march=native' works in clang but breaks in gcc
2 participants