From: Tom Tromey <tromey@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/4] Handle copy relocations
Date: Tue, 30 Jul 2019 21:00:00 -0000 [thread overview]
Message-ID: <87d0hrkzl3.fsf@tromey.com> (raw)
In-Reply-To: <a0801bf5-7c0a-2e55-92b9-35ae70f1a716@redhat.com> (Pedro Alves's message of "Sat, 20 Jul 2019 02:10:58 +0100")
Pedro> To be more correct, this depends on ABI, or how you compile your
Pedro> binary. Compiling the main binary as PIC/PIE may or may not use
Pedro> copy relocations and use GOT accesses instead, for example.
Yes, thanks for mentioning that.
Pedro> I'm surprised to find no tests in this patch?
The existing Ada exception-catching tests cover this, so I didn't add a
new test.
Pedro> FAIL: gdb.base/print-file-var.exp: hidden=1: dlopen=0: version_id_main=0: 'print-file-var-lib2.c'::this_version_id == v2
I haven't investigated the other failures yet, but I think this one in
particular is an existing bug in c-exp.y. What happens is that this
does not actually look up the symbol from that source file! Instead it
finds the symbol in print-file-var-lib1.c.
Pedro> But I'm wondering whether fixing the hidden=1 cases would fit
Pedro> with the design of your patch, or does that scenario require
Pedro> thinking about all this differently?
I think applying the appended probably makes sense. This rules out
symbols where the corresponding minsym is hidden.
Tom
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f81efb4f433..90dfde0f1e9 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -21653,11 +21653,19 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
else if (attr2 && (DW_UNSND (attr2) != 0))
{
if (SYMBOL_CLASS (sym) == LOC_STATIC
- && (objfile->flags & OBJF_MAINLINE) == 0)
+ && (objfile->flags & OBJF_MAINLINE) == 0
+ && dwarf2_per_objfile->can_copy)
{
/* A global static variable might be subject to
- copy relocation. */
- sym->maybe_copied = dwarf2_per_objfile->can_copy;
+ copy relocation. We first check for a local
+ minsym, though, because maybe the symbol was
+ marked hidden, in which case this would not
+ apply. */
+ minimal_symbol *found
+ = (lookup_minimal_symbol_linkage
+ (SYMBOL_LINKAGE_NAME (sym), objfile));
+ if (found != nullptr)
+ sym->maybe_copied = 1;
}
/* A variable with DW_AT_external is never static,
next prev parent reply other threads:[~2019-07-30 21:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-27 14:52 [PATCH 0/4] Handle copy relocations and add $_ada_exception Tom Tromey
2019-06-27 14:52 ` [PATCH 3/4] Back out earlier Ada exception change Tom Tromey
2019-06-27 14:52 ` [PATCH 1/4] Change SYMBOL_VALUE_ADDRESS to be an lvalue Tom Tromey
2019-07-20 23:17 ` Simon Marchi
2019-07-23 15:53 ` Tom Tromey
2019-06-27 14:52 ` [PATCH 2/4] Handle copy relocations Tom Tromey
2019-07-20 1:11 ` Pedro Alves
2019-07-30 21:00 ` Tom Tromey [this message]
2019-07-30 21:28 ` Tom Tromey
2019-07-31 19:21 ` Tom Tromey
2019-06-27 15:02 ` [PATCH 4/4] Add $_ada_exception convenience variable Tom Tromey
2019-06-27 17:35 ` Eli Zaretskii
2019-06-28 18:46 ` Tom Tromey
2019-06-28 19:43 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d0hrkzl3.fsf@tromey.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox