public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Interfacing with assembly code
@ 2005-05-17 18:33 Rob Lyman
  2005-05-17 20:24 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Lyman @ 2005-05-17 18:33 UTC (permalink / raw)
  To: gcc-help


I am using gcc package and want to combine C code with assembler.  Although
I am aware that gcc can in fact assemble code, I am rather set in my ways
and am more comfortable assembling code with NASM.  So my questions are two:

1) Why would the gcc linker be unable to find a symbol called "readTSC" in
an ELF file generated by NASM?  I am properly exporting the symbol name,
according to the NASM docs.  (I also tried exporting it as "_readTSC".)

2) Is the gcc compiler capable of generating an object file in Intel OMF/OBJ
format?  What command line options are required to invoke this?

Thanx for your help....

WaveformDelta


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Interfacing with assembly code
  2005-05-17 18:33 Interfacing with assembly code Rob Lyman
@ 2005-05-17 20:24 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2005-05-17 20:24 UTC (permalink / raw)
  To: Rob Lyman; +Cc: gcc-help

"Rob Lyman" <z073074@students.niu.edu> writes:

> I am using gcc package and want to combine C code with assembler.  Although
> I am aware that gcc can in fact assemble code, I am rather set in my ways
> and am more comfortable assembling code with NASM.  So my questions are two:
> 
> 1) Why would the gcc linker be unable to find a symbol called "readTSC" in
> an ELF file generated by NASM?  I am properly exporting the symbol name,
> according to the NASM docs.  (I also tried exporting it as "_readTSC".)

Try using nm and/or objdump -t to see what the ELF code sees in the
symbol table of your object file.  Note that the linker is not part of
gcc.  The GNU linker is part of the GNU binutils; for more information
see:
    http://sourceware.org/binutils/

> 2) Is the gcc compiler capable of generating an object file in Intel OMF/OBJ
> format?  What command line options are required to invoke this?

gcc just generates assembly code, and then invokes the assembler.  If
you want to generate OMF, you will need an assembler which can
interpret gcc's assembly output and generate OMF.  In this context the
-masm=intel option may be helpful.  (The GNU assembler does not
support OMF output, but gcc is regularly used with other assemblers.)

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-17 20:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-17 18:33 Interfacing with assembly code Rob Lyman
2005-05-17 20:24 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).