qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] contrib/plugins: add Darwin support
@ 2023-09-07 11:44 Paolo Bonzini
  2023-09-07 12:30 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2023-09-07 11:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, philmd

Under Darwin, using -shared makes it impossible to have undefined symbols
and -bundle has to be used instead; so detect the OS and use
different options.

Based-on: <20230907101811.469236-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
        This replaces Philippe's patch to link with GLib, and also fixes
        errors like

          "_qemu_plugin_get_hwaddr", referenced from:
	      _vcpu_mem in execlog.o

        I guess this shows that we're kinda losing in not using Meson
        for the plugins, but as I said I appreciate the didactic value
        of using a standalone Makefile (with only a handful of lines
        in configure).

 contrib/plugins/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index db1bd04dfa6..c26fa08441e 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -37,7 +37,11 @@ all: $(SONAMES)
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 lib%.so: %.o
+ifeq ($(CONFIG_DARWIN),y)
+	$(CC) -bundle -Wl,-undefined,dynamic_lookup -o $@ $^ $(LDLIBS)
+else
 	$(CC) -shared -o $@ $^ $(LDLIBS)
+endif
 
 clean:
 	rm -f *.o *.so *.d
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] contrib/plugins: add Darwin support
  2023-09-07 11:44 [PATCH] contrib/plugins: add Darwin support Paolo Bonzini
@ 2023-09-07 12:30 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-07 12:30 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: alex.bennee

On 7/9/23 13:44, Paolo Bonzini wrote:
> Under Darwin, using -shared makes it impossible to have undefined symbols
> and -bundle has to be used instead; so detect the OS and use
> different options.
> 
> Based-on: <20230907101811.469236-1-pbonzini@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>          This replaces Philippe's patch to link with GLib, and also fixes
>          errors like
> 
>            "_qemu_plugin_get_hwaddr", referenced from:
> 	      _vcpu_mem in execlog.o
> 
>          I guess this shows that we're kinda losing in not using Meson
>          for the plugins, but as I said I appreciate the didactic value
>          of using a standalone Makefile (with only a handful of lines
>          in configure).
> 
>   contrib/plugins/Makefile | 4 ++++
>   1 file changed, 4 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-07 12:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 11:44 [PATCH] contrib/plugins: add Darwin support Paolo Bonzini
2023-09-07 12:30 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).