ld --base-file option, dlltool generated exp files
Tom Kacvinsky
tkacvins@gmail.com
Sun May 14 18:44:50 GMT 2023
Hi NIck,
On Wed, May 10, 2023 at 7:38 AM Nick Clifton <nickc@redhat.com> wrote:
> Hi Tom,
>
> > 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
>
> > 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 produce a DLL that does not have an issue.
>
> > 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.
>
> Thank you for doing this. It always helps when problems are reported, even
> if we do not have a solution available.
>
> Please could you file a bug report here:
>
> https://sourceware.org/bugzilla/enter_bug.cgi?product=binutils
>
>
I haven't yet done so as I am fighting getting at least the major versions
of
binutils between which things broke. I think that would help to have in the
bug report.
But it appears it is going to be more involved than I thought. I thought I
was
going to get away with building all of our code with one binutils (using the
version of binutils I know works) and then just swapping versions of
binutils
used for making the DLL until I find the version that broke. But that
process
ends up producing a DLL Windows does not like. :-(. So, I have to build the
entire GCC + binutils toolchain, with the binutils version changing and GCC
remaining fixed. This will take a while.
It also doesn't help that my MSYS2 + MinGW-w64 installation doesn't like
building 2.34 and 2.35 (before and after those versions, things are
fine). It
is a hang generating the files from pep.em and associated input files and
scripts.
>
> > 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
>
> Understood. A stand alone reproducer would be ideal, but if that is not
> possible then some further details on the problem would definitely help.
> For example - are you able to identify what is wrong the the DLLs being
> produced by the linker ? Do any of the various PE-file checker programs
> that are out there report any problems ?
>
I have reason to believe the problem is with relocations based on the .base
and .exp files, but I don't know if a PE checking program can validate
relocation
information. I'll have to look into this.
> Also - do you know if they problem happens with older versions of the
> binutils, eg 2.35 or 2.36 ? Possibly the problem is due to a (relatively)
> recent change to the linker.
>
See above - I am trying to figure this out.
> I cannot make any guarantees, but I will definitely look at any bug reports
> you file.
Thanks,
Tom
More information about the Binutils
mailing list