From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70516 invoked by alias); 30 Aug 2016 06:14:25 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 69776 invoked by uid 89); 30 Aug 2016 06:14:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=H*RU:209.85.220.66, Hx-spam-relays-external:209.85.220.66, UD:debug.h, sk:variadi X-HELO: mail-pa0-f66.google.com Received: from mail-pa0-f66.google.com (HELO mail-pa0-f66.google.com) (209.85.220.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Aug 2016 06:14:14 +0000 Received: by mail-pa0-f66.google.com with SMTP id cf3so610279pad.2 for ; Mon, 29 Aug 2016 23:14:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=fPHTwmVCfaWqoZ9dy6ROjBUXg8DQobQgSmbcjxbO5Is=; b=ZQQQE1O7EjnyE5aAw1m5SSpVSQUDo/EHeLR/RnARgD+j+mTtUoBnwJ78R8AxQ7SQ4D WBXoYUnIZmw3rpcLicrKAeDzcfM0RS8Y6s/ZLNQZPuRNFmSap3Gr74R4N0zyelyoZhRb awUN7wJz85o0YOeSpV43uMNSR3BzrrcZZ016HftijUiGRuJM+0yIMBqIXR3toZF4T0+Y la8phn7s4iFAeBYV0DJ5L0tIrcTorOVqwQ7Fx/5eAmFae70416MlXUd201l/WQWUiW+0 VnsJ0AJealesjQAnN1iIL9A5MYSLWtnpA5O8ZwRTMtoZRteEjgQgalzxARp85C/XUitt L/OQ== X-Gm-Message-State: AE9vXwNMI6HMjqro6MqqQAcRWV5lPuLAOvXWqC63qPHi/Nd/KhebI5/OAs7KtXYryI2glg== X-Received: by 10.66.53.234 with SMTP id e10mr3399699pap.28.1472537652936; Mon, 29 Aug 2016 23:14:12 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-146-233.sa.bigpond.net.au. [58.160.146.233]) by smtp.gmail.com with ESMTPSA id t126sm53594464pfd.28.2016.08.29.23.14.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Aug 2016 23:14:12 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 0EA04C17D9; Tue, 30 Aug 2016 15:44:08 +0930 (ACST) Date: Tue, 30 Aug 2016 06:14:00 -0000 From: Alan Modra To: binutils@sourceware.org Cc: Cary Coutant Subject: [GOLD] Add debug output for ppc64 section grouping Message-ID: <20160830061407.GI3677@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00314.txt.bz2 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