Closed revelator closed 2 years ago
The problem is dlfcn-win32, SYSTEMTIME and FILETIME comes from minwinbase.h which is included by winbase.h and finally by windows.h, dlfcn.h includes neither and the gold plugin seems to assume that it does so these end up undefined if dlfcn-win32 is installed with the current patchset. moving the dlfcn.h header out of the place fixes things but it would probably be better with a more permanent fix.
@revelator I dont install dlfch-win32 at all in system because in this case most packages will build with it.
So should we remove it from packages ?
@revelator I will leave it in packages but I dont recommend to install it if you really dont need it. I will not build packages that depends on this library
Seems resonable, it was mostly intended as a tool for porting some stubborn packages anyway.
Hmm small whoops, previous binutils linked with dlfcn-win32 worked fine with liblto_plugin.dll copied to /mingw
@revelator As I know plugins not working without dlfcn-win32
Ah damn, i wonder what changed from previous versions since this no longer works. Maybe i should ready a patch fixing up binutils dlfcn replacement functions based on dlfcn-win32, would this be considered apropriate ?. LTO builds work much better when this plugin works so id really like to have it back.
@revelator create pull request and i will look
Will do, will probably take some testing and comparing it with earlier builds to see why it broke in this release in the first place, but as soon as i have something solid ill make a pull request.
Ok got it working, one small snag though, it requires linking in the psapi library and binutils dont link this in by default, so where would be the best place to add this in the autotools chain ?.
@revelator possibly need to add additional library in configure script
Oki, ill see what i can come up with. Easier way though is just exporting LIBS+="-lpsapi" but thats a bit messy.
Not having much luck finding a good place to getting this library in yet. I have a hunch that i might need to do some additions to configure.ac and then rebuild the autotool toolchain, the only places i found where i could plug it in are to specific to some code, and atm i need this library linked in with bfd ld ranlib and gold. Besides that it works extremely well now if i just link psapi in globally.
Uh oh... anyone remember the bug in binutils-2.26 with to many files open ? guess what its back. To make sure it had nothing to do with my fixing the dlfcn replacements for plugin support i tried downloading an unmodified version from here and it also has this.
Try building clang, the error comes allmost at the end of the build. Had to downgrade to 2.25 to be able to build clang.
finally got it done, it became a bit messy but now binutils support loading plugin dll's like the lto_plugin.dll if it is placed in /mingw*/lib/bfd-plugins.
The dlfcn code was taken from dlfcn-win32 because the inbuilt minimal version does not support loading plugins from external folders.
This patch also works with binutils-2.30
Gold linker doesn't use BFD and supports only ELF format, porting it would need a lot of effort. I doubt it'd be worth the time.
true i could probably remove the plugin support from the gold linker to simplify the patch a bit. Strangely even though bfd has plugin support it seems ld also needs the same code which is kinda overkill. Ill see if i can come up with a way to simplify things a bit, but in the meantime feel free to use my patch if you like.
gold linker is no longer supported/shipped on Windows.
Seems gold has plugin support as well, but none that work with windows. Unfortuantly golds plugin support also gets enabled when we specify plugin support so the build fails.