Bug 108743 - [objective-c, NeXT runtime] -fconstant-cfstrings not supported
Summary: [objective-c, NeXT runtime] -fconstant-cfstrings not supported
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Iain Sandoe
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2023-02-09 16:37 UTC by Pierre Ossman
Modified: 2024-03-17 03:29 UTC (History)
3 users (show)

See Also:
Host:
Target: *-*-darwin*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2023-07-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Ossman 2023-02-09 16:37:18 UTC
Some programs designed for clang want this flag. I'm unsure exactly how important it is. The description sounds like it's just some optimization.

To make things worse, it is mentioned in gcc's documentation even though it isn't supported.
Comment 1 Andrew Pinski 2023-02-09 16:39:20 UTC
The option is -mconstant-cfstrings, the documentation is slightly wrong.
Comment 2 Pierre Ossman 2023-02-09 16:43:34 UTC
Great news. And that is the same thing as clang's -fconstant-cfstrings?

Unfortunately, I couldn't see -mconstant-cfstrings in gcc's documentation, but I may be looking in the wrong place.
Comment 3 Andrew Pinski 2023-02-09 16:45:57 UTC
(In reply to Pierre Ossman from comment #2)
> Great news. And that is the same thing as clang's -fconstant-cfstrings?

yes

> 
> Unfortunately, I couldn't see -mconstant-cfstrings in gcc's documentation,
> but I may be looking in the wrong place.

and it is just missing.

Also are you trying to compile for darwin (Mac OS X) or some other target?
If some other target, then these options are not there.
Comment 4 Pierre Ossman 2023-02-10 08:08:13 UTC
I am indeed trying to compile for macOS. Specifically Qt5, which is designed with just Xcode in mind.
Comment 5 Pierre Ossman 2023-02-10 08:09:22 UTC
Could you consider adding -fconstant-cfstrings as an alias? It would make life easier for making build systems compiler agnostic.
Comment 6 Jakub Jelinek 2023-02-10 09:23:39 UTC
(In reply to Pierre Ossman from comment #5)
> Could you consider adding -fconstant-cfstrings as an alias? It would make
> life easier for making build systems compiler agnostic.

As it is a machine specific option, -mconstant-cfstrings is right, if it was a generic option, -f* would make sense, but it is not.
If the option is MacOS specific in clang too, then they just misnamed the option.
Comment 7 Andrew Pinski 2023-02-10 15:50:32 UTC
Hmm,
https://inbox.sourceware.org/gcc-patches/B4F496F4-F31D-41D2-8942-1F0AEFBD7BBF@sandoe-acoustics.co.uk/

Seems didn't get installed even though it was approved ...
Comment 8 Iain Sandoe 2023-02-12 16:48:52 UTC
(In reply to Andrew Pinski from comment #7)
> Hmm,
> https://inbox.sourceware.org/gcc-patches/B4F496F4-F31D-41D2-8942-
> 1F0AEFBD7BBF@sandoe-acoustics.co.uk/
> 
> Seems didn't get installed even though it was approved ...

these things happen, I guess we can make it a darwin-specific driver option (as Jakub says, the 'm' version is technically correct, but we have to accommodate compatibility sometimes).

There is at least one other platform that I think it s using the NeXT library (it is open sourced), so maybe it is an appropriate option for that platform too.
Comment 9 Iain Sandoe 2023-07-02 13:28:31 UTC
this is intended to be a target-specific option for Darwin.

Although other targets can (and do) use the NeXT runtime, if this optimisation applies to the then they need to add the option (and document for the relevant target).
Comment 10 GCC Commits 2023-07-02 14:21:54 UTC
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:cdd4b3c0f0f428678c24de74b1f626628450799c

commit r14-2239-gcdd4b3c0f0f428678c24de74b1f626628450799c
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Jul 2 14:18:04 2023 +0100

    Darwin, Objective-C: Support -fconstant-cfstrings [PR108743].
    
    This support the -fconstant-cfstrings option as used by clang (and
    expect by some build scripts) as an alias to the target-specific
    -mconstant-cfstrings.
    
    The documentation is also updated to reflect that the 'f' option is
    only available on Darwin, and to add the 'm' option to the Darwin
    section of the invocation text.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
            PR target/108743
    
    gcc/ChangeLog:
    
            * config/darwin.opt: Add fconstant-cfstrings alias to
            mconstant-cfstrings.
            * doc/invoke.texi: Amend invocation descriptions to reflect
            that the fconstant-cfstrings is a target-option alias and to
            add the missing mconstant-cfstrings option description to the
            Darwin section.
Comment 11 GCC Commits 2023-07-03 14:24:25 UTC
The releases/gcc-13 branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:12897414d309d9cf398259c212923aa7b031a3af

commit r13-7528-g12897414d309d9cf398259c212923aa7b031a3af
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Jul 2 14:18:04 2023 +0100

    Darwin, Objective-C: Support -fconstant-cfstrings [PR108743].
    
    This support the -fconstant-cfstrings option as used by clang (and
    expect by some build scripts) as an alias to the target-specific
    -mconstant-cfstrings.
    
    The documentation is also updated to reflect that the 'f' option is
    only available on Darwin, and to add the 'm' option to the Darwin
    section of the invocation text.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
            PR target/108743
    
    gcc/ChangeLog:
    
            * config/darwin.opt: Add fconstant-cfstrings alias to
            mconstant-cfstrings.
            * doc/invoke.texi: Amend invocation descriptions to reflect
            that the fconstant-cfstrings is a target-option alias and to
            add the missing mconstant-cfstrings option description to the
            Darwin section.
    
    (cherry picked from commit cdd4b3c0f0f428678c24de74b1f626628450799c)
Comment 12 Eric Gallager 2023-08-05 03:54:56 UTC
So I'm assuming this is staying open for backports to the 12 and 11 branches?
Comment 13 GCC Commits 2024-03-17 03:23:39 UTC
The releases/gcc-12 branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:215d67485ce8d4f6cef4e9cf7ecfd4d79abc1c48

commit r12-10219-g215d67485ce8d4f6cef4e9cf7ecfd4d79abc1c48
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Jul 2 14:18:04 2023 +0100

    Darwin, Objective-C: Support -fconstant-cfstrings [PR108743].
    
    This support the -fconstant-cfstrings option as used by clang (and
    expect by some build scripts) as an alias to the target-specific
    -mconstant-cfstrings.
    
    The documentation is also updated to reflect that the 'f' option is
    only available on Darwin, and to add the 'm' option to the Darwin
    section of the invocation text.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
            PR target/108743
    
    gcc/ChangeLog:
    
            * config/darwin.opt: Add fconstant-cfstrings alias to
            mconstant-cfstrings.
            * doc/invoke.texi: Amend invocation descriptions to reflect
            that the fconstant-cfstrings is a target-option alias and to
            add the missing mconstant-cfstrings option description to the
            Darwin section.
    
    (cherry picked from commit cdd4b3c0f0f428678c24de74b1f626628450799c)
Comment 14 GCC Commits 2024-03-17 03:27:40 UTC
The releases/gcc-11 branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:87152f50a89deb5044145a80fa2ed705f4913f98

commit r11-11283-g87152f50a89deb5044145a80fa2ed705f4913f98
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Jul 2 14:18:04 2023 +0100

    Darwin, Objective-C: Support -fconstant-cfstrings [PR108743].
    
    This support the -fconstant-cfstrings option as used by clang (and
    expect by some build scripts) as an alias to the target-specific
    -mconstant-cfstrings.
    
    The documentation is also updated to reflect that the 'f' option is
    only available on Darwin, and to add the 'm' option to the Darwin
    section of the invocation text.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
            PR target/108743
    
    gcc/ChangeLog:
    
            * config/darwin.opt: Add fconstant-cfstrings alias to
            mconstant-cfstrings.
            * doc/invoke.texi: Amend invocation descriptions to reflect
            that the fconstant-cfstrings is a target-option alias and to
            add the missing mconstant-cfstrings option description to the
            Darwin section.
    
    (cherry picked from commit cdd4b3c0f0f428678c24de74b1f626628450799c)
Comment 15 Iain Sandoe 2024-03-17 03:29:03 UTC
(In reply to Eric Gallager from comment #12)
> So I'm assuming this is staying open for backports to the 12 and 11 branches?

yup, which is now done, so fixed.