public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Fāng-ruì Sòng" <maskray@google.com>
To: binutils@sourceware.org, Cary Coutant <ccoutant@gmail.com>
Subject: Re: [PATCH] gold: Remove GNU ld incompatible --[no-]define-common [BZ #28871]
Date: Tue, 8 Mar 2022 17:33:00 -0800	[thread overview]
Message-ID: <20220309013300.rqyugif2arfgkaea@google.com> (raw)
In-Reply-To: <CAFP8O3JOCfp-B6J2PyR2rdVTb7nyzgnUwnfzmNB7Ofy8-+Jzow@mail.gmail.com>

On 2022-02-18, Fāng-ruì Sòng wrote:
>On Tue, Feb 8, 2022 at 1:08 AM Fangrui Song <maskray@google.com> wrote:
>>
>> In 2008, 0dfbdef4c43cfe12bb3e2505ebe5acc651a35c98 confused
>> --define-common with -d/FORCE_COMMON_ALLOCATION and implemented
>> --define-common with -d semantics.
>>
>> Just remove the GNU ld incompatible --[no-]define-common.
>> ---
>>  gold/gold.cc    |  2 +-
>>  gold/options.cc | 14 ++++----------
>>  gold/options.h  |  9 ++++-----
>>  3 files changed, 9 insertions(+), 16 deletions(-)
>>
>> diff --git a/gold/gold.cc b/gold/gold.cc
>> index 2891d16c7c9..a93489e225e 100644
>> --- a/gold/gold.cc
>> +++ b/gold/gold.cc
>> @@ -708,7 +708,7 @@ queue_middle_tasks(const General_options& options,
>>    // Allocate common symbols.  We use a blocker to run this before the
>>    // Scan_relocs tasks, because it writes to the symbol table just as
>>    // they do.
>> -  if (parameters->options().define_common())
>> +  if (parameters->options().dc())
>>      {
>>        this_blocker = new Task_token(true);
>>        this_blocker->add_blocker();
>> diff --git a/gold/options.cc b/gold/options.cc
>> index 04be98a3e39..a6c4bda1ae8 100644
>> --- a/gold/options.cc
>> +++ b/gold/options.cc
>> @@ -1136,16 +1136,10 @@ General_options::finalize()
>>        gold_assert(this->strip_debug());
>>      }
>>
>> -  // For us, -dc and -dp are synonyms for --define-common.
>> -  if (this->dc())
>> -    this->set_define_common(true);
>> -  if (this->dp())
>> -    this->set_define_common(true);
>> -
>> -  // We also set --define-common if we're not relocatable, as long as
>> -  // the user didn't explicitly ask for something different.
>> -  if (!this->user_set_define_common())
>> -    this->set_define_common(!this->relocatable());
>> +  // A non-relocatable link always allocates space to COMMON symbols.
>> +  // -dc, -d, and -dp can force allocation for a relocatable link.
>> +  if (!this->relocatable() || this->d() || this->dp())
>> +    this->set_dc(true);
>>
>>    // execstack_status_ is a three-state variable; update it based on
>>    // -z [no]execstack.
>> diff --git a/gold/options.h b/gold/options.h
>> index 9509a445e8e..a994bdcf42a 100644
>> --- a/gold/options.h
>> +++ b/gold/options.h
>> @@ -787,13 +787,12 @@ class General_options
>>
>>    // d
>>
>> -  DEFINE_bool(define_common, options::TWO_DASHES, 'd', false,
>> -             N_("Define common symbols"),
>> -             N_("Do not define common symbols in relocatable output"));
>>    DEFINE_bool(dc, options::ONE_DASH, '\0', false,
>> -             N_("Alias for -d"), NULL);
>> +    N_("Allocate space to COMMON symbols for the relocatable link"), NULL);
>> +  DEFINE_bool(d, options::ONE_DASH, '\0', false,
>> +             N_("Alias for -dc"), NULL);
>>    DEFINE_bool(dp, options::ONE_DASH, '\0', false,
>> -             N_("Alias for -d"), NULL);
>> +             N_("Alias for -dc"), NULL);
>>
>>    DEFINE_string(debug, options::TWO_DASHES, '\0', "",
>>                 N_("Turn on debugging"),
>> --
>> 2.35.0.263.gb82422642f-goog
>>
>
>Ping...

ping^2 :)

      reply	other threads:[~2022-03-09  1:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08  9:07 Fangrui Song
2022-02-19  0:23 ` Fāng-ruì Sòng
2022-03-09  1:33   ` Fāng-ruì Sòng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220309013300.rqyugif2arfgkaea@google.com \
    --to=maskray@google.com \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).