🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#148
From: Tauno Voipio
Date: Thu, 22 May 2003 07:26
35 lines
2754 bytes
"Hans" <nospam@nospam.com> wrote in message
news:bagdiq$ol1$1@news4.tilbu1.nb.home.nl...
> 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?
>

By far, the easiest way is to let GCC do it. You can add switches on the GCC
command line to produce an assembly listing in addition to the final code.

Try this:

   gcc -o hello -Wa,-ahlms=hello.lst hello.c

HTH

Tauno Voipio
tauno voipio @ iki fi

PS:

If the assembly code looks complicated, add the switch -O2 to the command
line and try again.

TV
Technical Details
Message-ID: <5Z_ya.89$c05.29@read3.inet.fi>
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-01!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 00:56:34 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-01!sn-post-01!supernews.com!corp.supernews.com!news.crayne.org!clax86!robomod!not-for-mail
From: "Tauno Voipio" <tauno.voipio@iki.fi.SPAMBAIT_REMOVE.invalid>
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 07:26:57 GMT
Organization: Sonera corp Internet services
Message-ID: <5Z_ya.89$c05.29@read3.inet.fi>
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.
References: <bagdiq$ol1$1@news4.tilbu1.nb.home.nl>
MIME-Version: 1.0
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
X-MailScanner: Found to be clean
X-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=3.4,
 required 5, NOSPAM_INC, NO_MX_FOR_FROM, PRIORITY_NO_NAME,
 QUOTED_EMAIL_TEXT, REFERENCES, SPAM_PHRASE_00_01)
X-UIDL: <<H!!(C]"!="E"!(~c!!
X-Complaints-To: abuse@supernews.com
Lines: 37