Solved

assembly code using GCC

Posted on 2001-07-15
8
532 Views
Last Modified: 2012-06-27
how is it possible to compile programs using embedded assembly language with the "asm" keyword on the linux platform using gcc.
i tried the following options:
1) gcc -x assembler-with-cpp file.cpp
2) gcc -w file.cpp
3) gcc -asm file.cpp

none of these work.
without any switches, it gives a parse error after every function. with the above switches, it fails to recognise the references assigned to the registers using mov .

0
Comment
Question by:effectstudios
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 5

Expert Comment

by:garboua
ID: 6285777
if you file extension ends with an ".s" or .S, gcc will know that it is an assembly and produce your binary.  no "swithches"
0
 
LVL 1

Author Comment

by:effectstudios
ID: 6286965
you mean to say that i should rename the same file as:
file.s
???
Won't the compiler complain about a missing .cpp extension then?
0
 
LVL 5

Expert Comment

by:garboua
ID: 6287364
OH NO,
the compiler will accept a preProcessed file, an object file, an assembly file, or a source code.
so ".o" ".i" ".s, .S" ".c" ".cpp" are all acceptable, BUT interperted as they mean.  so when the compiler sees the file.s, it knows it is an assembly lang file.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
superschlonz earned 15 total points
ID: 6287898
0
 
LVL 4

Expert Comment

by:newmang
ID: 6287901
When you posted your question are you referring to C code with embedded asm statements or are you referring to pure assembly code?
0
 
LVL 1

Author Comment

by:effectstudios
ID: 6290909
i am refering to a c program with some assmebly code embedded in it using the "asm" keyword
 
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9871626
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: superschlonz {http:#6287898}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Boot Linux vm into a menu system 2 97
what does "puppet agent -t" do ? 2 317
fsstat very high only on nfs client side rhel 10 107
Subsystem for UNIX-based Applications (SUA) 2 92
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question