-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an optional COMDAT record for the .idata$3
section
#20
Conversation
Did you test that using this fixes the |
I've test that it can produce a lib file which I can use with |
Did you try including two import libraries files for different dll's and including those in the staticlib generated by rustc? Or did you only try a single import library? |
I was assuming the symbol would already have been found from another import library but good point. Now that I've got a hacky build of rustc that uses my branch of
It successfully links with the ar-archive-writer patch so this does appear to fix the issue. |
Published as v0.3.4. |
Wait, this is a breaking change. |
Yanked and re-published as v0.4.0. |
Do you know if there's anything blocking rustc itself from using ar-archive-writer in place of the LLVM writer? Or would it be ok to just make a PR that switches? |
There shouldn't be anything blocking the use of ar_archive_writer for generating import libraries for all backends. I wouldn't want to switch rlib/static lib generation since ar_archive_writer doesn't support LLVM IR objects. |
Thanks. That makes sense. |
One additional question: should we do something about It sounds like binutils 2.40 should be able to handle LLVM's import libraries, but if we can't require that any time soon, should we modify ar_archive_writer to have an "old binutils compat mode" that generates import libs like binutil's dlltool? |
I actually switched the LLVM backend to ar_archive_writer yesterday in rust-lang/rust#128936. The LLVM backend uses a custom |
You can probably copy https://github.com/rust-lang/rustc_codegen_cranelift/blob/69cec6faeacb062033fec5c80e2d828d774b6531/src/archive.rs#L20-L92 verbatim for switching other backends to ar_archive_writer for import library generation. |
I think mati865 is trying to update the mingw tools distributed with rust again. But there have been a lot of issues previously so I'm not too confident that it'll happen quickly. I guess there's also the question of what old distro's have. Which is to say, if we did implement that then it probably wouldn't be a wasted effort. |
Sorry to say, but I think I've convinced myself this isn't going to work. I just picked a platform (x64) a linker (msvc's I think import libs are fundamentally incompatible with |
Opened #22 to track removing this feature again. |
I wasn't entirely sure how to usefully test this but I inserted a thing to check that using the
comdat
option still results in the same object files being in the archive, except for the.idata$3
changes.Fixes #19