[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 --- Comment #10 from cvs-commit at gcc dot gnu.org cvs-commit at gcc dot gnu.org 2012-03-20 19:24:38 UTC --- CVSROOT:/cvs/src Module name:src Changes by:kti...@sourceware.org2012-03-20 19:24:32 Modified files: bfd: ChangeLog config.in configure configure.in plugin.c Log message: PR ld/12742 * configure.in (AC_CHECK_HEADERS): Test for windows.h and dlfcn.h. * plugin.c: Guard include of dlfcn.h if HAVE_DLFCN_H is defined. Add windows.h header include if HAVE_WINDOWS_H is defined. (dlerror): New static function if windows variant is used instead of dlfcn.h. (dlclose): Likewise. (dlopen): Likewise. (dlsym): Likewise. * configure: Regenerated. * config.in: Regenerated. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=srcr1=1.5633r2=1.5634 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/config.in.diff?cvsroot=srcr1=1.49r2=1.50 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/configure.diff?cvsroot=srcr1=1.360r2=1.361 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/configure.in.diff?cvsroot=srcr1=1.308r2=1.309 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/plugin.c.diff?cvsroot=srcr1=1.14r2=1.15 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 Kai Tietz ktietz at redhat dot com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #11 from Kai Tietz ktietz at redhat dot com 2012-03-20 19:30:52 UTC --- Fixed -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 --- Comment #9 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-03-01 21:29:25 UTC --- Tried again today and I can do a Canadian cross build and LTO works :-)) Configuration was Build = i686-pc-linux-gnu Host = i386-pc-mingw32 Target = avr-unknown-none With GCC 3.4.5 as linux - mingw32 cross and GCC from trunk with 50616 fixed. Binutils were from trunk but some days/weeks old. There was no fake libdl or dlfcn-win32 in the build environment. The last problem I had was that the linker calls the plugin but failed to operate properly on it; presumably unloading the dll but I don't know enough of that stuff. Anyways, now it works and a small LTO compile finished without error and produced reasonable results and optimizations that only LTO can perform. Great! Hope I will find the time to bundle the snapshot build so that more people can test and experiment with it and report problems. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 --- Comment #5 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-02-21 22:46:45 UTC --- Thanks for the patch, I can test after GCC's http://gcc.gnu.org/PR50616 is fixed. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 --- Comment #6 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-02-21 22:48:36 UTC --- Something strange happened to the link. Again GCC's PR: http://gcc.gnu.org/PR50616 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 --- Comment #7 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-02-21 22:49:50 UTC --- Ok, there is some PR magic. GCC PR number is 50616. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 --- Comment #4 from Kai Tietz ktietz at redhat dot com 2012-02-12 10:51:28 UTC --- Yes, with a dummy libdl.a (or with that version of dlfcn-win32 mentioned in comment #1), bootstrap works. I tried to find the cause for the -ldl adding on link, but couldn't find the explicit point. It might be reasoned by the fact that tcl.m4 code checks here for uname, which is of course for candian-cross the wrong choice. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 Kai Tietz ktietz at redhat dot com changed: What|Removed |Added CC||ktietz at redhat dot com --- Comment #2 from Kai Tietz ktietz at redhat dot com 2012-02-11 20:07:42 UTC --- Hmm, issue about -ldl is strange. It looks to me that libtool adds this link-library. The code in config/tcl.m4 shouldn't be active for windows-host. Patch for bfd ChangeLog 2012-02-11 Kai Tietz kti...@redhat.com * configure.in (windows.h, dlfch.h): Add check for headers. * configure: Regenerated. * plugin.c: Add for windows-native targets dl-api emulation. Index: config.in === RCS file: /cvs/src/src/bfd/config.in,v retrieving revision 1.49 diff -u -r1.49 config.in --- config.in12 May 2011 07:41:40 -1.49 +++ config.in11 Feb 2012 20:03:46 - @@ -245,6 +245,9 @@ /* Define if sys/procfs.h has win32_pstatus_t. */ #undef HAVE_WIN32_PSTATUS_T +/* Define to 1 if you have the windows.h header file. */ +#undef HAVE_WINDOWS_H + /* Define to 1 if you have the zlib.h header file. */ #undef HAVE_ZLIB_H Index: configure === RCS file: /cvs/src/src/bfd/configure,v retrieving revision 1.358 diff -u -r1.358 configure --- configure31 Jan 2012 17:54:32 -1.358 +++ configure11 Feb 2012 20:03:48 - @@ -13508,6 +13508,22 @@ fi + +for ac_header in windows.h dlfcn.h +do : + as_ac_Header=`$as_echo ac_cv_header_$ac_header | $as_tr_sh` +ac_fn_c_check_header_mongrel $LINENO $ac_header $as_ac_Header $ac_includes_default +eval as_val=\$$as_ac_Header + if test x$as_val = xyes; then : + cat confdefs.h _ACEOF +#define `$as_echo HAVE_$ac_header | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo $as_me:${as_lineno-$LINENO}: checking whether string.h and strings.h may both be included 5 $as_echo_n checking whether string.h and strings.h may both be included... 6; } if test ${gcc_cv_header_string+set} = set; then : Index: configure.in === RCS file: /cvs/src/src/bfd/configure.in,v retrieving revision 1.306 diff -u -r1.306 configure.in --- configure.in31 Jan 2012 17:54:34 -1.306 +++ configure.in11 Feb 2012 20:03:48 - @@ -190,6 +190,9 @@ GCC_HEADER_STDINT(bfd_stdint.h) AC_HEADER_TIME AC_HEADER_DIRENT + +AC_CHECK_HEADERS(windows.h dlfcn.h) + ACX_HEADER_STRING AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno) AC_CHECK_FUNCS(strtoull) Index: plugin.c === RCS file: /cvs/src/src/bfd/plugin.c,v retrieving revision 1.14 diff -u -r1.14 plugin.c --- plugin.c11 Jul 2011 15:03:07 -1.14 +++ plugin.c11 Feb 2012 20:03:49 - @@ -25,7 +25,13 @@ #if BFD_SUPPORTS_PLUGINS #include assert.h +#ifdef HAVE_DLFCN_H #include dlfcn.h +#elif defined (HAVE_WINDOWS_H) +#include windows.h +#else +#error Unknown how to handle dynamic-load-libraries. +#endif #include stdarg.h #include plugin-api.h #include sysdep.h @@ -34,6 +40,37 @@ #include libiberty.h #include dirent.h +#if !defined (HAVE_DLFCN_H) defined (HAVE_WINDOWS_H) + +#define RTLD_NOW 0 /* Dummy value. */ + +static void * +dlopen (const char *file, int mode ATTRIBUTE_UNUSED) +{ + return LoadLibrary (file); +} + +static void * +dlsym (void *handle, const char *name) +{ + return GetProcAddress (handle, name); +} + +static int ATTRIBUTE_UNUSED +dlclose (void *handle) +{ + FreeLibrary (handle); + return 0; +} + +static const char * +dlerror (void) +{ + return Unable to load DLL.; +} + +#endif /* !defined (HAVE_DLFCN_H) defined (HAVE_WINDOWS_H) */ + #define bfd_plugin_close_and_cleanup _bfd_generic_close_and_cleanup #define bfd_plugin_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define bfd_plugin_new_section_hook _bfd_generic_new_section_hook -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 --- Comment #3 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-02-11 23:38:50 UTC --- Thanks. Is this supposed to also fix problems with linux-mingw32-target canadian cross builds, e.g. as mentioned in comment #1? -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 --- Comment #1 from Georg-Johann Lay gjl at gcc dot gnu.org 2011-06-30 20:31:02 UTC --- I see this problem with binutils 2.21 when building canadian cross: Binutils configured: ../../source/binutils-2.21/configure --target=avr --prefix=/local/gnu/install/avr-gcc-4.6.1-mingw32 --host=i386-mingw32 --build=i686-linux-gnu --disable-nls --enable-lto --enable-plugin I tried to fix the dlfcn error by adding dlfcn-win32 to my i386-mingw32-gcc build environment: http://code.google.com/p/dlfcn-win32/ With that support binutils build fine, but when running the canadian cross-linker it fails to operate correctly on the lto plugin and throws an error. Not familiar with the dll/dlopen/LoadLibrary stuff at all, I gave up. Maybe the dlfcn-win32 ist not functional; I don't know. Maybe someone with more experience in that field likes to try. Note that dlfcn configure does not handle --prefix correctly. You must move it's definition down in configure. Johann -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 vanboxem.ruben at gmail dot com changed: What|Removed |Added CC||ktietz70 at googlemail dot ||com Host||*-*-mingw* -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/12742] ld error unrecognized option '-plugin' on mingw and how to build with plugins enabled on mingw
http://sourceware.org/bugzilla/show_bug.cgi?id=12742 vanboxem.ruben at gmail dot com changed: What|Removed |Added Version|2.21|2.20 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils