delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/14/05:45:11

From: wmitty-no-spam AT cotse DOT com
Subject: Linking to binary format
Message-ID: <984559248.3aaf2e90465a3@webmail.cotse.com>
Date: Wed, 14 Mar 2001 03:40:48 -0500
Newsgroups: comp.os.msdos.djgpp
X-No-Archive: Yes
X-Abuse-To: abuse AT cotse DOT com
MIME-Version: 1.0
User-Agent: http://www.cotse.com/
Mail-To-News-Contact: abuse AT dizum DOT com
Organization: mail2news AT dizum DOT com
Lines: 37
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm trying to write a simple program to be loaded from disk by a bootloader.

This test program is as follows:

    #include <stdio.h>

    int main()
    {
     printf("Test\n");
     return 0;
    }

I compile it with

gcc -c mytest.c

then try to link it as a pure binary file (so my bootloader can load it) as
follows

ld mytest.o -o mytest.bin -oformat binary -Ttext 0x100000 -lc

but this produces the error:

warning: cannot find entry symbol start; defaulting to 00100000

followed by many errors such as:

d:/djgpp/bin/../lib/libc.a(doprnt.o)(.text+0xafd):doprnt.c: undefined
reference to '___umoddi3'
d:/djgpp/bin/../lib/libc.a(doprnt.o)(.text+0xb3c):doprnt.c: undefined
reference to '___udivdi3'

does anyone now where I'm going wrong

Thanks
WM

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019