tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

rtld.c weirdness on powerpc



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

see here: http://permalink.gmane.org/gmane.os.netbsd.ports.macppc/9602

For some reason we need this patch to get X.org working on macppc:

- --- rtld.c    7 Dec 2007 20:34:05 -0000       1.117
+++ rtld.c      8 Feb 2008 03:04:06 -0000
@@ -801,6 +801,12 @@
        return(NULL);
 }

+static void *
+hackish_return_address(void)
+{
+       return __builtin_return_address(1);
+}
+
 __strong_alias(__dlsym,dlsym)
 void *
 dlsym(void *handle, const char *name)
@@ -820,7 +828,8 @@
        case (intptr_t)RTLD_NEXT:
        case (intptr_t)RTLD_DEFAULT:
        case (intptr_t)RTLD_SELF:
- -             retaddr = __builtin_return_address(0); /* __GNUC__ only */
+               /* retaddr = __builtin_return_address(0);*/ /* __GNUC__ only */
+               retaddr = hackish_return_address();
                if ((obj = _rtld_obj_from_addr(retaddr)) == NULL) {
                        _rtld_error("Cannot determine caller's shared object");
                        return NULL;

Any idea why? The patch doesn't seem to have any ill side effects but I'd like to know why it works and why we need it.

have fun
Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQEVAwUBSCy/8cpnzkX8Yg2nAQJQpwgAsd9midhNM/cJXgdiv4fmor1iU3zFDE/n
0JGSGn69cK91UYIV7wBbqnEYrvt/hfqiGzZre0kf2auldAwayzjRm6vcHasDpSeV
jzGRnN9UX48MJ3gkfO7B4WHn3X+glFh5lQah0lIER3FxnBws6BT2ANsncscgEtDG
CRazfEljCC5kIaH6zbhtHg4+eiXYrWkc7fF+xY+70y9zJV+CVd3CHdBqeAWzODVg
tQRNocpj0eoOZCP2vIa3U/XiA60fH735W9hdPoVfHwh+FrOhiVHHcDsaZTVI79xz
Nxp7aqYqIc+hIRxaI72kA9GjmcBPpajmmFMmGl8bF4Eh4nXHBVUTpg==
=9vzD
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index