🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.asm.x86
Article #149

Re: How to link HelloWorld.O (created by GCC) ??

#149
From: Ben Peddell
Date: Thu, 22 May 2003 07:37
28 lines
2610 bytes
Hans wrote:
> Hello,
> 
> I have written HelloWorld.c and compiled to assembly using GCC. (so I can
> study the assembly).
> 
> Using AS I have assembled HelloWorld.s to HelloWorld.O
> 
> But how to link HelloWorld.O to HelloWorld Executable? Which minimal command
> line options do I need to use to link? The Linker is complaining about the
> Printf call. Against which and HOW sharedlibrary stub do I need to link
> HelloWorld.O?
> 
> Thanks!
> 
> Hans
> 
> 
> 

First, you need the libraries.

To link HelloWorld.o, it's quite simple.
gcc -o HelloWorld HelloWorld.o

I'm not sure as to the command line syntax of ld, but I think (under 
DJGPP) it'd be:
ld -o HelloWorld HelloWorld.o $DJDIR/lib/libc.a $DJDIR/lib/crt0.o
Technical Details
Message-ID: <1%0za.39684$1s1.561771@newsfeeds.bigpond.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!news.crayne.org!clax86!robomod!not-for-mail
References: <bagdiq$ol1$1@news4.tilbu1.nb.home.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f65d0,3e6e7567159c8b7a
X-Google-Attributes: gidf65d0,public
X-Google-Thread: 114917,3e6e7567159c8b7a
X-Google-Attributes: gid114917,public
X-Google-ArrivalTime: 2003-05-22 03:56:26 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!news.crayne.org!clax86!robomod!not-for-mail
From: Ben Peddell <killer.lightspeed@bigpond.com>
Newsgroups: comp.lang.asm.x86,gnu.gcc
Subject: Re: How to link HelloWorld.O (created by GCC) ??
Approved: CLAX86 Moderators <ccrayne@crayne.org>
Date: Thu, 22 May 2003 17:37:50 +1000
Organization: Telstra BigPond Internet Services (http://www.bigpond.com)
Message-ID: <1%0za.39684$1s1.561771@newsfeeds.bigpond.com>
X-CLAX86-Policy: http://www.pacificsites.com/~ccrayne/clax86.html
X-CLAX86-Faq: http://www2.dgsys.com/~raymoon/x86faqs.html
X-CLAX86-Info-1: Send submissions to             comp-lang-asm-x86@moderators.isc.org
X-CLAX86-Info-2: Send technical complaints to    ccrayne@crayne.org
X-CLAX86-Info-3: Send complaints about policy to ccrayne@crayne.org
X-Comment: moderators do not necessarily agree or disagree with this article.
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.1) Gecko/20020826
X-Accept-Language: en-us, en
MIME-Version: 1.0
References: <bagdiq$ol1$1@news4.tilbu1.nb.home.nl>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-MailScanner: Found to be clean
X-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-2.3,
 required 5, NOSPAM_INC, QUOTED_EMAIL_TEXT, REFERENCES,
 SPAM_PHRASE_01_02, USER_AGENT, USER_AGENT_MOZILLA_UA, X_ACCEPT_LANG)
X-UIDL: i&(#!eQ)!!hQ3!!^D`"!
X-Complaints-To: abuse@supernews.com
Lines: 30