Built assembly module using libc routines.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Built assembly module using libc routines.

João Salvatti
Hi all,

I'm developing a small program that uses an assembly routine. It is
compiled and executed normally. But I've done some changes in the
routine, more specifically changing the system calls, such as write,
by libc functions, such as fprintf and exit. Then everytime I try to
run the program I have the following error message:

printf undefined reference
exit undefined reference

This routine is not inline , it is a separated module built in
assembly. Does anyone know how to build this program using libc
routines? I've used the following command line to compile the code:

as procedure.S -o procedure.o
ld -Bdynamic -dynamic-linker /usr/libexec/ld.so procedure.o -o procedure -lc

/usr/lib/libc.so.39.0: undefined reference to `environ'
/usr/lib/libc.so.39.0: undefined reference to `__progname'

But it doesn't work.

Thanks.

--
Joco Salvatti
Undergraduating in Computer Science
Federal University of Para - UFPA
web: http://www.openbsd-pa.org
e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Built assembly module using libc routines.

Ted Unangst-2
On 5/22/06, Joco Salvatti <[hidden email]> wrote:

> I'm developing a small program that uses an assembly routine. It is
> compiled and executed normally. But I've done some changes in the
> routine, more specifically changing the system calls, such as write,
> by libc functions, such as fprintf and exit. Then everytime I try to
> run the program I have the following error message:
>
> printf undefined reference
> exit undefined reference
>
> This routine is not inline , it is a separated module built in
> assembly. Does anyone know how to build this program using libc
> routines? I've used the following command line to compile the code:
>
> as procedure.S -o procedure.o
> ld -Bdynamic -dynamic-linker /usr/libexec/ld.so procedure.o -o procedure -lc
>
> /usr/lib/libc.so.39.0: undefined reference to `environ'
> /usr/lib/libc.so.39.0: undefined reference to `__progname'

link with gcc -o procedure procedure.o