diff mbox series

[PULL,19/51] contrib/plugins: add Darwin support

Message ID 20230907130004.500601-20-pbonzini@redhat.com
State New
Headers show
Series [PULL,01/51] linux-user, bsd-user: disable on unsupported host architectures | expand

Commit Message

Paolo Bonzini Sept. 7, 2023, 12:59 p.m. UTC
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>
---
 contrib/plugins/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

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