From owner-svn-src-all@FreeBSD.ORG Fri Oct 22 04:43:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FF001065673; Fri, 22 Oct 2010 04:43:05 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13D798FC12; Fri, 22 Oct 2010 04:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9M4h4gV013522; Fri, 22 Oct 2010 04:43:04 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9M4h4u6013519; Fri, 22 Oct 2010 04:43:04 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201010220443.o9M4h4u6013519@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 22 Oct 2010 04:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214194 - in head/libexec/rtld-elf: . ia64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Oct 2010 04:43:05 -0000 Author: marcel Date: Fri Oct 22 04:43:04 2010 New Revision: 214194 URL: http://svn.freebsd.org/changeset/base/214194 Log: Unbreak ia64. With r169630 I disabled symbol versioning because it broke rtld. With r211706 rtld got broken for ia64 & powerpc64. It was fixed for powerpc64 with r212497. In between, r211749 removed the exports table because the version script handled the exports. But wait, symbol versioning was disabled on ia64. With exports controlled by the version script and symbol versioning disabled, all symbols are exported and too many symbols bind to the definition in rtld. Let's just say that waird things happen. So, enable symbol versioning on ia64 and apply a work-around for the SIGSEGV that triggered r169630 to begin with: when rtld relocates itself, it comes across r_debug_state and for some reason can't find the definition. This causes a failure, relocation aborts and null pointers galore. The work-around is to ignore the missing definition when rtld is relocating itself and keep going. Maybe with the next binutils this will all go away. Maybe not, in which case I still need to figure out why r_debug_state cannot be found. BTW: r_debug_state is in the symbol map -- I don't think any other rtld symbols that rtld references are in the symbol map... Modified: head/libexec/rtld-elf/Makefile head/libexec/rtld-elf/ia64/reloc.c Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Fri Oct 22 03:05:34 2010 (r214193) +++ head/libexec/rtld-elf/Makefile Fri Oct 22 04:43:04 2010 (r214194) @@ -34,7 +34,6 @@ LDFLAGS+= -shared -Wl,-Bsymbolic DPADD= ${LIBC_PIC} LDADD= -lc_pic -lssp_nonshared -.if ${MACHINE_CPUARCH} != "ia64" .if ${MK_SYMVER} == "yes" LIBCDIR= ${.CURDIR}/../../lib/libc VERSION_DEF= ${LIBCDIR}/Versions.def @@ -48,7 +47,6 @@ ${PROG}: ${VERSION_MAP} SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map .endif .endif -.endif .sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" Modified: head/libexec/rtld-elf/ia64/reloc.c ============================================================================== --- head/libexec/rtld-elf/ia64/reloc.c Fri Oct 22 03:05:34 2010 (r214193) +++ head/libexec/rtld-elf/ia64/reloc.c Fri Oct 22 04:43:04 2010 (r214194) @@ -195,9 +195,22 @@ reloc_non_plt_obj(Obj_Entry *obj_rtld, O int sym_index; def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - false, cache); - if (def == NULL) - return -1; + true, cache); + if (def == NULL) { + /* + * XXX r_debug_state is problematic and find_symdef() + * returns NULL for it. This probably has something to + * do with symbol versioning (r_debug_state is in the + * symbol map). If we return -1 in that case we abort + * relocating rtld, which typically is fatal. So, for + * now just skip the symbol when we're relocating + * rtld. We don't care about r_debug_state unless we + * are being debugged. + */ + if (obj != obj_rtld) + return -1; + break; + } if (def->st_shndx != SHN_UNDEF) { target = (Elf_Addr)(defobj->relocbase + def->st_value);