This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Ignore relocations from .eh_frame for gc
- From: Rafael EspÃndola <rafael dot espindola at gmail dot com>
- To: Cary Coutant <ccoutant at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>, Sriraman Tallam <tmsriram at google dot com>
- Date: Wed, 22 Apr 2015 18:19:22 -0400
- Subject: Re: [patch] Ignore relocations from .eh_frame for gc
- Authentication-results: sourceware.org; auth=none
- References: <CAG3jReKYU8GWr7Zd-Q9TAVybCMxyxA3w1OgWBebZeBjUmXyp2g at mail dot gmail dot com> <CAJimCsEkjEaAS4xv2XYBOfFNzLu6O0WTHUiHHnueqSpqtE-i4g at mail dot gmail dot com>
> I'm not sure it's worth it -- getting the section_name() can be slow,
> especially if we're not mmap'ing files, so this test case may not be
> representative. Also, I wouldn't expect a lot of relocations in
> .eh_frame sections (maybe just one per section?).
One per function.
I first noticed this in an artificial test with lots of small
functions. When linking chromium the speedup is small (6.350577880s to
6.322946402 seconds).
So I am not sure if it is worth it or not.
> At any rate, note that just a few lines below your addition, we do get
> the section name if --icf is enabled. You may as well wait until that
> point to check for .eh_frame, then you can at least do the check at
> less cost when --icf is enabled.
Good point. The attached patch just makes that unconditional.
Cheers,
Rafael
diff --git a/gold/gc.h b/gold/gc.h
index bf4023d..3fbbeb3 100644
--- a/gold/gc.h
+++ b/gold/gc.h
@@ -183,6 +183,10 @@ gc_process_relocs(
size_t local_count,
const unsigned char* plocal_syms)
{
+ std::string src_section_name = src_obj->section_name(src_indx);
+ if (src_section_name == ".eh_frame")
+ return;
+
Scan scan;
typedef typename Reloc_types<sh_type, size, big_endian>::Reloc Reltype;
@@ -197,10 +201,6 @@ gc_process_relocs(
bool is_icf_tracked = false;
const char* cident_section_name = NULL;
- std::string src_section_name = (parameters->options().icf_enabled()
- ? src_obj->section_name(src_indx)
- : "");
-
bool check_section_for_function_pointers = false;
if (parameters->options().icf_enabled()