linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Charles T. Bell" <cbell44@cfl.rr.com>
To: linux-assembly@vger.kernel.org
Subject: simple hello.asm (NASM) not compile in x64, plz help
Date: Sat, 29 Nov 2014 05:20:26 -0500	[thread overview]
Message-ID: <54799DEA.5070408@cfl.rr.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]



On 11/29/2014 12:26 AM, Brian Raiter wrote:
>>
>> ld -s -o heworl heworl.o
>> ld:i386 architecture of input file *.o is incompatible with
i386:x86-64 output
>
> You told nasm to create a 32-bit .o file. Tell nasm to create a 64-bit
> .o file instead. Use "-f elf64" instead of "-f elf32".
>
> The command "nasm -hf" will display all the valid output formats that
> nasm supports.
>
> b
> --
> To unsubscribe from this list: send the line "unsubscribe
linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

I normally use gold (linker) and yasm (like nasm) since they are more
64-bit friendly.
My Makefile is thus:

hello: hello.o
	gold hello.o -o hello
hello.o: hello.asm
	yasm -f elf64 -g dwarf2 -o hello.o hello.asm

You can use the entries individually or just copy and paste into your
own Makefile and type: make
That will make .o file and link it for the executable, but don't forget
to rename "hello" to "heworl" in every instance, so it will have the
name you chose.
Hope this help!

Tom
-- 
"To argue with a man who has renounced the use of
reason is like administering medicine to the dead."
-- Thomas Paine, The American Crisis No. V(1776)

[-- Attachment #2: cbell44.vcf --]
[-- Type: text/x-vcard, Size: 149 bytes --]

begin:vcard
fn:Tom
n:Bell;Charles
email;internet:charles.bell.us@member.mensa.org
tel;home:386-673-8327
tel;cell:386-212-5407
version:2.1
end:vcard


             reply	other threads:[~2014-11-29 10:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 10:20 Charles T. Bell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-11-29  4:35 simple hello.asm (NASM) not compile in x64, plz help eric lin
2014-11-29  5:26 ` Brian Raiter
2014-12-24 19:49 ` Robert Plantz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54799DEA.5070408@cfl.rr.com \
    --to=cbell44@cfl.rr.com \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).