From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18683 invoked by alias); 6 Jan 2020 23:39:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 18673 invoked by uid 89); 6 Jan 2020 23:39:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=globally, love, wish X-HELO: mail-io1-f44.google.com Received: from mail-io1-f44.google.com (HELO mail-io1-f44.google.com) (209.85.166.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Jan 2020 23:39:34 +0000 Received: by mail-io1-f44.google.com with SMTP id b10so50652895iof.11 for ; Mon, 06 Jan 2020 15:39:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7qYF77U6QILHt6AZ954eY29BtjLUhIGVZPIqvVVLIFI=; b=NPYYUfRITYJlFqSGpVG7cMrNPIBM/kwtGp+78p5qj8MWtX+AKwRSJGNcMKidw36Q11 WhA2Ey+YzOnw+3O00iQp4jXOKgLE+wKp+6mTuNvTn4NO5deB3Yjtl5So058k2++Rj2P+ pFk6PJ9O/qRL1GOZkRZFG8cQtcWWGbVjVjf4BTG21RhnHvMPXB9oXdrvvpyb5Wg9POxf RvtlngFwUEz/BlRUQlwc7ldZaR2SQsyAcJXc6oBu2FRdayAkrHOk8DXa+smCf8zC5Acz hrOWx4dBNh7ML6THuUZ8uOpJE6kJnsFuuPDJm8ko+J1r+yCcFj8xrJzzMd8ytoajoTYL 5Xng== MIME-Version: 1.0 References: <20200104202004.83439-1-nolange79@gmail.com> <466b1cd0-ce93-15f2-6986-aae17cbee6cf@redhat.com> In-Reply-To: <466b1cd0-ce93-15f2-6986-aae17cbee6cf@redhat.com> From: Norbert Lange Date: Mon, 06 Jan 2020 23:39:00 -0000 Message-ID: Subject: Re: [PATCH][PR build/24805] Explicitly export symbols from gdb_proc_service To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2020-01/txt/msg00138.txt.bz2 Am Mo., 6. Jan. 2020 um 20:21 Uhr schrieb Pedro Alves : > > On 1/4/20 8:20 PM, Norbert Lange wrote: > > Compiling GDB with '-fvisibility=hidden' will remove the > > symbols that should be exported. > > This patch explicitly marks them as visible. > > Curious. We have gdb/proc-service.list supposedly for this, > doesn't -Wl,--dynamic-list work with -fvisibility=hidden then? > > Thanks, > Pedro Alves > Obviously it doesn't, else I would not have spent time figuring out why libthread_db wont load. Unfortunately you need to pass the correct visibility to the compilation, a hidden symbol can be optimized globally almost like a static function locally. A visible symbol needs to be accessed though a layer of indirection. Wish you could disable that logic for micro controllers where that means you don't get simple relative jumps. Would love if the linker would be the only one controlling the type of symbol, that would make some subset of LTO required. But thats offtopic. -Wl,--dynamic-list merely filters the visible symbols, it does not see "hidden" ones. While we are at it, I see alot stuff exported from gdb, besides the proc_service. I am not sure where they come from or intentional # debian gdb # nm -D '/usr/bin/gdb' | grep ' [TVB] ' 0000000000491170 T _obstack_allocated_p 0000000000491040 T _obstack_begin 0000000000491060 T _obstack_begin_1 00000000004911b0 T _obstack_free 0000000000491220 T _obstack_memory_used 0000000000491080 T _obstack_newchunk 00000000002daf80 T ps_getpid 00000000000f4f10 T ps_get_thread_area 00000000002daea0 T ps_lgetfpregs 00000000002dadc0 T ps_lgetregs 00000000002daf10 T ps_lsetfpregs 00000000002dae30 T ps_lsetregs 00000000002dada0 T ps_pdread 00000000002dadb0 T ps_pdwrite 00000000002dace0 T ps_pglobal_lookup 0000000000163770 T xmalloc 00000000001637a0 T xrealloc 0000000000167790 T _Znam 00000000001677a0 T _ZnamRKSt9nothrow_t 0000000000167720 T _Znwm 0000000000167770 T _ZnwmRKSt9nothrow_t # gdb master built with -fvisibility=hidden nm -D '/tmp/devsupport_gdb/usr/local/bin/gdb' | grep ' [TVB] ' 0000000000a7e1a0 B __environ 0000000000a7e1a0 V environ 0000000000a7e1a8 B optarg 0000000000a7e1c8 B optind 00000000005e4f40 T ps_getpid 00000000007913c0 T ps_get_thread_area 00000000005e4fc0 T ps_lgetfpregs 00000000005e50a0 T ps_lgetregs 00000000005e4f50 T ps_lsetfpregs 00000000005e5030 T ps_lsetregs 00000000005e5120 T ps_pdread 00000000005e5110 T ps_pdwrite 00000000005e5130 T ps_pglobal_lookup 0000000000a7e1c0 B stderr 0000000000a7e1b0 B stdin 0000000000a7e180 B stdout 0000000000695510 T _Znam 0000000000691530 T _ZnamRKSt9nothrow_t 0000000000693ae0 T _Znwm 0000000000691550 T _ZnwmRKSt9nothrow_t 0000000000a6e040 V _ZTIN10__cxxabiv115__forced_unwindE 0000000000a6e1a8 V _ZTINSt13__future_base12_Result_baseE 0000000000a6dfc0 V _ZTINSt6thread6_StateE 0000000000a6dfd0 V _ZTISt12future_error 0000000000a6e0a0 V _ZTISt9bad_alloc 0000000000a6dfe8 V _ZTVN10__cxxabiv117__class_type_infoE 0000000000a6e050 V _ZTVN10__cxxabiv119__pointer_type_infoE 0000000000a6e110 V _ZTVN10__cxxabiv120__function_type_infoE 0000000000a6e0b8 V _ZTVN10__cxxabiv120__si_class_type_infoE 0000000000a6e150 V _ZTVN10__cxxabiv121__vmi_class_type_infoE 0000000000a6e1c0 V _ZTVSt12future_error