From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 1 22:55:36 2014 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F14ED8A for ; Sat, 1 Feb 2014 22:55:36 +0000 (UTC) Received: from shell0.rawbw.com (shell0.rawbw.com [198.144.192.45]) by mx1.freebsd.org (Postfix) with ESMTP id 7A9A7152E for ; Sat, 1 Feb 2014 22:55:36 +0000 (UTC) Received: from eagle.yuri.org (stunnel@localhost [127.0.0.1]) (authenticated bits=0) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id s11MtZRo017019 for ; Sat, 1 Feb 2014 14:55:35 -0800 (PST) (envelope-from yuri@rawbw.com) Message-ID: <52ED7B67.2090801@rawbw.com> Date: Sat, 01 Feb 2014 14:55:35 -0800 From: Yuri User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: FreeBSD Hackers Subject: r_debug in ld-elf.so.1 should be a public symbol to allow for an alternative run-time loader Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Feb 2014 22:55:36 -0000 I think it would be reasonable if r_debug and related symbols in the ld-elf.so.1 run-time loader would be made public. Currently, only r_debug_symbol is public out of all debugger-related symbols in ld-elf.so. This is done so that debuggers can add a breakpoint on it to get notified of changes in the set of loaded shared libraries. This is sufficient when ld-elf.so is the only one who loads objects. Now imagine the situation when an application wants to load its own ELF objects in its own way, still having the benefit of using the debug info. Such application would need to have access to the list of objects maintained by ld-elf.so. r_debug variable contains this list. Such application would necessarily be system specific, and would have to have the knowledge of some inner workings of ld-elf.so. But, in my opinion, this is a legitimate use and should be allowed. Therefore I am suggesting this patch. Except r_debug, it adds related lock object and functions to the list of publics, because they are needed to avoid race conditions. This is, of course, not a mainstream way to do things, but nevertheless it should be allowed. This is also a minor patch, and it can't possibly hurt anything else. --begin patch-- --- libexec/rtld-elf/Symbol.map (revision 260894) +++ libexec/rtld-elf/Symbol.map (working copy) @@ -15,6 +15,11 @@ dlinfo; dl_iterate_phdr; r_debug_state; + r_debug; + rtld_bind_lock; + rlock_acquire; + wlock_acquire; + lock_release; __tls_get_addr; }; --end patch-- Yuri