hi everybody :)

i've just bought a sun box on ebay, installed gnu/linux on it and am now trying to write a short assembler program. this seems to be very different from assembler on my tried and trusted pentium III.

anyway, i found a few guides on the net and tried stuff out, but whatever i do, the loader starts complaining about main being defined twice and other stuff :(

so the question is, can someone post a really short assembler program for sparc under linux so i can see how the structure is with instructions on how to assemble and link it?
(for example, what would
.section .data
.section .text
.global _start
movl $2, %ebx
movl $1, %eax
int $0x80

on a sparc or ultrasparc be?)

ta muchly :)


10 Years
Discussion Span
Last Post by howlingmadhowie

yep, i've had a look at a fair bit of literature, none of which seems to provide a simple program which works. i did however solve the problem by using gcc -S on the following program:

int main()
int a, b;
return 0;

and then looking at the code. now i had of course tried this before, but i couldn't get it to assemble and link by using as and then ld. however, the code does compile if you use gcc on the .s file. so i had a look at the output of the gcc file and lo and behold:

.global main

is where i was going wrong. for some reason, it doesn't like:
.global _main

don't ask me why not...


This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.