-
Notifications
You must be signed in to change notification settings - Fork 156
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
Read short import files #555
Conversation
One issue with testing in CI is that I've not yet figured out how to produce lib files with different name types using standard tools. I can test using lib files on my machine but committing them may be legally dubious (I am not a lawyer). |
That's one of the reasons for putting the test files in a separate repository, although I would prefer to be able to generate them using standard tools if we can. What are the standard tools for this? I could look into it too. |
In MSVC land, you can pass a LLVM has equivalents. E.g. |
Thanks for the info. I also found that you can use LLVM doesn't have any support for |
Ah, I figured out how to build with different name types. It depends on the architecture. x86 (aka i386) uses NoPrefix and arm64ex uses ExportAs. The "arm64ex" architecture isn't supported by LLVM tho. Here's my def file:
If you'll pardon my powershell, here's what I'm using to generate libs: MSVCforeach ($arch in 'arm','arm64','arm64ec','arm64x','x64','x86') { lib /def:test.def /machine:$arch /out:import_msvc_$arch.lib /NOLOGO } LLVMforeach ($arch in 'arm','arm64','i386','i386:x86-64') { llvm-dlltool -d test.def -l import_llvm_$($arch -replace 'i386:', '').lib -m $arch } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
See #512.
This adds some support for reading short import library files. These only appear in archives and are Windows specific. Unlike most other content of
.lib
archives, these are not object files. Instead they are a header that minimal describes how the linker should update the.idata
section (aka DLL import tables) for a specific symbol. This header is followed by two strings: the DLL name and the public symbol name. Note that according to a comment in src/pe.rs there can also be a third string, though I can't find this documented anywhere. In any case supporting it isn't difficult.I've added support to the objdump example to show how it could be used.
Posting this as a draft PR for feedback and just in case I don't have time to finish, someone else can pick it up. I still need to add some tests. It'd also be nice to have at least some minimal write support.