Linking Multiple Object files using Nasm and gcc ?

From: Anish (anish.n_at_lycos.com)
Date: 04/28/04


Date: 28 Apr 2004 00:39:17 -0700

My Bootloader loads the following code at 0x7e00:0000. I am trying to
link 'c' file, But unable to do that.

Assembler : Nasm
Kernel : 2.4.22

/*************************/
; PMode.asm
org 0x7e00
extern _cl_scr

..............
...............
..............
..............

call _cl_scr
/*************************/
Assembling Process followed : nasm -f elf PMode.asm
Output of it : PMode.o

/***************Animate.c******************/
void _cl_scr()
{
     int i=0;
                   do {

                     *( scr + i ) = 'A';
                         i++;
                   } while( i < 200 );
}

Compiling Process Followed : cc -ffreestanding -c Animate.c
Output of it : Animate.o

Linking : ld -Ttext 0x7e00 -format binary PMode.o Animate.o
Output : a.out

In the above PMode.asm, i am not able to include 'org' statement. But
i don't want to use the offset whenever i try to access memory or
setting up the GDT.

If i include the org statement, then i get parser instruction expected
error.

Please let me know how to get bin out of it.????



Relevant Pages

  • Re: Video Mode 13h in windows XP ... impossible?
    ... there is NO problem using mode 13h under XP...if you write a DOS ... terminates so does the "DOS box" and you return to the Windows desktop ... A dedicated assembler (most of which are completely free and available ... NASM, this is _certainty_ that it's okay for you to do so...the people ...
    (alt.lang.asm)
  • Re: Why there are so many assemblers.
    ... But *clearly* the discussion of the creation of NASM predated ... >> reasonable facsimile to the Intel assembler. ... that was in mid-1996), MASM was still a commercial product, TASM was a ... I have a problem with Rene Tournois calling it an "Intel Syntax" ...
    (alt.lang.asm)
  • Re: My pick for the 04 election - None of the above
    ... that would be re-usable for each GPL Assembler. ... NASM, and as RosAsm has _years_ of advance on any other ... GPL Asm Encoder for LuxAsm and for RosAsm, ...
    (alt.lang.asm)
  • Re: Note to "The Wannabee" on religion
    ... > speed and readability, i have choosen readability. ... idea), the latest version of Nasm has been downloaded almost 53,000 ... > of the older NASM users are also switching to FASM. ... > replacing a GPL Assembler, ...
    (alt.lang.asm)
  • Re: The Lib debate
    ... without further support from the assembler. ... nasm is released under an open source-compatible license. ... has enough macro facilities to allow source-portability among OSes. ... and plenty of external libraries. ...
    (alt.lang.asm)