I tripped over this, while trying to regenerate an (apparently) defective libstdc++.dll.a import library, originally created during GCC-5.3.0 cross compiler build; it appears to be another manifestation of a parse error, similar but not identical to bug 13657. I reduced it to: $ cat foo.def LIBRARY libstdc++-6.dll EXPORTS _foo $ mingw32-dlltool --as mingw32-as --input-def foo.def --output-lib foo.dll.a ++mingw32-dlltool: Syntax error in def file foo.def:0 Notice the '++' prefixed to the diagnostic message; these seem to be residual input, unconsumed by the (lex?) scanner, while processing the LIBRARY spec within the def file. If I remove those '++' chars from the library name, then the LIBRARY spec is parsed successfully, but the DLL name is recorded (incorrectly) as 'libstdc-6.dll', within the generated import library. Alternatively, I can work around this bug by deleting the (valid and correct) LIBRARY spec from the def file, and instead adding '--dllname libstdc++-6.dll' as a command line option, but I guess you would want to fix the underlying bug. FWIW, I see exactly the same manifestation of this bug with every version of dlltool which I have to hand, in various corners of my file system, namely: binutils-2.21 binutils-2.23.1 binutils-2.24 binutils-2.26.20160125
Just realized that I can circumvent the failure by quoting the library name, within the def file, but that's not consistent with other usage. Perhaps it should be made so: either require that the library name always be quoted, or always correctly parse any valid file name, which doesn't require quoting by the shell, regardless of quoting.
Created attachment 9739 [details] Proposed patch Hi Marshall, Please could you try out this patch and let me know if it works for you. Cheers Nick