views:

66

answers:

1

I wrote a function called strlen:

.section .text
.global strlen
.type strlen, @function
strlen:
... code ...

I assembled this like so:

as --32 strlen.asm -o strlen.o

Then I wrote a program in asm to print argv which I want to link with this. I assembled that the same way. Now I want to link them together so that the actual program can use strlen. I tried:

ld printnum.o strlen.o -m elf_i386 -o printnum

but that yields:

printnum.o: In function `loop':
(.text+0x5): undefined reference to `strlen'

I must be missing something really simple. Thanks!

A: 

Earlier I stupidly ran strip on strlen.o which obviously removed all of the symbols. Good job me.

Tim