This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Ignore relocations from .eh_frame for gc


> 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()

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]