Solved

assembly code using GCC

Posted on 2001-07-15
8
523 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
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Debian 3 - initrd rebuild 3 68
Problem to line 1 44
updating the repos in yum 4 107
Set-Top-Box hardware and Open Source! 8 92
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now