Odd error message from as

Niklas Karlsson anksil@yahoo.se
Sat Feb 17 03:58:00 GMT 2001


Hello!

I am using as, in the following version:
GNU assembler version 2.9.5 (i386-linux) using BFD version 2.9.5.0.37

My system is as follows:

Linux nestor 2.2.18 #4 SMP Fri Jan 26 16:52:08 CET 2001 i686 unknown




When doing the following: as --gstabs -o cat.o cat.s
I get the following error message:
cat.s:46: Error: local label "0" (instance number 0 of a dollar label)
is not defined

I don't quite understand what is meant here. If I try to assemble the
same program without --gstabs, it works fine.

The source for the program is attached. (It's just a small program to
duplicate the functionality of 'cat'... I wrote it to familiarize myself
with the AT&T syntax, having worked with intel syntax before.)

/Niklas
## cat.s -- Test implementation of 'cat'

	.section .data
buffer:
		.fill 8192
bufsize:
		.long 8192
file_d:
		.fill 4

	.section .text
	.globl _start

_start:
	popl	%ebx		# argc
	popl	%ebx		# argv[0] (program name)
	popl	%ebx		# argv[1] (what we want for open())
	movl	$5,%eax		# Syscall open()
	movl	$0,%ecx		# O_RDONLY
	int	$0x80		# Call kernel
	testl	%eax,%eax
	js	exit_prog	# If the response is a negative number, we have an error - exit
	movl	%eax,(file_d)	# Got an open file, store file descriptor
read_chunk:	
	movl	(file_d),%ebx	# File desc.
	movl	$3,%eax		# Syscall read()
	leal	buffer,%ecx	# Buffer address
	movl	bufsize,%edx	# Number of bytes to read
	int	$0x80		# Call kernel
	testl	%eax,%eax
	js	exit_prog
	jz	exit_prog
	movl	%eax,%edx	# Make # of bytes read the count arg for write()
write_chunk:
	movl	$4,%eax		# Syscall write()
	movl	$1,%ebx		# STDOUT
				# ecx is already set up
	int	$0x80		# Call kernel
	testl	%eax,%eax
	js	exit_prog
	jmp	read_chunk	# Continue reading file

exit_prog:
	movl	$1,%eax		# Syscall _exit()
	movl	$0,%ebx		# Normal program exit code
	int	$0x80




More information about the Binutils mailing list