Subject: Re: Removal of SA vs. icky libc ABI breakage
To: None <tech-userlevel@netbsd.org>
From: Lubomir Sedlacik <salo@Xtrmntr.org>
List: tech-userlevel
Date: 03/05/2007 02:46:39
--ElEgulhWJDonIdTi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Mar 04, 2007 at 06:47:58PM +0000, David Laight wrote:
> I think that it may only be necessary to create a small .so containing
> the new syscall stubs.  Then only the new libpthread would be needed.
>=20
> Maybe ld.so.conf could get the library loaded, alternatively it could
> be built with a .SONAME matching that of libpthread, with a .NEEDED
> entry to pull in the new libpthread itself.

both ways work, i just tested.  here's what i did.

1)

 - linked the proxy lib:

 [/opt/obj/lib/libc]> /opt/tools/bin/i386--netbsdelf-ar cq
    libpthread_lwp_stubs.a `lorder _lwp_kill.so _lwp_detach.so
    _lwp_park.so _lwp_unpark.so _lwp_unpark_all.so|tsort`
 [/opt/obj/lib/libc]> /opt/tools/bin/i386--netbsdelf-ranlib
    libpthread_lwp_stubs.a
 [/opt/obj/lib/libc]> /opt/tools/bin/i386--netbsdelf-gcc -Wl,-nostdlib
    -B/opt/obj/destdir.i386/usr/lib/ -B/opt/obj/destdir.i386/usr/lib/
    -Wl,-rpath-link,/opt/obj/destdir.i386/lib:/opt/obj/destdir.i386/usr/lib
    -R/lib  -L/opt/obj/destdir.i386/lib  -Wl,-x -shared
    -Wl,-soname,libpthread_lwp_stubs.so.0   -o libpthread_lwp_stubs.so.0
    -Wl,--whole-archive test.a  -Wl,--no-whole-archive
    -L/opt/obj/destdir.i386/usr/lib

 - copied libpthread_lwp_stubs.so.0 into /usr/lib in the chroot,

 - copied the libpthread.so.0.7 from -current and changed symlinks
   in /lib and /usr/lib,

 - added it to ld.so.conf:

   libpthread.so.0 kern.ostype NetBSD:libpthread_lwp_stubs.so.0,libpthread.=
so.0

2)

 - temporary changed soname for the new libpthread:

 [/usr/src/lib/libpthread]> /opt/tools/bin/i386--netbsdelf-gcc
    -Wl,-nostdlib -B/opt/obj/destdir.i386/usr/lib/
    -B/opt/obj/destdir.i386/usr/lib/
    -Wl,-rpath-link,/opt/obj/destdir.i386/lib:/opt/obj/destdir.i386/usr/lib
    -L/opt/obj/destdir.i386/lib  -Wl,-x -shared
    -Wl,-soname,libpthread.so.0.7 -o libpthread.so.0.7
    -Wl,--whole-archive libpthread_pic.a -Wl,--no-whole-archive
    -L/opt/obj/destdir.i386/usr/lib

 - installed it to DESTDIR:

 [/usr/src/lib/libpthread]> /opt/tools/bin/nbmake-i386 OBJDIR=3D/opt/obj in=
stall

 - linked the proxy lib:

 [/opt/obj/lib/libc]> /opt/tools/bin/i386--netbsdelf-gcc -Wl,-nostdlib
    -B/opt/obj/destdir.i386/usr/lib/ -B/opt/obj/destdir.i386/usr/lib/
    -Wl,-rpath-link,/opt/obj/destdir.i386/lib:/opt/obj/destdir.i386/usr/lib
    -R/lib  -L/opt/obj/destdir.i386/lib  -Wl,-x -shared
    -Wl,-soname,libpthread.so.0 -o libpthread_lwp_stubs.so.0
    -Wl,--whole-archive test.a  -Wl,--no-whole-archive
    -L/opt/obj/destdir.i386/usr/lib -pthread

 - checked it has the correct .NEEDED:

 [/opt/obj/lib/libc]> objdump -p libpthread_lwp_stubs.so.0|grep NEEDED
  NEEDED      libpthread.so.0.7

 - copied it to /usr/lib in the chroot and pointed symlinks for
   libpthread.so and libpthread.so.0 to it


but these work only for the load time.  how would you solve the issue at
the link time?


regards,

--=20
-- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

--ElEgulhWJDonIdTi
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (NetBSD)

iD8DBQFF63Z/iwjDDlS8cmMRAsUyAKCB7Bg4aaPDIoNJhDke1LQpdWqZKACfdJpz
mAzb91ZKWLd0rcSq70cTG5c=
=POXq
-----END PGP SIGNATURE-----

--ElEgulhWJDonIdTi--