delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/20/03:13:51

X-Spam-Check-By: sourceware.org
From: "David Lariviere" <dal2103 AT columbia DOT edu>
To: <cygwin AT cygwin DOT com>
Subject: Linking Assembly Code - Can't resolve printf
Date: Wed, 20 Sep 2006 03:11:27 -0400
Message-ID: <001d01c6dc83$fd77ef40$6cc027a0@davidiandesktop>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
X-No-Spam-Score: Local
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I have a simple assembly program that I am trying to compile, but ld cannot
resolve printf. 
------
#movtest3.s - Example using index memory locations
.section .data
output:
	.asciz "The value is %d\n"
values:
	.int 10,15,20,25,30,35,40,45,50,55,60
	.section .text
	.globl _start
_start:
	nop
	movl $0, %edi
loop:
	movl values(, %edi, 4), %eax
	pushl %eax
	pushl $output
	call printf
	addl $8, %esp
	inc %edi
	cmpl $11, %edi
	jne loop
	movl $0, %ebx
	movl $1, %eax
	int $0x80
#end of ASM



#Makefile
test:
	as -o indexedMemory.o indexedMemory.s
	ld --verbose -o indexedMemory indexedMemory.o -lc
#end of Makefile



Result is always:
....
attempt to open indexedMemory.o succeeded
indexedMemory.o
attempt to open /usr/bin/../lib/libc.dll.a failed
attempt to open /usr/bin/../lib/c.dll.a failed
attempt to open /usr/bin/../lib/libc.a succeeded
indexedMemory.o:fake:(.text+0x14): undefined reference to `printf'
make: *** [test] Error 1
#end of result

-------------

I've tried linking in numerous libraries, hoping one would resolve printf,
and in numerous order of where to include the -lxxx, but I can't get it to
compile. I've also tried it on numerous computers, including those with a
first-time fresh install of cygwin. Compiling a simple helloworld C program
works fine. 

I've compiled the same program fine in linux using as/ld. 

What am I doing wrong???

Thank you for any help, 

- David


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019