Print assembly output of a compiled file from clang

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Print assembly output of a compiled file from clang

Tom Stellard via cfe-dev
Hey guys,

I'm looking for a way to print assembly output of a file being compiled
by clang. I've tried the -masm=intel and -x86-asm-syntax=intel flags.
Can anyone clue me in on how to do this?

Thanks very much,

Kim



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Print assembly output of a compiled file from clang

Tom Stellard via cfe-dev
Not sure if you want anything more than -S? (eg: "clang foo.c -S" - produces "foo.s", an assembly file)

On Wed, Apr 11, 2018 at 8:06 AM Kim Gadecki via cfe-dev <[hidden email]> wrote:
Hey guys,

I'm looking for a way to print assembly output of a file being compiled
by clang. I've tried the -masm=intel and -x86-asm-syntax=intel flags.
Can anyone clue me in on how to do this?

Thanks very much,

Kim



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Print assembly output of a compiled file from clang

Tom Stellard via cfe-dev
I don't think Clang/LLVM supports intel assembly syntax, probably only gnu/gas syntax. But perhaps someone else can confirm.

On Wed, Apr 11, 2018 at 5:23 PM Kim Gadecki <[hidden email]> wrote:

Hey David,

Was wondering if you can output the assembly in intel format to the command line?

Thanks


On 11/04/2018 11:10 pm, David Blaikie wrote:
Not sure if you want anything more than -S? (eg: "clang foo.c -S" - produces "foo.s", an assembly file)

On Wed, Apr 11, 2018 at 8:06 AM Kim Gadecki via cfe-dev <[hidden email]> wrote:
Hey guys,

I'm looking for a way to print assembly output of a file being compiled
by clang. I've tried the -masm=intel and -x86-asm-syntax=intel flags.
Can anyone clue me in on how to do this?

Thanks very much,

Kim



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Print assembly output of a compiled file from clang

Tom Stellard via cfe-dev
On 12 April 2018 at 18:43, David Blaikie via cfe-dev
<[hidden email]> wrote:
> I don't think Clang/LLVM supports intel assembly syntax, probably only
> gnu/gas syntax. But perhaps someone else can confirm.

It's not piped through to Clang in a friendly way, but that's what
"-mllvm -x86-asm-syntax=intel" should do. If the question really was
about the syntax variant, Kim might have forgotten the "-mllvm"?

Cheers.

Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Print assembly output of a compiled file from clang

Tom Stellard via cfe-dev
Oh no, turns out I was wrong and that's exactly what -masm=intel does.
My bet's now on your -S suggestion.

Tim.

On 12 April 2018 at 19:09, Tim Northover <[hidden email]> wrote:

> On 12 April 2018 at 18:43, David Blaikie via cfe-dev
> <[hidden email]> wrote:
>> I don't think Clang/LLVM supports intel assembly syntax, probably only
>> gnu/gas syntax. But perhaps someone else can confirm.
>
> It's not piped through to Clang in a friendly way, but that's what
> "-mllvm -x86-asm-syntax=intel" should do. If the question really was
> about the syntax variant, Kim might have forgotten the "-mllvm"?
>
> Cheers.
>
> Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Print assembly output of a compiled file from clang

Tom Stellard via cfe-dev
In reply to this post by Tom Stellard via cfe-dev
-S -masm=intel prints assembly in intel syntax.

On Thu, Apr 12, 2018 at 2:09 PM, Tim Northover via cfe-dev <[hidden email]> wrote:
On 12 April 2018 at 18:43, David Blaikie via cfe-dev
<[hidden email]> wrote:
> I don't think Clang/LLVM supports intel assembly syntax, probably only
> gnu/gas syntax. But perhaps someone else can confirm.

It's not piped through to Clang in a friendly way, but that's what
"-mllvm -x86-asm-syntax=intel" should do. If the question really was
about the syntax variant, Kim might have forgotten the "-mllvm"?

Cheers.

Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Print assembly output of a compiled file from clang

Tom Stellard via cfe-dev

Hey guys,

I tried the following at the command prompt:

F:\Clanggit\build\32\debug\bin>clang++ source.cpp -v -S -masm=intel

I'm expecting this to output the assembly for my compiled source.cpp translation unit but I don't get anything. Any ideas?

Thanks,
Kim


On 15/04/2018 11:36 pm, Nico Weber wrote:
If you need more help, please reply to the list, not to me personally.

On Sun, Apr 15, 2018, 9:32 AM Kim Gadecki <[hidden email]> wrote:

Hey guys,

I tried the following at the command prompt:

F:\Clanggit\build\32\debug\bin>clang++ source.cpp -v -S -masm=intel

I'm expecting this to output the assembly for my compiled source.cpp translation unit but I don't get anything. Any ideas?

Thanks,
Kim


On 13/04/2018 2:34 am, Nico Weber via cfe-dev wrote:
-S -masm=intel prints assembly in intel syntax.

On Thu, Apr 12, 2018 at 2:09 PM, Tim Northover via cfe-dev <[hidden email]> wrote:
On 12 April 2018 at 18:43, David Blaikie via cfe-dev
<[hidden email]> wrote:
> I don't think Clang/LLVM supports intel assembly syntax, probably only
> gnu/gas syntax. But perhaps someone else can confirm.

It's not piped through to Clang in a friendly way, but that's what
"-mllvm -x86-asm-syntax=intel" should do. If the question really was
about the syntax variant, Kim might have forgotten the "-mllvm"?

Cheers.

Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Print assembly output of a compiled file from clang

Tom Stellard via cfe-dev
Hi Kim,

On 16 April 2018 at 08:04, Kim Gadecki via cfe-dev
<[hidden email]> wrote:
> F:\Clanggit\build\32\debug\bin>clang++ source.cpp -v -S -masm=intel

This would normally output the assembly to a file named "source.s". If
you want it actually print it on the screen you need "-o -" as well.
Is that the cause of your issues?

Cheers.

Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev