From: Paul G. <pga...@co...> - 2003-09-09 10:15:55
|
On 9 Sep 2003 at 11:36, Luke Dunstan wrote: > > ----- Original Message ----- > From: "Paul G." <pga...@co...> > To: <min...@li...> > Sent: Monday, September 08, 2003 11:12 AM > Subject: [Mingw-users] dllwrap related bug? (possibly OT) > > > > I have been seeing some weird things going on when using dllwrap. > > As I am > aware dllwrap is being deprecated, I am > > hesitant to ask these questions as they may not have any bearing on > anything related to Mingw. > > > > Nevertheless I will push on... > > [Using NT4 Wks -- SP6a, Mingw 3.0.0.1 under Msys (not using > > msysdvlpr)] > > > > Does dllwrap assign the preferred base address for .dlls or is that > > done > by another agent such as ld? > > > > (Personally I had, in the past, and up until now, hypothesized that > > ld was > responsible for actually "creating" a > > Mingw generated .dll/module -- is this an accurate hypothesis?). > > > > If dllwrap (or dlltool) is expected to assign a preferred base > > address for > each .dll that ld eventually > > generates/creates, then how is it possible that an agent (one of > > three > agents, dllwrap, dlltool, or ld) can assign the > > exact same preferred base address for two entirely different .dlls? > > > > Does using "dllwrap -v" give you any clues? Using dllwrap -v indicates, if I am understanding the output properly, that dlltool is being multiply invoked, or invoked several different times (twice in this case). Each time dlltool is invoked, dlltool is always yielding the exact same --image-base option value. There are actually two other .dlls displaying this behaviour, and both are yielding, repeatedly, identical, or nearly so, --image-base option values. > IIRC it will show the > multiple invocations of dlltool/gcc and it might show the > "--image-base" option. If you are finding that multiple DLLs have a > base address of "0x10000000" then I think that is just the default > value. Thank you, Luke. > > > If ld is responsible for assigning the preferred base addresses for > > each > .dll that ld eventually creates, how is it > > possible for ld to not assign a different preferred base address for > > every > single Mingw generated .dll? > > > > I would appreciate any feedback or discussion on this. > > > > Thanks, > > "ld" assigns the default image base using a hash algorithm on the DLL > filename, and there is always the possibility two filenames hashing to > the same value. In the case of dllwrap though, I don't know whether > the base address is assigned by ld or dlltool or dllwrap. Me either. dlltool seems to be creating an --image-base option when it is being invoked. It may be that said value, as assigned by dlltool, is being passed to ld. If dlltool is generating the value for the --image-base option, dlltool is doing so in what appears to be complete isolation, ie. dlltool has absolutely no idea or care as to whether the value being assigned to --image-base has been generated by ld prior to the current execution of dlltool or not. Afaik, dlltool and ld do not communicate with each other (ie. pass arguments back and forth). So when it comes to what ld already knows in terms of values of the --image-base option, dllwrap hasn't a clue. Is that actually the case? I think it is important for me to note that just because I think I know something doesn't necessarily mean that I do know something. Afaik, dlltool assigns the value to the --image-base option and then passes that argument value on to ld. ld, for its part, may just assume that whatever dlltool is sending "must be a valid --image-base option", and subsequently (albeit "mindlessly") applies the value of the argument that was sent by dlltool to ld when ld finally gets around to creating the .dll. Is that how --image-base options are generated and forwarded to ld from dllwrap/dlltool? Paul G. |