From patchwork Thu Jul 2 06:03:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 7468 Received: (qmail 121414 invoked by alias); 2 Jul 2015 06:03:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 121400 invoked by uid 89); 2 Jul 2015 06:03:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, KAM_STOCKGEN, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 02 Jul 2015 06:03:25 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A3728B893A for ; Thu, 2 Jul 2015 06:03:24 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6263KGV025958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 2 Jul 2015 02:03:23 -0400 Date: Thu, 2 Jul 2015 08:03:20 +0200 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org, Phil Muldoon Subject: [commit] [patch] debug compile: Replace confusing debug message Message-ID: <20150702060320.GA9214@host1.jankratochvil.net> References: <20150701122048.GA7170@host1.jankratochvil.net> <5593F4CE.8030605@redhat.com> <20150701141703.GA20031@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150701141703.GA20031@host1.jankratochvil.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Wed, 01 Jul 2015 16:17:03 +0200, Jan Kratochvil wrote: > On Wed, 01 Jul 2015 16:10:22 +0200, Pedro Alves wrote: > > It'd be nice to have a comment here mentioning why we need to do this. > > I do not know, I think it is a GCC bug, with -mcmodel=large I have no idea why > GCC needs _GLOBAL_OFFSET_TABLE_. I can write there this info. Checked in as attached. Jan It was found that from (gdb) set debug compile 1 (gdb) compile code 1 [...] allocated 0x7f bytes at 0x7ffff7ff9000 prot 5 allocated 0x38 bytes at 0x7ffff7ff8000 prot 1 lookup undefined ELF symbol "_GLOBAL_OFFSET_TABLE_" allocated 0x10 bytes at 0x7ffff7ff7000 for registers (gdb) _ the message 'lookup undefined ELF symbol' looks as an error to people, including to myself once. Change it to: allocated 0x7f bytes at 0x7ffff7ff9000 prot 5 allocated 0x38 bytes at 0x7ffff7ff8000 prot 1 ELF symbol "_GLOBAL_OFFSET_TABLE_" relocated to zero allocated 0x10 bytes at 0x7ffff7ff7000 for registers (gdb) _ gdb/ChangeLog 2015-07-02 Jan Kratochvil * compile/compile-object-load.c (compile_object_load): Replace debug message "lookup undefined ELF symbol" by 3 more specific messages. --- gdb/ChangeLog | 5 +++++ gdb/compile/compile-object-load.c | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 38a1633..249181d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-07-02 Jan Kratochvil + + * compile/compile-object-load.c (compile_object_load): Replace debug + message "lookup undefined ELF symbol" by 3 more specific messages. + 2015-07-01 Kevin Buettner * rl78-tdep.c (struct gdbarch_tdep): Add new field, rl78_psw_type. diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index 2b29b8b..8298748 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -731,14 +731,18 @@ compile_object_load (const char *object_file, const char *source_file, if (sym->flags != 0) continue; - if (compile_debug) - fprintf_unfiltered (gdb_stdlog, - "lookup undefined ELF symbol \"%s\"\n", - sym->name); sym->flags = BSF_GLOBAL; sym->section = bfd_abs_section_ptr; if (strcmp (sym->name, "_GLOBAL_OFFSET_TABLE_") == 0) { + if (compile_debug) + fprintf_unfiltered (gdb_stdlog, + "ELF symbol \"%s\" relocated to zero\n", + sym->name); + + /* It seems to be a GCC bug, with -mcmodel=large there should be no + need for _GLOBAL_OFFSET_TABLE_. Together with -fPIE the data + remain PC-relative even with _GLOBAL_OFFSET_TABLE_ as zero. */ sym->value = 0; continue; } @@ -748,10 +752,21 @@ compile_object_load (const char *object_file, const char *source_file, { case mst_text: sym->value = BMSYMBOL_VALUE_ADDRESS (bmsym); + if (compile_debug) + fprintf_unfiltered (gdb_stdlog, + "ELF mst_text symbol \"%s\" relocated to %s\n", + sym->name, + paddress (target_gdbarch (), sym->value)); break; case mst_text_gnu_ifunc: sym->value = gnu_ifunc_resolve_addr (target_gdbarch (), BMSYMBOL_VALUE_ADDRESS (bmsym)); + if (compile_debug) + fprintf_unfiltered (gdb_stdlog, + "ELF mst_text_gnu_ifunc symbol \"%s\" " + "relocated to %s\n", + sym->name, + paddress (target_gdbarch (), sym->value)); break; default: warning (_("Could not find symbol \"%s\" "