public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [GOLD] Add debug output for ppc64 section grouping
@ 2016-08-30  6:14 Alan Modra
  2016-08-30 15:37 ` Cary Coutant
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2016-08-30  6:14 UTC (permalink / raw)
  To: binutils; +Cc: Cary Coutant

This patch adds a cleaned up version of the debug output I used to
investigate PR20523.  I've added a new DEBUG_* flag because
DEBUG_RELAXATION isn't useful here.  (DEBUG_RELAXATION replaces the
normal relaxation loop with a dummy.  This code isn't even called for
DEBUG_RELAXATION.)

I also fixed a problem with the gold_debug macro.  Specifying FORMAT
as a parameter forces you to supply something corresponding to the
ellipsis, or to use a gcc extension that elides the comma in the
expansion.
See https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html

OK to apply?

	* debug.h (DEBUG_TARGET): New.
	(DEBUG_ALL): Add DEBUG_TARGET.
	(gold_debug): Delete FORMAT param.
	* powerpc.cc (Stub_control::can_add_to_stub_group): Print debug ourput.

diff --git a/gold/debug.h b/gold/debug.h
index e95408f..6fd72c2 100644
--- a/gold/debug.h
+++ b/gold/debug.h
@@ -39,10 +39,11 @@ const int DEBUG_FILES = 0x4;
 const int DEBUG_RELAXATION = 0x8;
 const int DEBUG_INCREMENTAL = 0x10;
 const int DEBUG_LOCATION = 0x20;
+const int DEBUG_TARGET = 0x40;
 
 const int DEBUG_ALL = (DEBUG_TASK | DEBUG_SCRIPT | DEBUG_FILES
 		       | DEBUG_RELAXATION | DEBUG_INCREMENTAL
-		       | DEBUG_LOCATION);
+		       | DEBUG_LOCATION | DEBUG_TARGET);
 
 // Convert a debug string to the appropriate enum.
 inline int
@@ -57,6 +58,7 @@ debug_string_to_enum(const char* arg)
     { "relaxation", DEBUG_RELAXATION },
     { "incremental", DEBUG_INCREMENTAL },
     { "location", DEBUG_LOCATION },
+    { "target", DEBUG_TARGET },
     { "all", DEBUG_ALL }
   };
 
@@ -70,11 +72,11 @@ debug_string_to_enum(const char* arg)
 // Print a debug message if TYPE is enabled.  This is a macro so that
 // we only evaluate the arguments if necessary.
 
-#define gold_debug(TYPE, FORMAT, ...)				\
+#define gold_debug(TYPE, ...)					\
   do								\
     {								\
       if (is_debugging_enabled(TYPE))				\
-	parameters->errors()->debug(FORMAT, __VA_ARGS__);	\
+	parameters->errors()->debug(__VA_ARGS__);		\
     }								\
   while (0)
 
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index d0dd672..1d5cd97 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -2522,6 +2522,13 @@ Stub_control::can_add_to_stub_group(Output_section* o,
 		 i->relobj()->name().c_str(),
 		 i->relobj()->section_name(i->shndx()).c_str());
 
+  gold_debug(DEBUG_TARGET, "maybe add%s %s:%s size=%#llx total=%#llx",
+	     has14 ? " 14bit" : "",
+	     i->relobj()->name().c_str(),
+	     i->relobj()->section_name(i->shndx()).c_str(),
+	     (long long) this_size,
+	     (long long) this->group_end_addr_ - start_addr);
+
   this->has14_ = this->has14_ || has14;
   group_size = this->has14_ ? this->stub14_group_size_ : this->stub_group_size_;
 
@@ -2579,6 +2586,8 @@ Stub_control::can_add_to_stub_group(Output_section* o,
 	gold_unreachable();
     }
 
+  gold_debug(DEBUG_TARGET, "nope, didn't fit\n");
+
   // The section fails to fit in the current group.  Set up a few
   // things for the next group.  owner_ and output_section_ will be
   // set later after we've retrieved those values for the current

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [GOLD] Add debug output for ppc64 section grouping
  2016-08-30  6:14 [GOLD] Add debug output for ppc64 section grouping Alan Modra
@ 2016-08-30 15:37 ` Cary Coutant
  0 siblings, 0 replies; 2+ messages in thread
From: Cary Coutant @ 2016-08-30 15:37 UTC (permalink / raw)
  To: Alan Modra; +Cc: Binutils

> This patch adds a cleaned up version of the debug output I used to
> investigate PR20523.  I've added a new DEBUG_* flag because
> DEBUG_RELAXATION isn't useful here.  (DEBUG_RELAXATION replaces the
> normal relaxation loop with a dummy.  This code isn't even called for
> DEBUG_RELAXATION.)
>
> I also fixed a problem with the gold_debug macro.  Specifying FORMAT
> as a parameter forces you to supply something corresponding to the
> ellipsis, or to use a gcc extension that elides the comma in the
> expansion.
> See https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
>
> OK to apply?
>
>         * debug.h (DEBUG_TARGET): New.
>         (DEBUG_ALL): Add DEBUG_TARGET.
>         (gold_debug): Delete FORMAT param.
>         * powerpc.cc (Stub_control::can_add_to_stub_group): Print debug ourput.

This is OK. Thanks!

-cary

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-30 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-30  6:14 [GOLD] Add debug output for ppc64 section grouping Alan Modra
2016-08-30 15:37 ` Cary Coutant

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