aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-05-02rs6000: Add OPTION_MASK_POWER8 [PR101865]Peter Bergner12-8/+244
The bug in PR101865 is the _ARCH_PWR8 predefine macro is conditional upon TARGET_DIRECT_MOVE, which can be false for some -mcpu=power8 compiles if the -mno-altivec or -mno-vsx options are used. The solution here is to create a new OPTION_MASK_POWER8 mask that is true for -mcpu=power8, regardless of Altivec or VSX enablement. Unfortunately, the only way to create an OPTION_MASK_* mask is to create a new option, which we have done here, but marked it as WarnRemoved since we do not want users using it. For stage1, we will look into how we can create ISA mask flags for use in the compiler without the need for explicit options. 2024-04-12 Will Schmidt <will_schmidt@linux.ibm.com> Peter Bergner <bergner@linux.ibm.com> gcc/ PR target/101865 * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Use OPTION_MASK_POWER8. * config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add OPTION_MASK_POWER8. (ISA_2_7_MASKS_SERVER): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Update comment. Use OPTION_MASK_POWER8 and TARGET_POWER8. * config/rs6000/rs6000.h (TARGET_SYNC_HI_QI): Use TARGET_POWER8. * config/rs6000/rs6000.md (define_attr "isa"): Add p8. (define_attr "enabled"): Handle it. (define_insn "prefetch"): Use TARGET_POWER8. * config/rs6000/rs6000.opt (mpower8-internal): New. gcc/testsuite/ PR target/101865 * gcc.target/powerpc/predefine-p7-novsx.c: New test. * gcc.target/powerpc/predefine-p8-noaltivec-novsx.c: New test. * gcc.target/powerpc/predefine-p8-noaltivec.c: New test. * gcc.target/powerpc/predefine-p8-novsx.c: New test. * gcc.target/powerpc/predefine-p8-pragma-vsx.c: New test. * gcc.target/powerpc/predefine-p9-novsx.c: New test. (cherry picked from commit aa57af93ba22865be747f926e4e5f219e7f8758a)
2024-05-02rs6000: Replace OPTION_MASK_DIRECT_MOVE with OPTION_MASK_P8_VECTOR [PR101865]Peter Bergner5-28/+7
This is a cleanup patch in preparation to fixing the real bug in PR101865. TARGET_DIRECT_MOVE is redundant with TARGET_P8_VECTOR, so alias it to that. Also replace all usages of OPTION_MASK_DIRECT_MOVE with OPTION_MASK_P8_VECTOR and delete the now dead mask. 2024-04-09 Peter Bergner <bergner@linux.ibm.com> gcc/ PR target/101865 * config/rs6000/rs6000.h (TARGET_DIRECT_MOVE): Define. * config/rs6000/rs6000.c (rs6000_option_override_internal): Replace OPTION_MASK_DIRECT_MOVE with OPTION_MASK_P8_VECTOR. Delete redundant OPTION_MASK_DIRECT_MOVE usage. Delete TARGET_DIRECT_MOVE dead code. (rs6000_opt_masks): Neuter the "direct-move" option. * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Replace OPTION_MASK_DIRECT_MOVE with OPTION_MASK_P8_VECTOR. Delete useless comment. * config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Delete OPTION_MASK_DIRECT_MOVE. (OTHER_P8_VECTOR_MASKS): Likewise. (POWERPC_MASKS): Likewise. * config/rs6000/rs6000.opt (mdirect-move): Remove Mask and Var. (cherry picked from commit 7924e352523b37155ed9d76dc426701de9d11a22)
2024-05-02Daily bump.GCC Administrator1-1/+1
2024-05-01Daily bump.GCC Administrator1-1/+1
2024-04-30Daily bump.GCC Administrator4-1/+54
2024-04-29jit, Darwin: Implement library exports list.Iain Sandoe2-17/+201
Currently, we have no exports list for libgccjit, which means that all symbols are exported, including those from libstdc++ which is linked statically into the lib. This causes failures when the shared libstdc++ is used but some c++ symbols are satisfied from libgccjit. This implements an export file for Darwin (which is currently manually created by cross-checking libgccjit.map). Ideally we'd script this, at some point. Update libtool current and age to reflect the current ABI version (we are not bumping the SO name at this stage). This fixes a number of new failures in jit testing. gcc/jit/ChangeLog: * Make-lang.in: Implement exports list, and use a shared libgcc. * libgccjit.exports: New file. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit b120e355e59142bd15d6b010461d07236288d843)
2024-04-29testsuite: Remove duplicate -lgcov [PR114034]Iain Sandoe2-2/+2
Duplicate library entries now cause linker warnings with newer linker versions on Darwin which leads to these tests regressing. The library is already added by the test flags so there is no need to put an extra one in the options. PR testsuite/114034 gcc/testsuite/ChangeLog: * g++.dg/gcov/gcov-dump-1.C: Remove extra -lgcov. * g++.dg/gcov/gcov-dump-2.C: Likewise. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 799a056cf804f433ce0050a5a6bf900f7a01ecb1)
2024-04-29testsuite, Darwin: Allow for an undefined symbol [PR114036].Iain Sandoe1-1/+1
Darwin's linker defaults to requiring all symbols to be defined at static link time (unless specifically noted or dynamic lookuo is enabled). For this test, we just need to note that the symbol is expected to be undefined. PR testsuite/114036 gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-14.c: Allow for 'Foo' to be undefined on Darwin link lines. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit ad8e34eaa870608e2b07b4e7147e6ef2944bb8b5)
2024-04-29Darwin: Do not emit .macinfo when dsymutil cannot consume it.Iain Sandoe1-5/+18
Some verions of dsymutil do not ignore .macinfo sections, but instead ignore the entire debug in the file. To avoid this total loss of debug, when we detect that the debug level is g3 and the dsymutil version cannot support it, we reduce the level to g2 and issue a note. This behaviour can be overidden by -gstrict-dwarf (although the objects will contain macinfo; dsymutil will not produce a .dSYM with it). gcc/ChangeLog: * config/darwin.c (darwin_override_options): Reduce the debug level to 2 if dsymutil cannot handle .macinfo sections. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 3c499f8f6f7d19b21d7047efabbe6396ee1c2cac)
2024-04-29testsuite, Darwin: Use the IOKit framework in framework-1.c [PR114049].Iain Sandoe1-1/+7
The intent of the test is to show that we find a framework that is installed in /System/Library/Frameworks when the user has added a '-F' option. The trick is to choose some header that is present for all the Darwin versions we support and that does not contain any content we cannot parse. We had been using the Kernel framework for this, but recent SDK versions have revealed that this is not suitable. Replacing with a use of IOKit. PR target/114049 gcc/testsuite/ChangeLog: * gcc.dg/framework-1.c: Use an IOKit header instead of a Kernel one. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 4adb1a5839e7a3310a127c1776f1f95d7edaa6ff)
2024-04-29testsuite, Darwin: Allow for undefined symbols in shared test.Iain Sandoe1-1/+8
Darwin's linker defaults to error on undefined (which makes it look as if we do not support shared, leading to tests being marked incorrectly as unsupported). This fixes the issue by allowing the symbols used in the target supports test to be undefined. includes 0ed6e5b4820e01fa86b48a7b1d62f752ec97ea41. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_shared): Allow the external symbols referenced in the test to be undefined. (cherry picked from commit 639bd5e9b759a6d733fadbd5f956889d965e9368) Co-authored-by: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
2024-04-29Daily bump.GCC Administrator4-1/+133
2024-04-28Darwin, testsuite: -multiply_defined is obsoleteFrancois-Xavier Coudert1-0/+1
gcc/testsuite/ChangeLog: * gcc.dg/ssp-2.c: Ignore warning that -multiply_defined is obsolete (cherry picked from commit 6b13e32162adf9e4f552e09c46f1de531ffa8c05)
2024-04-28Darwin, testsuite: -bind_at_load is deprecatedFrancois-Xavier Coudert1-0/+1
gcc/testsuite/ChangeLog: * gcc.dg/darwin-ld-2.c: Ignore warning that -bind_at_load is deprecated. (cherry picked from commit f88219333e85a05a98468f67d2f2190fc330044e)
2024-04-28Darwin: Correct a merge error.Iain Sandoe1-1/+1
For this branch the default_libc_has_function () is not available. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * config/darwin.c: Return true as the default libc avaiability.
2024-04-28Testsuite, i386: Mark test as requiring ifuncFrancois-Xavier Coudert1-0/+1
Test is currently failing on x86_64-apple-darwin. gcc/testsuite/ChangeLog: * gcc.target/i386/pr105554.c: Require ifunc. (cherry picked from commit 7666d94db0684f04264712f3e3fdb542518960c5)
2024-04-28Testsuite: fix analyzer tests on DarwinFrancois-Xavier Coudert1-0/+8
On macOS, system headers redefine by default some macros (memcpy, memmove, etc) to checked versions, which defeats the analyzer. We want to turn this off. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042 gcc/testsuite/ChangeLog: PR analyzer/104042 * gcc.dg/analyzer/analyzer.exp: Pass -D_FORTIFY_SOURCE=0 on Darwin. (cherry picked from commit ce33bbfcbc7dd3afc6c96fb48a19ed00f0c598ce)
2024-04-28testsuite, asan: Avoid color in asan test output.Iain Sandoe1-0/+2
The presence of the color markers in the some of the asan tests appears to confuse the dg-output matching (possibly a platform TCL or termios bug) on some Darwin platforms. Since the color is not being tested, switch it off (makes the log files easier to read too). This fixes a large number of spurious test fails on AVX512 Darwin19. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/testsuite/ChangeLog: * lib/asan-dg.exp: Do not apply color to asan output when under test. (cherry picked from commit 607118dfa47a1865dc59f98e7d161da98471d688)
2024-04-28Testsuite: mark IPA test as requiring alias supportFrancois-Xavier Coudert1-0/+1
This was indicated in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85656 but never committed. Without it, the test fails on darwin. gcc/testsuite/ChangeLog: * gcc.dg/ipa/ipa-icf-38.c: Require alias support. (cherry picked from commit 02393e4b5eabe1c64720b022cb6f819e7b4dc08b)
2024-04-28testsuite, Objective-C: Fix duplicate libobjc cases.Iain Sandoe2-2/+0
Two of the encode testcases include '-lobjc' as their dg-options. Since the library is already appended as part of the generic testsuite handling, this means that two instances appear on the link line leading to spurious warnings from Darwin's new linker. gcc/testsuite/ChangeLog: * obj-c++.dg/encode-10.mm: Remove unneeded '-lobjc' option addition. * obj-c++.dg/encode-9.mm: Likewise. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 30d9e81c19d69e15b2e9c53e4377879cbf9b0b84)
2024-04-28Darwin: Correct handling of weak crts.Iain Sandoe1-15/+22
Backport part of 506e74f53a5 from trunk. We need the weak crts to be considered ahead of GCC target libraries (except libgcc_s) to avoid spurious dependencies on otherwise unused libs. gcc/ChangeLog: * config/darwin.h (LINK_COMMAND_SPEC_A): Handle weak crts before other objects. (REAL_LIBGCC_SPEC): Remove weak crts from here. (DARWIN_WEAK_CRTS): New. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-04-28Objective-C, Darwin: Do not overalign CFStrings and Objective-C metadata.Iain Sandoe3-3/+20
We have reports of regressions in both Objective-C and Objective-C++ on Darwin23 (macOS 14). In some cases, these are linker warnings about the alignment of CFString constants; in other cases the built executables crash during runtime initialization. The underlying issue is the same in both cases; since the objects (CFStrings, Objective-C meta-data) are TU- local, we are choosing to increase their alignment for efficiency - to values greater than ABI alignment. However, although these objects are TU-local, they are also visible to the linker (since they are placed in specific named sections). In many cases the metadata can be regarded as tables of data, and thus it is expected that these sections can be concatenated from multiple TUs and the data treated as tabular. In order for this to work the data cannot be allowed to exceed ABI alignment - which leads to the crashes. For GCC-15+ it would be nice to find a more elegant solution to this issue (perhaps by adjusting the concept of binds-locally to exclude specific named sections) - but I do not want to do that in stage 4. The solution here is to force the alignment to be preserved as created by setting DECL_USER_ALIGN on the relevant objects. gcc/ChangeLog: * config/darwin.c (darwin_build_constant_cfstring): Prevent over- alignment of CFString constants by setting DECL_USER_ALIGN. gcc/objc/ChangeLog: * objc-next-runtime-abi-02.c (build_v2_address_table): Prevent over-alignment of Objective-C metadata by setting DECL_USER_ALIGN on relevant variables. (build_v2_protocol_list_address_table): Likewise. (generate_v2_protocol_list): Likewise. (generate_v2_meth_descriptor_table): Likewise. (generate_v2_meth_type_list): Likewise. (generate_v2_property_table): Likewise. (generate_v2_dispatch_table): Likewise. (generate_v2_ivars_list): Likewise. (generate_v2_class_structs): Likewise. (build_ehtype): Likewise. * objc-runtime-shared-support.c (generate_strings): Likewise. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit f74f840d35117bcaf995cee99fb2ab30c60f64f3)
2024-04-28Objective-C/C++: Ensure sufficient setup for the preprocessor.Iain Sandoe1-2/+5
The tokenizer makes use of functions that determine if identifiers are interface or class names, and those functions need a hash map to be set up. This ensures that these are initialized before pre-process-only jobs are run. gcc/objc/ChangeLog: * objc-act.c (objc_init): Initialize interface and class name hash maps before the preprocessor uses them. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 60f58d0630805e8dce79f5489658fd83e42fa8f1)
2024-04-28Darwin: Fix a typo in Objective-C meta-data.Iain Sandoe1-2/+8
We have a typo in the metadata for assigning NSStrings to a specific section for the V1 (32b) ABI. When that is fixed we should never see the case where the section needs to be deduced from the properties of the DECLs. gcc/ChangeLog: * config/darwin.c (darwin_objc1_section): Use the correct meta-data version for constant strings. (machopic_select_section): Assert if we fail to handle CFString sections as Obejctive-C meta-data or drectly. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 8d26636f0da31e6c17b57ced52bfc61a45f23cee)
2024-04-28Darwin: Fix constant CFString code-gen [PR105522].Iain Sandoe3-40/+76
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.c (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> (cherry picked from commit aecc0d4ba73d0810334b351da1e67232cea450d3)
2024-04-28Daily bump.GCC Administrator4-1/+74
2024-04-27Objective-C, Darwin: Fix a regression in handling bad receivers.Iain Sandoe1-0/+2
This is seen on 32b hosts with a 64b multilib, and is an ICE when the build has checking enabled. The fix is to exit the routine early if the sender or receiver are already error_mark_node. gcc/objc/ChangeLog: * objc-next-runtime-abi-02.c (build_v2_objc_method_fixup_call): Early exit for cases where the sender or receiver are known to be in error. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 846794ead2982fc85a3b1a83bbb831fa096b2b7c)
2024-04-27Testsuite, Darwin: Adjust handling of PIE testFrancois-Xavier Coudert2-1/+2
gcc/ChangeLog: * config/darwin.c (darwin_override_options): Cannot use OPTION_SET_P here. gcc/testsuite/ChangeLog: * gcc.dg/pie-2.c: Skip test on darwin. (cherry picked from commit a0c557690c8d5327deda6e21f8d1deca8451a4cb) Co-authored-by: Iain Sandoe <iain@sandoe.co.uk>
2024-04-27Darwin: Handle the fPIE option specially.Iain Sandoe1-2/+13
For Darwin, PIE requires PIC codegen, but otherwise is only a link-time change. For almost all Darwin, we do not report __PIE__; the exception is 32bit X86 and from Darwin12 to 17 only (32 bit is no longer supported after Darwin17). gcc/ChangeLog: * config/darwin.c (darwin_override_options): Handle fPIE. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit da9e72f80f3358bd9586e11aaf03341c1f867318)
2024-04-27Darwin: Make metadata symbol lables linker-visible for GNU objc.Iain Sandoe1-1/+1
Now we have shifted to using the same relocation mechanism as clang for objective-c typeinfo the static linker needs to have a linker-visible symbol for metadata names (this is only needed for GNU objective C, for NeXT the names are in seaprate sections). gcc/ChangeLog: * config/darwin.h (darwin_label_is_anonymous_local_objc_name): Make metadata names linker-visibile for GNU objective C. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 24709788e40bc26dfb49585e752fad503fdced71)
2024-04-27testsuite, Darwin: Skip g++.dg/debug/dwarf2/pr85550.CIain Sandoe1-0/+1
There are two problems here; first that the emitted asm for -fdebug-types-section is ELF-specfic leading to assembler errors for Mach-O. If we fix this, we get a secondary fail since the debug linker does not recognise DW_FORM_ref_sig8. Disable ths test until we get DWARF-5 support in the external Darwin toolchain components. gcc/testsuite/ChangeLog: * g++.dg/debug/dwarf2/pr85550.C: Skip for Darwin. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 76547f4c97b1c0744487d624c5e2e5a15d0370a9)
2024-04-27Testsuite, DWARF2: adjust regexp to match darwin outputFrancois-Xavier Coudert1-1/+1
gcc/testsuite/ChangeLog: * gcc.dg/debug/dwarf2/inline4.c: Ajdust regexp to match darwin output. (cherry picked from commit 94e68ce96c285e479736851f1ad8cc87c8c3ff0c)
2024-04-27Darwin: Handle -dynamiclib on cc1 lines.Iain Sandoe1-1/+1
The changes of r14-4172 missed a case where we accept -dynamiclib on the command line and then pass it to cc1 (which does not accept it). This prunes the -dynamiclib from cc1 lines. gcc/ChangeLog: * config/darwin.h (DARWIN_CC1_SPEC): Remove -dynamiclib. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 3b18fd28c83ac90bf408389c003ed25d93438210)
2024-04-27Darwin: Move checking of the 'shared' driver spec.Iain Sandoe1-17/+17
This avoids a bunch of irrelevant diagnostics if the user passes '-shared' to gnatmake. Currently, we push '-dynamiclib' back onto the command line (since that is the Darwin spelling of 'shared') but this is not handled by gnat1, leading to a diagnostic for every character after the '-d'. '-shared' has no effect on gnatmake (it needs to be passed to gnatbind). This moves the handling of '-shared' to leaf specs so that we do not need to push 'dynamiclib' onto the command line. gcc/ChangeLog: * config/darwin.h: (SUBTARGET_DRIVER_SELF_SPECS): Move handling of 'shared' into the same specs as 'dynamiclib'. (STARTFILE_SPEC): Handle 'shared'. (cherry picked from commit 2e36eedb244badaaf2a70388071115c851b8db9b)
2024-04-27Daily bump.GCC Administrator1-1/+1
2024-04-26Daily bump.GCC Administrator3-1/+128
2024-04-25Darwin: Correct a version check.Iain Sandoe1-1/+1
When the version for dsymutil comes from a clang build, it is of the form NNmm.pp.qq where NN and mm are the major and minor LLVM version components. We need to check for a major version greater than or equal to 7 - so use 700 in the check. gcc/ChangeLog: * config/darwin.c (darwin_override_options): Update the clang major version value in the dsymutil check. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 451bb0b9262d2f54173937569a29d7f1ad234e30)
2024-04-25Darwin: Check as for .build_version support and use it if available.Iain Sandoe4-10/+91
This adds support for the minimum OS version data in assembler files. At present, we have no mechanism to detect the SDK version in use, and so that is omitted from build_versions. We follow the implementation in clang, '.build_version' is only emitted (where supported) for target macOS versions >= 10.14. For earlier macOS we fall back to using a '.macosx_version_min' directive. This latter is also emitted when the assembler supports it, but not build_version. gcc/ChangeLog: * config.in: Regenerate. * config/darwin.c (darwin_file_start): Add assembler directives for the target OS version, where these are supported by the assembler. (darwin_override_options): Check for building >= macOS 10.14. * configure: Regenerate. * configure.ac: Check for assembler support of .build_version directives. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit a4184c8a65a00eaf8a8d7f92fb8ad2f8621b39e2)
2024-04-25Darwin, configure: Allow for an unrecognisable dsymutil [PR111610].Iain Sandoe2-2/+2
We had a catch-all configuration case for missing or unrecognised dsymutil but it was setting the dsymutil source to "UNKNOWN" which is not usable in this context (since it clashes with an existing enum). We rename this to DET_UNKNOWN (for Darwin External Toolchain). PR target/111610 gcc/ChangeLog: * configure: Regenerate. * configure.ac: Rename the missing dsymutil case to "DET_UNKNOWN". Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 2ecab2f32b9e9a75bf563f80752d5b44dcd26b98)
2024-04-25Darwin,debug : Switch to DWARF 3 or 4 when dsymutil supports it.Iain Sandoe2-4/+40
The main reason that Darwin has been using DWARF2 only as debug is that earlier debug linkers (dsymutil) did not support any extensions to this so that the default "non-strict" mode used in GCC would cause tool errors. There are two sources for dsymutil, those based off a closed source base "dwarfutils" and those based off LLVM. For dsymutil versions based off LLVM-7+ we can use up to DWARF-4, and for versions based on dwarfutils 121+ we can use DWARF-3. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * config/darwin-protos.h (enum darwin_external_toolchain): New. * config/darwin.c (DSYMUTIL_VERSION): New. (darwin_override_options): Choose the default debug DWARF version depending on the configured dsymutil version. (cherry picked from commit 47346acb72b50d178dae72393c851d57beec383f)
2024-04-25testsuite: adjust for darwin linker warningFrancois-Xavier Coudert2-0/+2
On recent macOS versions, no_pie is deprecated and the linker complains about it: "-no_pie is deprecated when targeting new OS versions" gcc/testsuite/ChangeLog: * gcc.dg/darwin-segaddr.c: Adjust for darwin linker warning. * gcc.dg/pie-7.c: Likewise. (cherry picked from commit d9926c0d974646dc6024d5a881fe1bee2f499139)
2024-04-25Darwin, ppc: Add system stubs for all 32b PPCIain Sandoe1-3/+3
This is a minor adjustment to make the GCC behaviour better match the old system tools. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * config/rs6000/darwin.h (LIB_SPEC): Include libSystemStubs for all 32b Darwin PowerPC cases. (cherry picked from commit b3ab28c3e85af7995fffb87eb190ef942b7e9e4a)
2024-04-25Darwin: Partial reversion of r14-3648 (Inits Section).Iain Sandoe1-6/+9
Although the Darwin ABI places both hot and cold partitions in the same section (the linker can partition by name), this does not work with the current dwarf2out implementation. Since we do see global initialization code getting hot/cold splits, this patch places the cold parts into text_cold, and keeps the hot part in the correct Init section per ABI. TODO: figure out a way to allow us to match the ABI fully. gcc/ChangeLog: * config/darwin.c (darwin_function_section): Place unlikely executed global init code into the standard cold section. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 5b33b364652866165431aef1810af1e890229c5e)
2024-04-25Darwin: Place global inits in the correct section.Iain Sandoe2-0/+10
This handles placement of global initializers into __TEXT,__StaticInit as used by other platform toolchains. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * config/darwin-sections.def (static_init_section): Add the __TEXT,__StaticInit section. * config/darwin.c (darwin_function_section): Use the static init section for global initializers, to match other platform toolchains. (cherry picked from commit 68dc3e94fd6bd395a8b343533485616dff3fc796)
2024-04-25Darwin: Match system sections and relocs for exception tables.Iain Sandoe3-2/+3
System tools from Darwin10 onwards have moved the exceptions tables from the __DATA segment to the __TEXT one. They also revised the relocations used for typeinfo. While Darwin9 was not changed at the time, in fact the tools there are equally happy with the revised scheme - and therefore at present there seems no reason to special-case it. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * config/darwin-sections.def (darwin_exception_section): Move to the __TEXT segment. * config/darwin.c (darwin_emit_except_table_label): Align before the exception table label. * config/darwin.h (ASM_PREFERRED_EH_DATA_FORMAT): Use indirect PC- relative 4byte relocs. (cherry picked from commit 0fe7962afc7c01488432b98b6f442b24946a490d)
2024-04-25arm: Zero/Sign extends for CMSE securityRichard Ball3-0/+257
Co-Authored by: Andre Simoes Dias Vieira <Andre.SimoesDiasVieira@arm.com> This patch makes the following changes: 1) When calling a secure function from non-secure code then any arguments smaller than 32-bits that are passed in registers are zero- or sign-extended. 2) After a non-secure function returns into secure code then any return value smaller than 32-bits that is passed in a register is zero- or sign-extended. This patch addresses the following CVE-2024-0151. gcc/ChangeLog: PR target/114837 * config/arm/arm.c (cmse_nonsecure_call_inline_register_clear): Add zero/sign extend. (arm_expand_prologue): Add zero/sign extend. gcc/testsuite/ChangeLog: * gcc.target/arm/cmse/extend-param.c: New test. * gcc.target/arm/cmse/extend-return.c: New test. (cherry picked from commit ad45086178d833254d66fab518b14234418f002b)
2024-04-25rs6000: Fix wrong align passed to build_aligned_type [PR88309]Kewen Lin4-3/+33
As the comments in PR88309 show, there are two oversights in rs6000_gimple_fold_builtin that pass align in bytes to build_aligned_type but which actually requires align in bits, it causes unexpected ICE or hanging in function is_miss_rate_acceptable due to zero align_unit value. This patch is to fix them by converting bytes to bits, add an assertion on positive align_unit value and notes function build_aligned_type requires align measured in bits in its function comment. PR target/88309 Co-authored-by: Andrew Pinski <quic_apinski@quicinc.com> gcc/ChangeLog: * config/rs6000/rs6000-call.c (rs6000_gimple_fold_builtin): Fix wrong align passed to function build_aligned_type. * tree-ssa-loop-prefetch.c (is_miss_rate_acceptable): Add an assertion to ensure align_unit should be positive. * tree.c (build_qualified_type): Update function comments. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr88309.c: New test. (cherry picked from commit 26eb5f8fd173e2425ae7505528fc426de4b7e34c)
2024-04-25Daily bump.GCC Administrator3-1/+106
2024-04-24Testsuite, darwin: account for macOS 13 and 14Francois-Xavier Coudert1-0/+2
gcc/testsuite/ChangeLog: * gcc.dg/darwin-minversion-link.c: Account for macOS 13 and 14. (cherry picked from commit 6d33602650612c89e7e32201266763b167f62a46)
2024-04-24build: Allow for Xcode 15 ld -v outputRainer Orth2-2/+4
Since Xcode 15 beta 6, ld -v output differs from previous versions: * macOS 13/Xcode 14: @(#)PROGRAM:ld PROJECT:ld64-857.1 * macOS 14/Xcode 15: @(#)PROGRAM:ld PROJECT:dyld-1015.1 configure cannot handle the new form, so LD64_VERSION isn't set. This patch fixes this. The autoconf manual states that sed doesn't portably support alternation, so I'm using two separate expressions to extract the version number. Tested on x86_64-apple-darwin23.0.0. 2023-08-16 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> gcc: * configure.ac (gcc_cv_ld64_version): Allow for dyld in ld -v output. * configure: Regenerate. (cherry picked from commit 0beac9209f0ae230b34ad31e76e7b0b633a5fb21)