public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld --base-file option, dlltool generated exp files
@ 2023-05-03  0:51 Tom Kacvinsky
  2023-05-10 11:38 ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Kacvinsky @ 2023-05-03  0:51 UTC (permalink / raw)
  To: Binutils

[-- Attachment #1: Type: text/plain, Size: 2316 bytes --]

HI,

I have an interesting issue I am facing.  On Windows 10, using a custom
built
MinGW-w64 toolchain, based on binutils 2.38, the mingw-w64-crt v10.0.0 with
UCRT support, and GCC 12.1.0.  This also happens with binutils 2.40 and the
MinGW-w64 run time version v11.0.0 (recently released).

Of note, binutils 2.30 (ancient, I know), doesn't have this problem.

We use the GNAT portion of GCC for compiling our Ada code, and use gnatdll
for producing the DLL of our Ada code.

What I found through lots of experimentation is that either the base file
generated
by ld or the exp file generated by dlltool is off and is making a DLL that
causes our
applications to crash when run with Microsoft's Application Verifier.  The
steps I've
been following are laid out in the gnatdll user guide

https://gcc.gnu.org/onlinedocs/gnat_ugn/Using-gnatdll.html

Except I pass "-g -Wl,-v" to the -largs option of gnatdll so that gnatlink
keeps the
binder file around and gives me the exact ld invocation.  I then manually
follow the
steps, but by invoking the three linker commands and two dlltool
invocations as
as they would be if I ran everything though gnatdll.

The reason I say it's either the base file or the exp file is that I can
take my export
definition file (a .def file) and generate an import library and exp file
using Microsoft's
lib tool, and that exp file makes the final link produced a DLL that does
not have an
issue.  So I _suspect_, but am not sure, that either the base file
generated by ld using
the --base-file option is not right, and so dlltool produces an exp file
that isn't quite
right, or perhaps the base file is right, but dlltool is still generating
an exp file that has
problems.

I looked for commits in bfd/cofflink.c (where the .base file would be
generated) and also
looked at commits to dlltool, but nothing stood out.  But then I am not a
binutils expert.

I have a way around the problem without using a base file (just pass the
.def file directly
to ld so that an export table is generated), but I wanted to report this
issue.

What would be most useful for a reproducer?  I think I am going to have a
difficult time
paring our code down to an MRE, and I'm reluctant to release IP object code
(I can run
that up the flagpole, tough).

Any help would be much appreciated.

Regards,

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-15 11:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03  0:51 ld --base-file option, dlltool generated exp files Tom Kacvinsky
2023-05-10 11:38 ` Nick Clifton
2023-05-14 18:44   ` Tom Kacvinsky
2023-05-15 11:27     ` Tom Kacvinsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).