Re: [AD] proposed patch for nicer asm symbols exports |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Sam Hocevar wrote:
AFAIU (I was not here at the time Allegro was designed), the
alleg_unsharable serves at least two purposes:
- provide the main() function on Unix, because the main() from the
original program has been diverted to __mangled_main_address.
Well, this part is not right. main() is in liballeg.so as far as I can see.
- provide assembly functions that are not position independent code
(PIC). When building a Unix shared object (library), one needs to
use the -fPIC flag to create position independent code, or the
library will not be properly loaded in a shared address space. PIC
code stores a special pointer in a reserved register (EBX on x86),
which means that the compiled code cannot use EBX and will run at a
slight performance loss. Since the asm code in alleg_unsharable does
not reserve EBX, it is built as a static library instead of a
shared one.
Thank you for the explanation.
However, on x86 library code need not be compiled with -fPIC because
the architecture allows linking non-PIC code with PIC code in the same
object. And we do not provide assembly routines on platforms that do not
allow this linking (such as Alpha, IA64, HPPA).
Ok, great. I suppose the linking of non-PIC and PIC code only works if
your patch is applied? Sorry if it's a dumb question.
I would like to get rid of alleg_unsharable because its presence
means that you can only upgrade liballegro in a way that works with all
previous versions of alleg_unsharable your binaries were compiled with,
or you have to recompile all your applications, which kinda defeats the
purpose of shared libraries.
If you send me a patch for misc/deplib.sh and other files for getting
rid of liballeg_unsharable completely, I'll apply it unless there are
objections. Assembly routines won't be provided for non-x86 machines
any time soon.
Peter