libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Statically linking a lib which dlopens a module


From: Carlos Sánchez de La Lama
Subject: Statically linking a lib which dlopens a module
Date: Mon, 23 Apr 2018 11:31:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hi all,

I have the following scenario:

prog1 --links--> lib1 --dlopens--> module1

With dinamic linking, everything works. I was expecting that if I used
-static on libtool, the "dlopen" would work as a "dlpreopen" so I could
end up with a statically-linked prog1 which worked the same way. However,
I find:

1) when linking "lib1", the preopened symbols file lib1S.o is generated and
added into lib1.a, but it does not cointain the symbols from the module.

2) when linking prog1, the preopened symbols file prog1S.o is generated,
and includes symbols from module1 (the come through lib1.la which lists
module1 as a dlopened module), but is then not linked in the final
executable (following libtool script logic, I see "preopen" variable is
false so @SYMFILE@ is removed during link).

I am trying to fix this and prepare a patch, but I am dubious of the way
this *should* work. Should A) modules dlopened by a library be considered as
dlpreopened when linking the library statically, or B) still noted as
dlopened only considered as "dlpreopened" when linking the final
program?

I can think of arguments in either direction (I slightly lean towards B)
and I am sure this has more implications than the ones in my mind. Is
there consensus about this?

Thanks!

Carlos



reply via email to

[Prev in Thread] Current Thread [Next in Thread]