Linking Assembly Code - Can't resolve printf
Thu Sep 21 23:23:00 GMT 2006
David Lariviere <dal2103 <at> columbia.edu> writes:
> Hi Kai,
> Thank you so much. That got it compiling. I had tried it before, being
> inspired by the results of objdump on libc.a, but it didn't work at that
> point because I hadn't yet read about the importance of ordering the -lc
> after the object. I hadn't gone back and tried it since making that change,
> until your suggestion. Thanks!!
> The code is actually taken out of "Professional Assembly Language" by
> Richard Blum.
It is an entry point problem. The easy way to get around is to
write a C main program that calls an asm_main.
I taught an assembly language course that used the above book as
the course text and Cygwin for the programming environment. 95% of
the material in the book works under Cygwin as well as Linux.
I created a library that contained code that worked around the
entry point problem and provided wrappers around the stdio routines.
(The students had programmed in C++ and had never used printf/scanf
and I wanted to get them started with I/O as quickly as possible.)
Anyway the lecture notes and the library source code are online at
Look for the CS220 Library and User's Manual about 1/2 down the
page. The User's Manual lists example assembly code that will get
The example code you included in your post is used as an example
in Lecture 19: Getting Starting (it is the third assembly language
lecture, the first two cover X86 history and architecture - the
first half of the course covers digital logic) on slides 11 and 12.
I hope that you find the material useful in getting started with
Assembly under Cygwin.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
More information about the Cygwin