* [PATCH] Don't look up a stub for an undefined symbol.
@ 2017-06-07 21:59 Eric Christopher
2017-06-07 22:47 ` Han Shen via binutils
2017-06-08 0:36 ` Cary Coutant
0 siblings, 2 replies; 5+ messages in thread
From: Eric Christopher @ 2017-06-07 21:59 UTC (permalink / raw)
To: binutils; +Cc: shenhan, Cary Coutant
[-- Attachment #1: Type: text/plain, Size: 625 bytes --]
Hi Cary, Han,
Here's a quick patch that:
a) Adds some gold_debug target debugging to look for mismatched cases
of having a stub and looking for a stub, and
b) Notices that we were trying to look up a stub to an undefined
symbol when we were explicitly not creating a stub for it earlier.
OK?
Thanks!
-eric
2017-06-07 Eric Christopher <echristo@gmail.com>
* aarch64.cc (maybe_apply_stub): Add debug logging for looking
up stubs to undefined symbols and early return rather than
fail to look them up.
(scan_reloc_for_stub): Add debug logging for no stub creation
for undefined symbols.
[-- Attachment #2: z.diff.txt --]
[-- Type: text/plain, Size: 1222 bytes --]
diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index c9bb6b730d..dd6a7ddab3 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -3746,8 +3746,13 @@ Target_aarch64<size, big_endian>::scan_reloc_for_stub(
psymval = &symval;
}
else if (gsym->is_undefined())
- // There is no need to generate a stub symbol is undefined.
- return;
+ {
+ // There is no need to generate a stub symbol is undefined.
+ gold_debug(DEBUG_TARGET,
+ "stub: not creating a stub for undefined symbol %s in file %s",
+ gsym->name(), aarch64_relobj->name().c_str());
+ return;
+ }
}
// Get the symbol value.
@@ -5403,6 +5408,14 @@ maybe_apply_stub(unsigned int r_type,
if (stub_type == ST_NONE)
return false;
+ // We don't create stubs for undefined symbols so don't look for one.
+ if (gsym && gsym->is_undefined()) {
+ gold_debug(DEBUG_TARGET,
+ "stub: looking for a stub for undefined symbol: %s",
+ gsym->name());
+ return false;
+ }
+
const The_aarch64_relobj* aarch64_relobj =
static_cast<const The_aarch64_relobj*>(object);
The_stub_table* stub_table = aarch64_relobj->stub_table(relinfo->data_shndx);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't look up a stub for an undefined symbol.
2017-06-07 21:59 [PATCH] Don't look up a stub for an undefined symbol Eric Christopher
@ 2017-06-07 22:47 ` Han Shen via binutils
2017-06-07 22:52 ` Eric Christopher
2017-06-08 0:36 ` Cary Coutant
1 sibling, 1 reply; 5+ messages in thread
From: Han Shen via binutils @ 2017-06-07 22:47 UTC (permalink / raw)
To: Eric Christopher; +Cc: binutils, Cary Coutant
Hi Eric, thanks for fixing this. LGTM
BTW, instead of assertion failure in the middle, with this patch, link
proceeds and ends up with "undefined symbols", correct?
Han
On Wed, Jun 7, 2017 at 2:59 PM, Eric Christopher <echristo@gmail.com> wrote:
> Hi Cary, Han,
>
> Here's a quick patch that:
>
> a) Adds some gold_debug target debugging to look for mismatched cases
> of having a stub and looking for a stub, and
> b) Notices that we were trying to look up a stub to an undefined
> symbol when we were explicitly not creating a stub for it earlier.
>
> OK?
>
> Thanks!
>
> -eric
>
> 2017-06-07 Eric Christopher <echristo@gmail.com>
>
> * aarch64.cc (maybe_apply_stub): Add debug logging for looking
> up stubs to undefined symbols and early return rather than
> fail to look them up.
> (scan_reloc_for_stub): Add debug logging for no stub creation
> for undefined symbols.
--
Han Shen | Software Engineer | shenhan@google.com | +1-650-440-3330
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't look up a stub for an undefined symbol.
2017-06-07 22:47 ` Han Shen via binutils
@ 2017-06-07 22:52 ` Eric Christopher
0 siblings, 0 replies; 5+ messages in thread
From: Eric Christopher @ 2017-06-07 22:52 UTC (permalink / raw)
To: Han Shen; +Cc: binutils, Cary Coutant
Yep. That's correct.
(Or at least it gets further now...)
-eric
On Wed, Jun 7, 2017 at 3:47 PM, Han Shen <shenhan@google.com> wrote:
> Hi Eric, thanks for fixing this. LGTM
>
> BTW, instead of assertion failure in the middle, with this patch, link
> proceeds and ends up with "undefined symbols", correct?
>
> Han
>
> On Wed, Jun 7, 2017 at 2:59 PM, Eric Christopher <echristo@gmail.com> wrote:
>> Hi Cary, Han,
>>
>> Here's a quick patch that:
>>
>> a) Adds some gold_debug target debugging to look for mismatched cases
>> of having a stub and looking for a stub, and
>> b) Notices that we were trying to look up a stub to an undefined
>> symbol when we were explicitly not creating a stub for it earlier.
>>
>> OK?
>>
>> Thanks!
>>
>> -eric
>>
>> 2017-06-07 Eric Christopher <echristo@gmail.com>
>>
>> * aarch64.cc (maybe_apply_stub): Add debug logging for looking
>> up stubs to undefined symbols and early return rather than
>> fail to look them up.
>> (scan_reloc_for_stub): Add debug logging for no stub creation
>> for undefined symbols.
>
>
>
> --
> Han Shen | Software Engineer | shenhan@google.com | +1-650-440-3330
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't look up a stub for an undefined symbol.
2017-06-07 21:59 [PATCH] Don't look up a stub for an undefined symbol Eric Christopher
2017-06-07 22:47 ` Han Shen via binutils
@ 2017-06-08 0:36 ` Cary Coutant
2017-06-08 0:56 ` Eric Christopher
1 sibling, 1 reply; 5+ messages in thread
From: Cary Coutant @ 2017-06-08 0:36 UTC (permalink / raw)
To: Eric Christopher; +Cc: binutils, Han Shen
> 2017-06-07 Eric Christopher <echristo@gmail.com>
>
> * aarch64.cc (maybe_apply_stub): Add debug logging for looking
> up stubs to undefined symbols and early return rather than
> fail to look them up.
> (scan_reloc_for_stub): Add debug logging for no stub creation
> for undefined symbols.
+ // We don't create stubs for undefined symbols so don't look for one.
+ if (gsym && gsym->is_undefined()) {
+ gold_debug(DEBUG_TARGET,
+ "stub: looking for a stub for undefined symbol: %s",
+ gsym->name());
+ return false;
+ }
The braces here aren't Gnu style. Fix that, and it's OK to apply. Thanks!
-cary
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't look up a stub for an undefined symbol.
2017-06-08 0:36 ` Cary Coutant
@ 2017-06-08 0:56 ` Eric Christopher
0 siblings, 0 replies; 5+ messages in thread
From: Eric Christopher @ 2017-06-08 0:56 UTC (permalink / raw)
To: Cary Coutant; +Cc: binutils, Han Shen
On Wed, Jun 7, 2017 at 5:36 PM, Cary Coutant <ccoutant@gmail.com> wrote:
>> 2017-06-07 Eric Christopher <echristo@gmail.com>
>>
>> * aarch64.cc (maybe_apply_stub): Add debug logging for looking
>> up stubs to undefined symbols and early return rather than
>> fail to look them up.
>> (scan_reloc_for_stub): Add debug logging for no stub creation
>> for undefined symbols.
>
> + // We don't create stubs for undefined symbols so don't look for one.
> + if (gsym && gsym->is_undefined()) {
> + gold_debug(DEBUG_TARGET,
> + "stub: looking for a stub for undefined symbol: %s",
> + gsym->name());
> + return false;
> + }
>
> The braces here aren't Gnu style. Fix that, and it's OK to apply. Thanks!
>
Oops, thanks :)
Pushed thusly:
echristo@athyra ~/s/binutils-gdb> git push origin master
To ssh://sourceware.org/git/binutils-gdb.git
3030551ec5..81b6fe3bf9 master -> master
-eric
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-08 0:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-07 21:59 [PATCH] Don't look up a stub for an undefined symbol Eric Christopher
2017-06-07 22:47 ` Han Shen via binutils
2017-06-07 22:52 ` Eric Christopher
2017-06-08 0:36 ` Cary Coutant
2017-06-08 0:56 ` Eric Christopher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).