http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47225

--- Comment #35 from Iain Sandoe <iains at gcc dot gnu.org> 2011-02-08 09:56:08 
UTC ---
(In reply to comment #34)

> the correct fix is to add -module to the LTO plugin LDFLAGS.  This changes the
> extension from .dylib to .so.

Thanks, I suppose the intention of the other entry is really for hosts that
want to change the base-name of the plugin? (that wasn't 100% clear to me from
the comment in gcc/config.host).

anyway, something like this?

Index: lto-plugin/configure.ac
===================================================================
--- lto-plugin/configure.ac    (revision 169878)
+++ lto-plugin/configure.ac    (working copy)
@@ -9,6 +9,13 @@ AC_SYS_LARGEFILE
 AM_PROG_LIBTOOL
 ACX_LT_HOST_FLAGS
 AC_SUBST(target_noncanonical)
+case "${host}" in
+  *-darwin*)
+    # Darwin needs -module to produce a dylib with .so suffix
+    extra_ldflags_lto_plugin='-module'
+    ;;
+esac
+AC_SUBST(extra_ldflags_lto_plugin)
 AC_TYPE_INT64_T
 AC_TYPE_UINT64_T
 AC_HEADER_SYS_WAIT
Index: lto-plugin/Makefile.am
===================================================================
--- lto-plugin/Makefile.am    (revision 169878)
+++ lto-plugin/Makefile.am    (working copy)
@@ -11,6 +11,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
 AM_CFLAGS = -Wall -Werror
 AM_LIBTOOLFLAGS = --tag=disable-static

+extra_ldflags_lto_plugin = @extra_ldflags_lto_plugin@
+
 libexecsub_LTLIBRARIES = liblto_plugin.la

 liblto_plugin_la_SOURCES = lto-plugin.c
@@ -18,6 +20,7 @@ liblto_plugin_la_LIBADD = \
     $(if $(wildcard
../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,)
 # Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS
 liblto_plugin_la_LDFLAGS = $(lt_host_flags) -bindir $(libexecsubdir) \
+    $(extra_ldflags_lto_plugin) \
     $(if $(wildcard
../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a)

 all: copy_lto_plugin

Reply via email to