From owner-freebsd-arm@FreeBSD.ORG Tue Jun 16 10:01:46 2009 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF490106566B; Tue, 16 Jun 2009 10:01:46 +0000 (UTC) (envelope-from venkiece2005@gmail.com) Received: from mail-gx0-f207.google.com (mail-gx0-f207.google.com [209.85.217.207]) by mx1.freebsd.org (Postfix) with ESMTP id 9A5708FC20; Tue, 16 Jun 2009 10:01:46 +0000 (UTC) (envelope-from venkiece2005@gmail.com) Received: by gxk3 with SMTP id 3so6816387gxk.19 for ; Tue, 16 Jun 2009 03:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=scLu95xR/Q1lhFNSxU3JsroV2l2GkFg510kiws1Bw0M=; b=Hek50uJ4Cq8VGvsyl7sMI8MfkBBoxIhhw2qm+jYXuYiY4Mnx9Sb7C5fELtSmwn9MvL NujpkGyOlJbljrtHyq3up+h/yzCmo1kzTfVwJcca39Ak7Ms7HSX+YXeM7aczUjxq96Bp 8yZb5sUkYJ3FZEVR9tL9vB7x3pYZ/BcPw1QKk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=ceV/FN4SyEwn0YZw9xg6AauB2A0Zk/9ic3IFFRzuZ+yxL9tbfjfdgnC03A6bRdpCxI ObO2pJrv8Y7+bbe1vcLKUTjLGoyQjsMwxkFWbLvUpaG3Rji5bqKG5igcMoGdlWyO/Mm1 Qbj9JNnbRdofmDt1LLGw08r/N+XwHZTqPHRL8= MIME-Version: 1.0 Received: by 10.151.119.3 with SMTP id w3mr15306939ybm.149.1245144576692; Tue, 16 Jun 2009 02:29:36 -0700 (PDT) Date: Tue, 16 Jun 2009 14:59:36 +0530 Message-ID: <6d53329e0906160229j2fdba518h84b13652153a32f6@mail.gmail.com> From: venki kaps To: freebsd-arm@freebsd.org, netbsd-users@netbsd.org, freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Subject: [libc] dlclose gives "invalid shared object handle" without pthread combination. X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2009 10:01:47 -0000 Hi, I am using the NetBSD implementation of rtld(src/libexec/ld.elf_so/) for ARM/MIPS. I have C++ static constructor/destructor issue with my rtld. Problem Report: "ld.elf_so does not execute .init/.fini functions in order" and [libc] dlclose gives "invalid shared object handle" when called through the fini function of another module. The similar NetBSD/freeBSD issues are found from the following References: [1] http://gnats.netbsd.org/37347 [2] http://updraft3.jp.freebsd.org/cgi/query-pr.cgi?pr=kern/42956 The above issues are already commited in NetBSD-5-0-RELEASE. I have ported NetBSD-5-0-RELEASE rtld and tested Ref[1] provided static constructor/destructor test and did not find any issues with shared pthread combination but noticed [libc] dlclose gives "invalid shared object handle" without pthread combination. The static constructor/destructor test results: It should be : -------------- $ ./foobar foo_ctor bar_ctor tar_ctor main_ctor dep1_ctor dep2_ctor dll_ctor dll_dtor dep2_dtor dep1_dtor main_dtor tar_dtor bar_dtor foo_dtor While currently I get: ---------------------- with pthreads: $ ./foobar foo_ctor bar_ctor tar_ctor main_ctor dep1_ctor dep2_ctor dll_ctor dll_dtor dep2_dtor dep1_dtor main_dtor tar_dtor bar_dtor foo_dtor without pthreads: $ ./foobar foo_ctor bar_ctor tar_ctor main_ctor dep1_ctor dep2_ctor dll_ctor dll_dtor dep2_dtor dep1_dtor main_dtor tar_dtor bar_dtor foo_dtor Invalid shared object handle 0xbdbed400 This gives a "invalid shared object handle" message because the refcount field (obj->dl_refcount) for the handle is zero. I have little bit confused about dlclose destructor with/without pthreads. I have some queries: 1) Is it required any changes apart from the NetBSD-5-0-RELEASE/{Ref[1],[2]}? 2) Are any changes required in thread-stub? Could anyone provide any inputs to the my issue? Thanks in advance. Thanks & Regards, Venkappa