[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading
From: |
Alex Bligh |
Subject: |
Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading |
Date: |
Mon, 16 Sep 2013 12:00:47 +0100 |
On 16 Sep 2013, at 11:38, Paolo Bonzini wrote:
> No, librbd does need to be there for the other symbols that are not weak
> (e.g. rbd_aio_read). This approach cannot be "taken to the limit", i.e.
> removing the librbd dependency altogether. For example:
>
> xx.c:
> int f(void)
> {
> return 42;
> }
>
> yy.c:
> #pragma weak f
> extern int f(void);
> int main()
> {
> printf("%p %d", f, f ? f(): 67);
> }
>
> $ gcc xx.c -shared -o xx.so
> $ LD_RUN_PATH=$PWD gcc yy.c xx.so -o yy
> $ ./yy
> 0x4005b0 42
> $ rm xx.so
> $ ./yy
> ./yy: error while loading shared libraries: xx.so: cannot open shared
> object file: No such file or directory
I think you need to wrap f, i.e. take g as a pointer to f(), and
call g().
> Also, the code _is_ ugly. Do it once and it's perhaps acceptable. Do
> it for libiscsi, librbd, libcurl, libssh2, SPICE, GTK+, SDL etc. and it
> becomes unmaintainable.
I agree it's ugly. However, it's pretty much the only way to cope
with different versions of libraries.
However, even if you don't use weak symbols, we could simply dlopen()
a fixed list of modules known at compile time from a single directory
(because we also know at compile which executable needs what, e.g.
that qemu-img doesn't need spice or whatever).
--
Alex Bligh
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, (continued)
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Paolo Bonzini, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Fam Zheng, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Richard Henderson, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Fam Zheng, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Richard Henderson, 2013/09/17
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Gerd Hoffmann, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Paolo Bonzini, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Richard Henderson, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Alex Bligh, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Paolo Bonzini, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading,
Alex Bligh <=
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Daniel P. Berrange, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Alex Bligh, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Paolo Bonzini, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Alex Bligh, 2013/09/16
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Wenchao Xia, 2013/09/17
- Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Fam Zheng, 2013/09/16
Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading, Daniel P. Berrange, 2013/09/16