2

Below are two command line strings I used to output to assembly language listing using --x86-asm-syntax=intel. Both command line strings work, but they both produce AT&T syntax, not Intel syntax.

sudo clang-8 -S -mllvm --x86-asm-syntax=intel Svx.c

sudo llc-8 --x86-asm-syntax=intel Svx.ll -o Svx.s 

at the top of each file it says:

.intel_syntax noprefix

But the code it produces is AT&T syntax.

I've researched and haven't found an answer.

Thanks for any ideas on why these command strings do not produce Intel syntax.

RTC222
  • 2,025
  • 1
  • 20
  • 53
  • 1
    Hmm. Works for me (on [Godbolt](https://godbolt.org/z/m4PajW)) using v8.0. Have you tried just using `-masm=intel`? Also, does anything interesting happen between where you see `.intel_syntax` and the first lines that contain the at&t formatted code? Any inline asm's for example? What's your first at&t formatted instruction? And it might be worth checking the timestamp on the output file to make sure it's freshly generated from the current command line. It happens. – David Wohlferd Sep 21 '19 at 22:25
  • Thanks @David Wohlferd -- it works for me on Godbolt, too. I went to Godbolt because that strips out the cfi directives and gives me only Intel syntax. But even with -masm=intel I get the cfi directives, which I don't want. – RTC222 Sep 21 '19 at 22:36
  • 1
    I'm confused. Is the problem "at&t syntax?" Or just .cfi directives (which aren't specific to at&t)? If the goal is to make the output look like godbolt's "Filter all assembler directives from the output," I'd think a grep script could do this. You couldn't just look for `.` at the beginning of a line (that would exclude things like `.quad`), so you might need to have an exclusion file. Maybe you could contact Matt directly and ask him how he does this. – David Wohlferd Sep 21 '19 at 23:05
  • Well, the goal was to get all Intel syntax without the cfi directives. I don't want cfi directives in the code because it doesn't compile correctly. So far, only Godbolt's explorer gave me exactly what I am looking for. I'll try the grep script and see. – RTC222 Sep 21 '19 at 23:13
  • 1
    Perhaps you could check out [this](https://stackoverflow.com/a/38552509/2189500) answer. It contains a link to the godbolt github. – David Wohlferd Sep 22 '19 at 01:26

0 Answers0