public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: gcc-patches@gcc.gnu.org, Florian Weimer <fweimer@redhat.com>,
	"H.J. Lu" <hjl.tools@gmail.com>, Jan Hubicka <hubicka@ucw.cz>,
	Michael Matz <matz@suse.de>, Uros Bizjak <ubizjak@gmail.com>
Subject: Re: [PATCH v2] i386: Allow -mlarge-data-threshold with -mcmodel=large
Date: Thu, 25 May 2023 16:11:57 +0000	[thread overview]
Message-ID: <20230525161157.yixwnjqfed56zedw@google.com> (raw)
In-Reply-To: <7a627f23-a603-a6cf-90bd-0cd430e7232f@suse.com>

On 2023-05-25, Jan Beulich wrote:
>On 25.05.2023 17:16, Fangrui Song wrote:
>> --- a/gcc/doc/invoke.texi
>> +++ b/gcc/doc/invoke.texi
>> @@ -32942,9 +32942,10 @@ the cache line size.  @samp{compat} is the default.
>>
>>  @opindex mlarge-data-threshold
>>  @item -mlarge-data-threshold=@var{threshold}
>> -When @option{-mcmodel=medium} is specified, data objects larger than
>> -@var{threshold} are placed in the large data section.  This value must be the
>> -same across all objects linked into the binary, and defaults to 65535.
>> +When @option{-mcmodel=medium} or @option{-mcmodel=large} is specified, data
>> +objects larger than @var{threshold} are placed in large data sections.  This
>> +value must be the same across all objects linked into the binary, and defaults
>> +to 65535.
>
>Where's the "must be the same" requirement coming from?

It's an existing requirement.  I think it may be related to discouraging
different COMDAT sections names due to different -mlarge-data-threshold=.
I don't think it makes sense but did not feel strongly dropping it.

Happy to drop the requirement if I revise this patch.

>As to the default - to remain compatible with earlier versions, shouldn't
>large model code default to "infinity"?
>
>Jan

I have thought about this compatibility need and feel that it is very
unlikly to be needed.  GNU ld has supported large data sections since
2005
(https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3b22753a67cf616514de804ef6d5ed5e90a7d883).
Users' programs with the internal linker scripts will still be working
and -fdata-sections sections will be combined.

First, -mcmodel=large use cases are rare enough.  Rare perhaps
-mcmodel=largel was considered theoretic excercise  in
trying to reach feature completion
(https://groups.google.com/g/x86-64-abi/c/jnQdJeabxiU/m/NNuA0P7pAQAJ),
without this patch -mcmodel=large object files don't interract well with
existing -mcmodel=small object files.
Moreover, if a user expects a specific section prefix with
-mcmodel=large, that's a brittle assumption. I think it's fair to say
that the fault is on the user side and GCC doesn't need to work around
their issues.

  reply	other threads:[~2023-05-25 16:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 15:16 Fangrui Song
2023-05-25 15:28 ` Jan Beulich
2023-05-25 16:11   ` Fangrui Song [this message]
2023-05-26  7:11     ` Jan Beulich
2023-05-26 18:50       ` Fangrui Song

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=20230525161157.yixwnjqfed56zedw@google.com \
    --to=maskray@google.com \
    --cc=fweimer@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=hubicka@ucw.cz \
    --cc=jbeulich@suse.com \
    --cc=matz@suse.de \
    --cc=ubizjak@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).