ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I was wondering if there is any program/tool which can convert C code into the corresponding x86 code for me?? I dont know if gcc does this...I have never written C code in unix (or in ne other OS for that matter) and hence am very new to this.
Please let me know if u know some.
"gcc -S -o test.S test.c" will create a file test.S that contains the assembly version of test.c. If you are using either an gcc-x86 cross compiler or are on an x86 compiling natively these assembly instructions will be x86 assembly.
I think this is what your asking for... if not, let us know.
Originally posted by jtshaw "gcc -S -o test.S test.c" will create a file test.S that contains the assembly version of test.c. If you are using either an gcc-x86 cross compiler or are on an x86 compiling natively these assembly instructions will be x86 assembly.
I think this is what your asking for... if not, let us know.
that is exactly what i was looking for. thanks a lot...I really appreciate it.
If I may, can i also ask if there is any way to convert perl code into assembly?? I am basically trying to get spamassasin code in assembly. I thought i could use perlcc to convert from perl to C and then the gcc command to convert to assembly but it seems like perlcc does not work on any of the perl files in the spamassasin code base.
thanks
Perl is interpreted, not compiled. So there is no assembly version of it (at least strictly speaking). At best, you will get assembly listing of your code interpreted by the perl engine. So the assembly will be a mixture of your code and of the perl engine code.
Why do you want to have the assembly? I mean, perl can run on an x86, so you can run spamassassin on that platform. Its the point of writing a program in a language like perl.
Originally posted by BoldKiller That is more tricky.
Perl is interpreted, not compiled. So there is no assembly version of it (at least strictly speaking). At best, you will get assembly listing of your code interpreted by the perl engine. So the assembly will be a mixture of your code and of the perl engine code.
Why do you want to have the assembly? I mean, perl can run on an x86, so you can run spamassassin on that platform. Its the point of writing a program in a language like perl.
I have an assingment to do in which i am supposed to examine code from an anti-spam/anti-virus/anti-spyware program and then optimise the hardware of a pentium m processor to run on it (and i have been assigned spamassasin). hence i need to look at the assembly code to figure out which parts of the processor can be optimised given the algorithms in the code being analysed.
If you were assigned Spamassassin by the teacher, you should check with him if he is aware that spamassassin is in perl. In other words in an interpreted language. Because to do what you are talking about, you will need to actually optimize both Spanassassin AND the perl framework!
If you still need to do it, I would say the best way is to try to make perlcc work with your code. Then fallow your original idea.
The other way to go would be to run Spamassassin in a debugger, and make a memory dump of the code. I used something like that once, but I dont remember the name of the software. BUT be warned that you will get the instructions of SpammAssassin, the Perl framework AND the instructions of the librairy and kernel calls being made!
This is going to be even bigger. I doubt your assignement is to optimize the way the recv() fonction for the sockets works.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.