View Single Post
Old Oct 25th, 2006, 2:58 PM   #1
sackarias
Programmer
 
sackarias's Avatar
 
Join Date: Jan 2006
Posts: 58
Rep Power: 3 sackarias is on a distinguished road
sparc error help!

I'm getting this error which I personally don't get much help from...

Undefined first referenced
symbol in file
i /var/tmp//ccchb2QW.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

My code is...

/*********************************************
File: arrays.m
Date: October 31st, 2006
Author: Zack Hitz
Purpose: Asks the user to enter 10 integers
into 2 arrays.  The arrays will be added up
via their corresponding index, stored into 
a third array, then all 3 arrays will be
outputted.
*********************************************/
	.align 8
	.data
input:	.asciz	"%d"
	.align 8
output: .asciz 	"%d"
	.align 8
prompt: .asciz 	"Enter 10 integers\n"

!Automatic data for a program
define(idx, -20)
define(A, -60)
define(B, -100)
define(C, -140)

	.text
	.align 4
	.global main
main: save %sp,(-108 - 12) & -8, %sp

mov 0, %l0
st %l0, [%fp+idx]

set prompt, %o0
call printf
nop

inputLoop:

	set input, %o0
	add %fp, A, %o2
	ld [%fp+idx],%o1
	sll %o1, 2, %o1
	add %o2, %o1, %o1
	call scanf, 0
	nop

	ld [%fp+idx], %l0
	inc %l0
	st %l0, [%fp+idx] !was originally %fp+i
	cmp %l0, 10
	bl inputLoop
	nop

inputDone: call exit, 0
	mov 0, %o0

Any ideas?

*EDIT*
The boldfaced text is where the error was. I didn't have an "i" allocated anywhere so it freaked out, I meant idx.

Last edited by sackarias; Oct 25th, 2006 at 3:23 PM. Reason: Figured out error
sackarias is offline   Reply With Quote