Port-powerpc archive

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

Re: macppc __builtin_return_address crash in ld.elf_so on Xorg

Hash: SHA1


On Jun 14, 2008, at 16:58, Peter Bex wrote:
Hi all,

Today's -current userland with yesterday's kernel seem to build and
run fine on macppc, but Xorg segfaults when it tries to dynamically
load a library:

# gdb X
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc--netbsd"...(no debugging symbols found)

(gdb) run
Starting program: /usr/pkg/bin/X

X Window System Version 1.3.0
Release Date: 19 April 2007
X Protocol Version 11, Revision 0, Release 1.3
Build Operating System: UNKNOWN
Current Operating System: NetBSD byers.homeunix.org 4.99.64 NetBSD 4.99.64 (GENERIC) #0: Fri Jun 13 17:59:17 CEST 2008 sjamaan%byers.homeunix.org@localhost:/usr/obj/sys/arch/macppc/compile/GENERIC macppc
Build Date: 14 June 2008
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Sat Jun 14 22:22:09 2008
(==) Using config file: "/etc/X11/xorg.conf"

Program received signal SIGSEGV, Segmentation fault.
dlsym (handle=0xfffffffe, name=0xefb09e40 "pcidataModuleData")
    at /usr/src/libexec/ld.elf_so/rtld.c:825
825 retaddr = __builtin_return_address(0); /* __GNUC__ only */
(gdb) bt
#0  dlsym (handle=0xfffffffe, name=0xefb09e40 "pcidataModuleData")
    at /usr/src/libexec/ld.elf_so/rtld.c:825
#1  0x01862d94 in DLFindSymbol ()
#2  0x0186016c in LoaderSymbol ()
#3  0x018620fc in LoaderListDirs ()
#4  0x018627fc in LoadModule ()
#5  0x0185cb94 in xf86LoadModules ()
#6  0x0185ec4c in InitOutput ()
#7  0x01823ec8 in main ()
(gdb) l
820             switch ((intptr_t)handle) {
821             case (intptr_t)NULL:
822             case (intptr_t)RTLD_NEXT:
823             case (intptr_t)RTLD_DEFAULT:
824             case (intptr_t)RTLD_SELF:
825 retaddr = __builtin_return_address(0); /* __GNUC__ only */ 826 if ((obj = _rtld_obj_from_addr(retaddr)) == NULL) { 827 _rtld_error("Cannot determine caller's shared object");
828                             return NULL;
829                     }

Simple (probably naive) test programs that simply call
__builtin_return_address(0) or call dlopen followed by dlsym
do not crash.

Anyone have any idea what could be wrong here?

That's the Xserver's module loader trying to ldopen() some module. Magnus Henoch posted a hack to get around it on port-macppc a while ago, it appears to be a compiler bug since Xorg is so far the only program where __builtin_return_address(0) fails occasionally.
Unfortunately I have no idea how to fix it properly.
The workaround works fine on at least sparc, sparc64, sgimips and shark though, maybe I should just commit it and add an entry to HACKS.

have fun

PS: this is macppc ( or likely powerpc ) specific so let's continue the on the appropriate list(s).

Version: GnuPG v1.4.7 (Darwin)


Home | Main Index | Thread Index | Old Index