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.
The option is -mconstant-cfstrings, the documentation is slightly wrong.
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.
(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.
I am indeed trying to compile for macOS. Specifically Qt5, which is designed with just Xcode in mind.
Could you consider adding -fconstant-cfstrings as an alias? It would make life easier for making build systems compiler agnostic.
(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.
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 ...
(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.
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).
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.
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)
So I'm assuming this is staying open for backports to the 12 and 11 branches?
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)
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)
(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.