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

Don't add .intel_syntax on non-Intel machines #373

Closed
wants to merge 1 commit into from

Conversation

kornelski
Copy link
Contributor

--mca doesn't work on aarch64 macOS:

<stdin>:1:1: error: unknown directive
.intel_syntax
^

This PR disables the directive on other targets.

Perhaps a better solution would be to add another variant to OutputStyle instead, but the command-line parser is too clever to modify.

@pacak
Copy link
Owner

pacak commented Feb 11, 2025

Change looks reasonable. I'd like to poke around a bit to see if it makes sense to detect target triple and make it available to more code - there's at least one ticket that depends on this information (#284), if it's too much effort then I'll merge this. Appreciate the report ❤️

Perhaps a better solution would be to add another variant to OutputStyle instead, but the command-line parser is too clever to modify.

If adding a variant is all you want then just adding it with a doc comment and fixing complaints from rustc should do the trick... Not sure if it's a better solution though - I'd expect stuff like that just to work...

@kornelski
Copy link
Contributor Author

kornelski commented Feb 11, 2025

I assumed you'd want OutputStyle to default to Intel on x86, and some Other value on other platforms, but I don't see how to do that in the parser given that it may depend on another target option. Getters on OutputStyle also don't have the context.

@pacak
Copy link
Owner

pacak commented Feb 12, 2025

After some poking around - I think I found a better approach. If original file contains .intel_syntax - pass it though, otherwise do nothing. This way rustc/llvm deals with the difference. Will try to implement it in a day or two.

@pacak
Copy link
Owner

pacak commented Feb 13, 2025

I implemented my approach in #378, fixes mca for aarch for me, at least using crosscompilation:

cargo run --release -- --manifest-path sample/Cargo.toml  --target aarch64-unknown-linux-gnu -M=-mcpu=cyclone --lib 8 --mca

I still have to specify -mcpu because otherwise it defaults to my host cpu and fails. Don't see anything obvious in the .s file to pass though.

@pacak pacak closed this Feb 13, 2025
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.

2 participants