LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-10-2006, 05:11 PM   #1
lilili
Member
 
Registered: Jan 2006
Location: SantaBarbara
Distribution: Slackware 12.1
Posts: 196

Rep: Reputation: 30
generating mips assembly from c code with gcc?


hi
I'm wondering if gcc can spits out the assembly code for mips, given a c or c++ code to compile. If gcc can not generates it , is there a way to compile a c code to mips assembly code?

I know my gcc can generates assembly code given a c code but I don't know for what arch.

I'm running linux machine with pentium processor

Thank you
 
Old 05-10-2006, 06:01 PM   #2
llmmix
Member
 
Registered: Jun 2005
Posts: 73

Rep: Reputation: 15
Code:
echo "main(){}" > hello.c
cc -S hello.c
cat hello.s

Last edited by llmmix; 05-10-2006 at 06:02 PM.
 
Old 05-10-2006, 07:00 PM   #3
Vagrant
Member
 
Registered: Nov 2001
Posts: 75

Rep: Reputation: 15
That spits out x86 assembly. Might want to google that one, maybe you can find a compiler which will compile for the MIPS architecture, I haven't tried to do that before.
 
Old 05-11-2006, 05:48 AM   #4
llmmix
Member
 
Registered: Jun 2005
Posts: 73

Rep: Reputation: 15
native mips gcc compiler on mips machine will works? i don't know. just guess.
But it will not work, cross gcc compiler on x86.

Some possibility..
http://en.wikipedia.org/wiki/MIPS_architecture
 
Old 05-11-2006, 08:37 PM   #5
lilili
Member
 
Registered: Jan 2006
Location: SantaBarbara
Distribution: Slackware 12.1
Posts: 196

Original Poster
Rep: Reputation: 30
cross gcc compiler on x86 ?

What does this mean? gcc will compile my c code to mips, instead of x86 assembly(since i use p4) that i'm using ?
That is an interesting idea. Assuming that gcc will generate mips assembly instead of the x86 code, then my machine won't recognize the code , gcc generates right?

Thank you
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc/Assembly code gigantas1985 Programming 0 02-28-2006 05:52 AM
doubts about assembly code generated from gcc morph_ind Programming 9 05-28-2005 12:08 AM
Can gcc cross-compile C code to M68K Assembly? lowpro2k3 Programming 1 03-25-2005 07:50 AM
MIPS assembly question Gnute Programming 1 08-24-2004 05:33 PM
MIPS assembly fenriswolf Programming 0 10-17-2001 03:01 PM


All times are GMT -5. The time now is 12:53 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration