Re: nasm + libtool + shared lib

Georg Seidel <[email protected]>
Newsgroups gmane.comp.video.gephex.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


|
| | Still no clue what might cause the problems on linux.
|
| I think I found the cause of the problem
| (although I still don't understand why this can
| result in a segfault...).
|
| Somwhere in the nasm manual, in a section about
| building shared libraries, I found a remark
| that ebx is used to store the address of the
| global offset table.
| In a code snippet, I saw that ebx was saved before
| any further computations were done.
| So I simply push ebx in the function prologue, and
| pop it in the epilogue. Works just fine.
|
| I don't understand, however, why the compiler
| can assume that the function does not modify ebx.
| Any ELF/shared library experts?

This [1] explains the behaviour (and also a strange
thing with ebx that happened to me in a piece
of inline assembler once: gcc did not preserve
ebx himself, although it was listed in the
cloblist, and then segfaulted, see [2]).

Makes me wonder how compiler and os independent
our assembler code really is.
What if another
os/compiler uses a different base register
that must not be changed?
But then, it's assembler code, so what did
we expect :)

| I will try to replace all inline assembler with
| external nasm files in the next weeks.

Merged into main.

[1]
http://linux4u.jinr.ru/usoft/WWW/www_debian.org/Documentation/elf/node21.html
[2] http://lists.debian.org/debian-gcc/2002/07/msg00094.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBFHde/rP0cdKF/ToRAriwAJ9Qo8cPMlAavEroJqa0OYA4c+wT7QCg0n5n
cvdLthSd0vK7lfWlmW1Ct7g=
=Jnb2
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.