On 2025-12-12 Jeremy Harris via Exim-users <[email protected]> wrote:
> On 2025/12/12 3:28 PM, Andreas Metzler via Exim-users wrote:
> > I have been playing around with dlopened lookups modules, but they do
> > not end up being linked against the respective library:
> >
> > make[2]: Entering directory '/tmp/EXIM4/exim4/build-Linux-x86_64/lookups'
> > cc -shared sqlite.c
> > cc -lsqlite3 -DDYNLOOKUP -shared -rdynamic -fPIC -O
> > -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/usr/include/p11-kit-1
> > -I/usr/include/p11-kit-1 sqlite.c -o sqlite.so
> Even after re-ordering that cmdline I get "NEEDED" items.
[...]
> $ objdump -p ./build-Linux-x86_64/dynmodules/sqlite_lookup.so | grep NEEDED
> NEEDED libsqlite3.so.0
> NEEDED libc.so.6
> [ I'm not sure how you managed to *not* get libsqlite3.so needed; any
> way I tried to force that resulted in the testsuite claiming that
> sqlite was not included - I think because the "exim -bV" stage did not
> show it in the "lookups (dynamic)" section, in turn because the
> modload faied.
> But with that pair of NEEDED items, the testcase for sqlite lookups
> passes (modulo debug output differences related to all the modules
> I'd built). ]
> So, while I'm not averse to shuffling that line for style, I think it
> has no effect.
Hello,
I am sorry, my mail was incomplete. Shuffling makes a difference for
me, with patch I get the expected result:
sid)ametzler@argenau:/tmp/EXIM4/exim4$ objdump -p ./build-Linux-x86_64/dynmodul
es/sqlite_lookup.so | grep NEEDED
NEEDED libsqlite3.so.0
NEEDED libc.so.6
I suspect it depends on the linker used whether the problem shows up. I
have been doing my tests on Debian/sid with gcc 15.2.0-11 and binutils
2.45.50.20251209-1.
The gcc manual says:
-llibrary
[...]
It makes a difference where in the command you write this option;
the linker searches and processes libraries and object files in the
order they are specified. Thus, ‘foo.o -lz bar.o’ searches library
‘z’ after file foo.o but before bar.o. If bar.o refers to functions
in ‘z’, those functions may not be loaded.
cu Andreas
--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## [email protected]
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/