From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjl@nynexst.com (H.J. Lu) To: ian@cygnus.com (Ian Lance Taylor) Cc: gas2@cygnus.com Subject: Re: An ld bug? Date: Tue, 03 Oct 1995 08:20:00 -0000 Message-id: <9510031520.AA26422@nynexst.com> References: <199510031425.KAA23139@sanguine.cygnus.com> X-SW-Source: 1995/msg00175.html > > From: hjl@nynexst.com (H.J. Lu) > > It seems gas-950822 doesn't treat common symbols right. Does the newer > snapshot still have this bug? BTW, I tested it under i486-linux. > > It only takes you a minute to note what you think is incorrect about > the program. Please do that, rather than making me figure out what > the problem is. Thanks. Sorry for that. > > In this case, I assume that you think that the common symbol in the > object file should cause the object in the archive to be brought in. > That's the way in works in a.out, but it is not the way it works in > ELF. In ELF, objects are only brought in from archives to fill > references by undefined symbols. > > However, interestingly, I tested the program on Irix 5, UnixWare, and > Solaris, and, on Solaris, it works the way it does in a.out. I assume > this is for SunOS compatibility. It happens to contradict the Solaris > linker documentation: ``For an archive library, only those routines > defining an unresolved external reference are loaded.'' > >From my Solaris 2.3 linker manual, on page 12 regarding "Archive Processing", it says the link-editor will extract a relocatable object from an archive if it contains a data symbol definition that satisfies a common symbol definition. I think that makes sense. Maybe it has been changed in Solaris 2.4/2.5. Thanks. -- H.J. Lu NYNEX Science and Technology, Inc. hjl@nynexst.com