1

I don't understand why dumpbin is returning x64 when executing the following on the Visual Studio command line:

dumpbin libgmp.lib /HEADERS |more

This is the GMP library compiled under Cygwin 32bit version, with the following build configuration:

./configure --host=i386 ABI=32

The build system compiled and built all the files successfully for the specified host. Yet, dumpbin still reports that the .a or .lib is for 64bit architectures.

Note that the output static library is libgmp.a, but I changed its extension to .lib and linked it with my Visual Studio project with no problems.

Another important note: Linking libgmp.lib with 32bit programs is fine, and produces a PE32 file, as reported by CFF Explorer.

Is it a dumpbin interpretation error, or am I missing something improtant?

MyNameIsUser
  • 119
  • 9
  • Does `file` say 64 or 32-bit? – Matthew Read Feb 20 '15 at 18:27
  • This is file's output: `libgmp.a: current ar archive` – MyNameIsUser Feb 20 '15 at 18:35
  • Well that's less useful output than one might hope. Try `objdump -f libgmp.a`. – Matthew Read Feb 20 '15 at 18:41
  • `objdump`'s output is interesting, I got some lines such `objdump: assert.o: File format not recognized`. The good thing is that it reports the target architecture as `i386`. What's the problem with dumpbin? – MyNameIsUser Feb 20 '15 at 18:46
  • Interesting. If I were to speculate I'd say it doesn't handle files built by Cygwin properly, but I don't know a lot about `dumpbin`. I assume the output of your `configure` command and the make output is clear of any x64 references? – Matthew Read Feb 20 '15 at 18:52
  • Yes! I'm sure of it. The output of the tools was all about 32bit and i386 platforms. The library can link with ease with my Visual Studio projects, so I don't think that it's a library compatibility error. As I read, gcc's and msvc's C static library structure is compatible. – MyNameIsUser Feb 20 '15 at 19:00
  • I think the "Unrecognized .o" files are 64bit. I ran `objdump -f libgmp64.lib` and got all the embedded `.o` files to be unrecognized. – MyNameIsUser Feb 20 '15 at 19:17

1 Answers1

0

It appears that there are no 64bit or 32bit static library types. After performing some assertions on the library using objdump and dumpbin, both were reporting correct information.

objdump reported some of the object files to be 64bit and the others 32bits. dumpbin did the same thing.

The problem boils out from the GMP build system; It embedded both 64bit and 32bit object files into the static library.

Your program will link correctly to 32bit applications as long as you don't use any facilities found in one of the 64bit object files, which explains CFF's output.

In order to fix this problem, you must contact the GMP website.

MyNameIsUser
  • 119
  • 9