From: Jan Beulich <jbeulich@suse.com>
To: Fangrui Song <maskray@google.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: Fri, 26 May 2023 09:11:52 +0200 [thread overview]
Message-ID: <9527a604-788a-a17f-2102-8466e3f7a209@suse.com> (raw)
In-Reply-To: <20230525161157.yixwnjqfed56zedw@google.com>
On 25.05.2023 18:11, Fangrui Song wrote:
> 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.
I understand that this isn't something you introduce, but it still stuck
me as odd. Therefore I thought I'd suggest to take the opportunity to at
least soften the language, unless of course there's a real reason behind
it.
>> 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.
Well, the concern clearly is about custom scripts. Imo ...
> 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.
... the more exotic a project, the more likely it is that they're using
custom scripts.
> 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.
I guess I don't really see what you base this on. Without any special
options, expecting data to end up in .data/.bss/.rodata (and variants
thereof) looks like quite reasonable an assumption to me.
Jan
next prev parent reply other threads:[~2023-05-26 7:11 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
2023-05-26 7:11 ` Jan Beulich [this message]
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=9527a604-788a-a17f-2102-8466e3f7a209@suse.com \
--to=jbeulich@suse.com \
--cc=fweimer@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=hubicka@ucw.cz \
--cc=maskray@google.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).