This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch/RFC] ld/pe-dll.c: mark .reloc section as discardable unlessbuilding a relocatable dll


Danny Smith wrote:

If the DLL was built with --shared, the .reloc section is not marked as discardable.
The patch only effects .exe files and dll's built with --dll switch.


Uh, oh, I see the  problem now.  Some makefiles (eg the mingw runtime rule for
libmingwm10.dll)and libtool still use the 'old' way of building relocatable dll's
with dlltool. eg

gcc -s -Wl,--base-file,mydll.base -o mydll.dll mydll.o -Wl,-e,_mydll_init@12 dlltool --base-file mydll.base --def mydll.def --output-exp mydll.exp --dllname mydll.dll
gcc -s -Wl,--base-file,mydll.base,mydll.exp -o mydll.dll mydll.o -Wl,-e,_mydll_init@12
dlltool --base-file mydll.base --def mydll.def --output-exp mydll.exp --dllname mydll.dll
gcc -Wl,mydll.exp -o mydll.dll mydll.o -Wl,-e,_mydll_init@12

Libtool 1.5 uses gcc -shared; only the defunct, but still widely used, libtool-1.4.3 uses dlltool.



or the equivalent using --dll switch.


So I see where my patch will cause problems. I withdraw it.

Perhaps a new switch (--discardable-pe-dll-relocs) could be introduced and
build_filler_bfd would use that?

I suppose --strip -R .reloc isn't too hard, so maybe we just need to
document how to build  a non-relocatable dll now using that.

Funny, this was a hot topic of debate on cygwin-apps/developers(?) about a year ago. Nobody could remember how exactly to make a dll non-relocatable. It came up because we were thinking of doing fancy non-reloc stuff for cygwin1.dll to help with the "fork/exec problem". But instead "we" developed the rebase tool...


Also need to note the fact that the gcc -mdll switch is now effectiveley
the same as -shared.

Yup. 'Course, some of us (okay, maybe it's just me) are plain ignorant and thought they were the same all along. :-)


--
Chuck


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]