Port-macppc archive

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

Re: Xorg versus -current



Magnus Henoch <mange%freemail.hu@localhost> writes:

>               retaddr = __builtin_return_address(0); /* __GNUC__ only */

After noticing that gcc treats __builtin_return_adress(0) different from
__builtin_return_adress(N), I tried this patch:

--- 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;


And indeed, X.org no longer crashes, but works just like it did before.
("Before" is some time before the jemalloc merge, but seemingly
unrelated, as all of this is still with jemalloc disabled.)

So, is this a bug in gcc, or somewhere else?  It seems clear that a bug
report should be written, but I'm not sure what to write.  There is no
reproducing test case, as dlsym evidently works most of the time.  Any
clue would be appreciated.

Magnus




Home | Main Index | Thread Index | Old Index