* [gentoo-sparc] Why is a simple hello world in 64 bit assembly program 65k bytes long?
@ 2006-12-26 14:40 Alex Buell
0 siblings, 0 replies; 4+ messages in thread
From: Alex Buell @ 2006-12-26 14:40 UTC (permalink / raw
To: gentoo-sparc
My code:
.equ SYSCALL_EXIT, 1
.equ SYSCALL_WRITE, 4
.equ STDIN, 0
.equ STDOUT, 1
.equ STDERR, 2
.align 4
.global _start
_start:
mov STDOUT, %o0
set string, %o1
mov 14, %o2
mov SYSCALL_WRITE, %g1
ta 0x10
mov 0, %o0
mov SYSCALL_EXIT, %g1
ta 0x10
.align 4
string:
.ascii "Hello world!\n"
How I build it:
as -64 -o hello.o hello.s
ld -e _start --oformat=elf64-sparc -o hello hello.o
ld: warning: sparc:v9 architecture of input file `hello.o' is
incompatible with sparc output strip hello
file hello
hello: ELF 64-bit MSB executable, SPARC V9, version 1 (SYSV),
statically linked, stripped
ls -l
total 24
-rwxr-xr-x 1 root root 66032 2006-12-26 14:39 hello
-rw-r--r-- 1 root root 1056 2006-12-26 14:39 hello.o
-rw-r--r-- 1 root root 296 2006-12-25 10:07 hello.s
-rw-r--r-- 1 root root 187 2006-12-25 10:27 Makefile
Why is the hello executable 66,032 bytes long?
--
http://www.munted.org.uk
You've been eating the cat food again, haven't you?
--
gentoo-sparc@gentoo.org mailing list
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gentoo-sparc] Why is a simple hello world in 64 bit assembly program 65k bytes long?
@ 2007-01-02 21:40 Alex Buell
2007-01-02 22:12 ` Hamish Greig
0 siblings, 1 reply; 4+ messages in thread
From: Alex Buell @ 2007-01-02 21:40 UTC (permalink / raw
To: gentoo-sparc
My code:
.equ SYSCALL_EXIT, 1
.equ SYSCALL_WRITE, 4
.equ STDIN, 0
.equ STDOUT, 1
.equ STDERR, 2
.align 4
.global _start
_start:
mov STDOUT, %o0
set string, %o1
mov 14, %o2
mov SYSCALL_WRITE, %g1
ta 0x10
mov 0, %o0
mov SYSCALL_EXIT, %g1
ta 0x10
.align 4
string:
.ascii "Hello world!\n"
How I build it:
as -64 -o hello.o hello.s
ld -e _start --oformat=elf64-sparc -o hello hello.o
ld: warning: sparc:v9 architecture of input file `hello.o' is
incompatible with sparc output strip hello
file hello
hello: ELF 64-bit MSB executable, SPARC V9, version 1 (SYSV),
statically linked, stripped
ls -l
total 24
-rwxr-xr-x 1 root root 66032 2006-12-26 14:39 hello
-rw-r--r-- 1 root root 1056 2006-12-26 14:39 hello.o
-rw-r--r-- 1 root root 296 2006-12-25 10:07 hello.s
-rw-r--r-- 1 root root 187 2006-12-25 10:27 Makefile
Why is the hello executable 66,032 bytes long?
--
http://www.munted.org.uk
Fearsome grindings.
--
gentoo-sparc@gentoo.org mailing list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-sparc] Why is a simple hello world in 64 bit assembly program 65k bytes long?
2007-01-02 21:40 [gentoo-sparc] Why is a simple hello world in 64 bit assembly program 65k bytes long? Alex Buell
@ 2007-01-02 22:12 ` Hamish Greig
2007-01-02 22:51 ` Alex Buell
0 siblings, 1 reply; 4+ messages in thread
From: Hamish Greig @ 2007-01-02 22:12 UTC (permalink / raw
To: gentoo-sparc
On Wednesday 03 January 2007 08:40, Alex Buell wrote:
<snip>
Have you tried a 32-bit program to see if it is the bits or the code ?
Have you tried a 32-bit and 64-bit simple c program to see if it is an
assembly problem and not a 64-bit problem ?
I understand you are an experienced programmer and might have already tried
these things, I ask only because you don't mention any details of having
investigated the problem prior to emailing the list.
You would problably have more replies on the binutils or gcc lists, although
without evidence that you have investigated the problem somewhat, they might
also not respond, not knowing what technical level of response you will
understand.
Of course, all of this is just my humble opinion, I offer it hoping to have
your question answered instead of popping back into my inbox next week.
hgg
--
gentoo-sparc@gentoo.org mailing list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-sparc] Why is a simple hello world in 64 bit assembly program 65k bytes long?
2007-01-02 22:12 ` Hamish Greig
@ 2007-01-02 22:51 ` Alex Buell
0 siblings, 0 replies; 4+ messages in thread
From: Alex Buell @ 2007-01-02 22:51 UTC (permalink / raw
To: gentoo-sparc
On Wed, 3 Jan 2007 09:12:43 +1100, I waved a wand and this message
magically appears in front of Hamish Greig:
> Have you tried a 32-bit program to see if it is the bits or the code ?
> Have you tried a 32-bit and 64-bit simple c program to see if it is
> an assembly problem and not a 64-bit problem ?
I did compile a 32 bit version of the same code; it was just 1k. I
think it might be pulling in unnecessary stuff.
> I understand you are an experienced programmer and might have already
> tried these things, I ask only because you don't mention any details
> of having investigated the problem prior to emailing the list.
> You would problably have more replies on the binutils or gcc lists,
> although without evidence that you have investigated the problem
> somewhat, they might also not respond, not knowing what technical
> level of response you will understand.
Yeah, thanks, I will ask on the more specific Sparc mailing lists
rather than the Gentoo lists.
The reason why I ask is because I want to help to get 64bit userland
upand running on my Ultra 2, I was thinking along the lines of having a
mix of 32bit and 64bit userland stuff.
--
http://www.munted.org.uk
Fearsome grindings.
--
gentoo-sparc@gentoo.org mailing list
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-02 22:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-02 21:40 [gentoo-sparc] Why is a simple hello world in 64 bit assembly program 65k bytes long? Alex Buell
2007-01-02 22:12 ` Hamish Greig
2007-01-02 22:51 ` Alex Buell
-- strict thread matches above, loose matches on Subject: below --
2006-12-26 14:40 Alex Buell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox