aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2024-01-06 10:52:38 +0000
committerIain Sandoe <iain@sandoe.co.uk>2024-01-18 13:54:17 +0000
commitaecc0d4ba73d0810334b351da1e67232cea450d3 (patch)
tree35471f2cfa2d69296ec61817f781fd16f54f6011 /gcc/objc
parenta6bf09f65aed44d36acaa511e552783bfb0e9a62 (diff)
downloadgcc-aecc0d4ba73d0810334b351da1e67232cea450d3.zip
gcc-aecc0d4ba73d0810334b351da1e67232cea450d3.tar.gz
gcc-aecc0d4ba73d0810334b351da1e67232cea450d3.tar.bz2
Darwin: Fix constant CFString code-gen [PR105522].
Although this only fires for one of the Darwin sub-ports, it is latent elsewhere, it is also a regression c.f. the Darwin system compiler. In the code we imported from an earlier branch, CFString objects (which are constant aggregates) are constructed as CONST_DECLs. Although our current documentation suggests that these are reserved for enumeration values, in fact they are used elsewhere in the compiler for constants. This includes Objective-C where they are used to form NSString constants. In the particular case, we take the address of the constant and that triggers varasm.cc:decode_addr_constant, which does not currently support CONST_DECL. If there is a general intent to allow/encourage wider use of CONST_DECL, then we should fix decode_addr_constant to look through these and evaluate the initializer (a two-line patch, but I'm not suggesting it for stage-4). We also need to update the GCC internals documentation to allow for the additional uses. This patch is Darwin-local and fixes the problem by making the CFString constants into regular variable but TREE_CONSTANT+TREE_READONLY. I plan to back-port this to the open branches once it has baked a while on trunk. Since, for Darwin, the Objective-C default is to construct constant NSString objects as CFStrings; this will also cover the majority of cases there (this patch does not make any changes to Objective-C NSStrings). PR target/105522 gcc/ChangeLog: * config/darwin.cc (machopic_select_section): Handle C and C++ CFStrings. (darwin_rename_builtins): Move this out of the CFString code. (darwin_libc_has_function): Likewise. (darwin_build_constant_cfstring): Create an anonymous var to hold each CFString. * config/darwin.h (ASM_OUTPUT_LABELREF): Handle constant CFstrings. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
Diffstat (limited to 'gcc/objc')
0 files changed, 0 insertions, 0 deletions