]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
5 weeks agoDaily bump.
GCC Administrator [Mon, 29 Apr 2024 00:19:51 +0000 (00:19 +0000)] 
Daily bump.

5 weeks agoDarwin, testsuite: -multiply_defined is obsolete
Francois-Xavier Coudert [Sat, 10 Feb 2024 14:52:44 +0000 (15:52 +0100)] 
Darwin, testsuite: -multiply_defined is obsolete

gcc/testsuite/ChangeLog:

* gcc.dg/ssp-2.c: Ignore warning that
-multiply_defined is obsolete

(cherry picked from commit 6b13e32162adf9e4f552e09c46f1de531ffa8c05)

5 weeks agoDarwin, testsuite: -bind_at_load is deprecated
Francois-Xavier Coudert [Sat, 10 Feb 2024 11:55:29 +0000 (12:55 +0100)] 
Darwin, testsuite: -bind_at_load is deprecated

gcc/testsuite/ChangeLog:

* gcc.dg/darwin-ld-2.c: Ignore warning
that -bind_at_load is deprecated.

(cherry picked from commit f88219333e85a05a98468f67d2f2190fc330044e)

5 weeks agoDarwin: Correct a merge error.
Iain Sandoe [Sun, 28 Apr 2024 16:05:06 +0000 (17:05 +0100)] 
Darwin: Correct a merge error.

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.

5 weeks agoTestsuite, i386: Mark test as requiring ifunc
Francois-Xavier Coudert [Mon, 30 Oct 2023 14:41:10 +0000 (15:41 +0100)] 
Testsuite, i386: Mark test as requiring ifunc

Test is currently failing on x86_64-apple-darwin.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr105554.c: Require ifunc.

(cherry picked from commit 7666d94db0684f04264712f3e3fdb542518960c5)

5 weeks agoTestsuite: fix analyzer tests on Darwin
Francois-Xavier Coudert [Sat, 19 Aug 2023 21:22:06 +0000 (23:22 +0200)] 
Testsuite: fix analyzer tests on Darwin

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)

5 weeks agotestsuite, asan: Avoid color in asan test output.
Iain Sandoe [Sun, 19 Jun 2022 09:31:01 +0000 (10:31 +0100)] 
testsuite, asan: Avoid color in asan test output.

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)

5 weeks agoTestsuite: mark IPA test as requiring alias support
Francois-Xavier Coudert [Sun, 20 Aug 2023 12:13:22 +0000 (14:13 +0200)] 
Testsuite: mark IPA test as requiring alias support

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)

5 weeks agotestsuite, Objective-C: Fix duplicate libobjc cases.
Iain Sandoe [Thu, 25 Jan 2024 20:17:42 +0000 (20:17 +0000)] 
testsuite, Objective-C: Fix duplicate libobjc cases.

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)

5 weeks agoDarwin: Correct handling of weak crts.
Iain Sandoe [Thu, 21 Mar 2024 14:34:44 +0000 (14:34 +0000)] 
Darwin: Correct handling of weak crts.

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>
5 weeks agoObjective-C, Darwin: Do not overalign CFStrings and Objective-C metadata.
Iain Sandoe [Thu, 25 Jan 2024 20:11:09 +0000 (20:11 +0000)] 
Objective-C, Darwin: Do not overalign CFStrings and Objective-C metadata.

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)

5 weeks agoObjective-C/C++: Ensure sufficient setup for the preprocessor.
Iain Sandoe [Tue, 9 Jan 2024 17:31:41 +0000 (17:31 +0000)] 
Objective-C/C++: Ensure sufficient setup for the preprocessor.

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)

5 weeks agoDarwin: Fix a typo in Objective-C meta-data.
Iain Sandoe [Mon, 8 Jan 2024 16:17:04 +0000 (16:17 +0000)] 
Darwin: Fix a typo in Objective-C meta-data.

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)

5 weeks agoDarwin: Fix constant CFString code-gen [PR105522].
Iain Sandoe [Sat, 6 Jan 2024 10:52:38 +0000 (10:52 +0000)] 
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.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)

5 weeks agoDaily bump.
GCC Administrator [Sun, 28 Apr 2024 00:19:15 +0000 (00:19 +0000)] 
Daily bump.

5 weeks agoObjective-C, Darwin: Fix a regression in handling bad receivers.
Iain Sandoe [Sat, 6 Jan 2024 19:21:40 +0000 (19:21 +0000)] 
Objective-C, Darwin: Fix a regression in handling bad receivers.

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)

5 weeks agoTestsuite, Darwin: Adjust handling of PIE test
Francois-Xavier Coudert [Mon, 30 Oct 2023 11:41:17 +0000 (12:41 +0100)] 
Testsuite, Darwin: Adjust handling of PIE test

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>
5 weeks agoDarwin: Handle the fPIE option specially.
Iain Sandoe [Wed, 25 Oct 2023 14:28:52 +0000 (15:28 +0100)] 
Darwin: Handle the fPIE option specially.

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)

5 weeks agoDarwin: Make metadata symbol lables linker-visible for GNU objc.
Iain Sandoe [Sat, 30 Sep 2023 16:15:16 +0000 (17:15 +0100)] 
Darwin: Make metadata symbol lables linker-visible for GNU objc.

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)

5 weeks agotestsuite, Darwin: Skip g++.dg/debug/dwarf2/pr85550.C
Iain Sandoe [Sun, 1 Oct 2023 19:38:44 +0000 (20:38 +0100)] 
testsuite, Darwin: Skip g++.dg/debug/dwarf2/pr85550.C

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)

5 weeks agoTestsuite, DWARF2: adjust regexp to match darwin output
Francois-Xavier Coudert [Sun, 20 Aug 2023 10:53:19 +0000 (12:53 +0200)] 
Testsuite, DWARF2: adjust regexp to match darwin output

gcc/testsuite/ChangeLog:

* gcc.dg/debug/dwarf2/inline4.c: Ajdust regexp to match darwin
output.

(cherry picked from commit 94e68ce96c285e479736851f1ad8cc87c8c3ff0c)

5 weeks agoDarwin: Handle -dynamiclib on cc1 lines.
Iain Sandoe [Tue, 26 Sep 2023 08:47:46 +0000 (09:47 +0100)] 
Darwin: Handle -dynamiclib on cc1 lines.

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)

5 weeks agoDarwin: Move checking of the 'shared' driver spec.
Iain Sandoe [Sun, 9 Jul 2023 08:02:39 +0000 (09:02 +0100)] 
Darwin: Move checking of the 'shared' driver spec.

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)

5 weeks agoDaily bump.
GCC Administrator [Sat, 27 Apr 2024 00:19:17 +0000 (00:19 +0000)] 
Daily bump.

6 weeks agoDaily bump.
GCC Administrator [Fri, 26 Apr 2024 00:18:23 +0000 (00:18 +0000)] 
Daily bump.

6 weeks agoDarwin: Correct a version check.
Iain Sandoe [Mon, 1 Apr 2024 19:47:25 +0000 (20:47 +0100)] 
Darwin: Correct a version check.

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)

6 weeks agoDarwin: Check as for .build_version support and use it if available.
Iain Sandoe [Tue, 17 Oct 2023 10:10:27 +0000 (11:10 +0100)] 
Darwin: Check as for .build_version support and use it if available.

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)

6 weeks agoDarwin, configure: Allow for an unrecognisable dsymutil [PR111610].
Iain Sandoe [Wed, 27 Sep 2023 10:05:31 +0000 (11:05 +0100)] 
Darwin, configure: Allow for an unrecognisable dsymutil [PR111610].

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)

6 weeks agoDarwin,debug : Switch to DWARF 3 or 4 when dsymutil supports it.
Iain Sandoe [Sun, 17 Sep 2023 14:56:07 +0000 (15:56 +0100)] 
Darwin,debug : Switch to DWARF 3 or 4 when dsymutil supports it.

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)

6 weeks agotestsuite: adjust for darwin linker warning
Francois-Xavier Coudert [Fri, 8 Sep 2023 19:55:56 +0000 (21:55 +0200)] 
testsuite: adjust for darwin linker warning

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)

6 weeks agoDarwin, ppc: Add system stubs for all 32b PPC
Iain Sandoe [Wed, 26 Jul 2023 13:31:02 +0000 (14:31 +0100)] 
Darwin, ppc: Add system stubs for all 32b PPC

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)

6 weeks agoDarwin: Partial reversion of r14-3648 (Inits Section).
Iain Sandoe [Sun, 10 Sep 2023 13:48:42 +0000 (14:48 +0100)] 
Darwin: Partial reversion of r14-3648 (Inits Section).

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)

6 weeks agoDarwin: Place global inits in the correct section.
Iain Sandoe [Fri, 1 Sep 2023 08:04:13 +0000 (09:04 +0100)] 
Darwin: Place global inits in the correct section.

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)

6 weeks agoDarwin: Match system sections and relocs for exception tables.
Iain Sandoe [Thu, 31 Aug 2023 18:20:43 +0000 (19:20 +0100)] 
Darwin: Match system sections and relocs for exception tables.

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)

6 weeks agoarm: Zero/Sign extends for CMSE security
Richard Ball [Thu, 25 Apr 2024 14:30:42 +0000 (15:30 +0100)] 
arm: Zero/Sign extends for CMSE security

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)

6 weeks agors6000: Fix wrong align passed to build_aligned_type [PR88309]
Kewen Lin [Tue, 9 Apr 2024 02:01:36 +0000 (21:01 -0500)] 
rs6000: Fix wrong align passed to build_aligned_type [PR88309]

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)

6 weeks agoDaily bump.
GCC Administrator [Thu, 25 Apr 2024 00:18:38 +0000 (00:18 +0000)] 
Daily bump.

6 weeks agoTestsuite, darwin: account for macOS 13 and 14
Francois-Xavier Coudert [Sun, 20 Aug 2023 22:00:44 +0000 (00:00 +0200)] 
Testsuite, darwin: account for macOS 13 and 14

gcc/testsuite/ChangeLog:

* gcc.dg/darwin-minversion-link.c: Account for macOS 13 and 14.

(cherry picked from commit 6d33602650612c89e7e32201266763b167f62a46)

6 weeks agofixincludes: Update darwin_flt_eval_method for macOS 14
Rainer Orth [Thu, 17 Aug 2023 08:16:57 +0000 (10:16 +0200)] 
fixincludes: Update darwin_flt_eval_method for macOS 14

On macOS 14, a guard in <math.h> changed:

-- MacOSX13.3.sdk/usr/include/math.h 2023-04-19 01:54:44
+++ MacOSX14.0.sdk/usr/include/math.h 2023-08-01 08:42:43
@@ -22,0 +23 @@
+
@@ -43 +44 @@
-#if __FLT_EVAL_METHOD__ == 0
+#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == -1
@@ -49 +50 @@
-#elif __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ == -1
+#elif __FLT_EVAL_METHOD__ == 2

Therefore the darwin_flt_eval_method fixincludes fix doesn't match any
longer, leading to a large number of testsuite failures like

/private/var/gcc/regression/master/14-gcc/build/gcc/include-fixed/math.h:69:5:
error: #error "Unsupported value of __FLT_EVAL_METHOD__."

where __FLT_EVAL_METHOD__ = 16.

This patch adjusts the fix to allow for both forms.

Tested with make check in fixincludes on x86_64-apple-darwin23.0.0 and
verifying that <math.h> has indeed been fixed as expected.

2023-08-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

fixincludes:
* inclhack.def (darwin_flt_eval_method): Handle macOS 14 guard
variant.
* fixincl.x: Regenerate.
* tests/base/math.h [DARWIN_FLT_EVAL_METHOD_CHECK]: Update test.

(cherry picked from commit 93f803d53b5ccaabded9d7b4512b54da81c1c616)

6 weeks agobuild: Allow for Xcode 15 ld -v output
Rainer Orth [Thu, 17 Aug 2023 08:14:49 +0000 (10:14 +0200)] 
build: Allow for Xcode 15 ld -v output

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)

6 weeks agotestsuite,objective-c++: Fix imported NSObjCRuntime.h.
Iain Sandoe [Fri, 23 Jun 2023 14:29:14 +0000 (15:29 +0100)] 
testsuite,objective-c++: Fix imported NSObjCRuntime.h.

We have imported some headers from the GNUStep project to allow us
to maintain the testsuite independent to changing versions of system
headers.

One of these headers has a macro that (now we have support for
__has_feature) expands to a declaration that triggers a warning.

These headers are considered part of the implementation so that, in
this case, we can suppress the warning with the system_header pragma.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* objc-obj-c++-shared/GNUStep/Foundation/NSObjCRuntime.h: Make
this header use pragma system_header.

(cherry picked from commit d83e0e3bc375a05844438d28c9a4ab24c5401eb9)

6 weeks agotestsuite, objective-c: Cater for Windows intptr type.
Iain Sandoe [Thu, 16 Feb 2023 16:18:11 +0000 (16:18 +0000)] 
testsuite, objective-c: Cater for Windows intptr type.

This adjusts the diagnostic output matches to cater for the differences
in intptr types on Windows.

Patch from 'nightstrike'.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* objc.dg/proto-lossage-4.m: Amendn diagnostic matches for Windows.

(cherry picked from commit 07f497c2da3600cc99cd7d1b5c6726972fb2b5a1)

6 weeks agolibstdc++, Darwin: Limit recursive mutex init to OS versions needing it.
Iain Sandoe [Sat, 3 Dec 2022 17:09:35 +0000 (17:09 +0000)] 
libstdc++, Darwin: Limit recursive mutex init to OS versions needing it.

The problem described in pr 51906 was fixed in the next OS release.  Limit the
workaround to systems that need it.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libstdc++-v3/ChangeLog:

* config/os/bsd/darwin/os_defines.h
(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC): Limit use of this macro
to OS versions that need it.

(cherry picked from commit a044c9d25972b22c6b4c8ec27f2de5fd622573cc)

6 weeks agotestsuite: Add target requires for ifuncs to mv31.C.
Iain Sandoe [Thu, 28 Apr 2022 07:51:48 +0000 (08:51 +0100)] 
testsuite: Add target requires for ifuncs to mv31.C.

g++.target/i386/mv31.C fails on targets without ifuncs support so add
the necessary target supports guard.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* g++.target/i386/mv31.C: Add target supports guard for ifuncs.

(cherry picked from commit 350fcc7884ba80f38dd1476ae41029c648a5f8b9)

6 weeks agoFixincludes: Handle __FLT_EVAL_METHOD__ == 16 on darwin
Francois-Xavier Coudert [Sat, 1 Jan 2022 11:22:00 +0000 (12:22 +0100)] 
Fixincludes: Handle __FLT_EVAL_METHOD__ == 16 on darwin

The darwin system headers error out on __FLT_EVAL_METHOD__ == 16, which
occurs when the compiler is called with -mavx512fp16 on i386. Allow this
value to proceed past the check (nothing else depends on it in the
system headers).

fixincludes/ChangeLog:

* inclhack.def: Add new fix on darwin.
* fixincl.x: Regenerate.
* tests/base/math.h: Regenerate.

(cherry picked from commit 4f3b1a09d3109f03299a2ac15cfa3059596fcb1d)

6 weeks agoDarwin: Fix empty g++ command lines [PR105599].
Iain Sandoe [Sun, 29 May 2022 15:14:32 +0000 (16:14 +0100)] 
Darwin: Fix empty g++ command lines [PR105599].

An empty g++ command line should produce a diagnostic that there are no
inputs.  The PR is that currently Darwin produces a dignostic about missing
link items instead - this is because (errnoeously), for this driver, we are
creating a link job for empty command lines.

The problem occurs in four stages:

 The g++ driver appends -shared-libgcc to the command line.

 The Darwin driver_init code in the backend does not see this (it sees an
 empty command line).

 When the back end driver code driver sees an empty command line, it does not
 add any supplementary flags (e.g. asm-macosx-version-min) - precisely to
 avoid anything being claimed as an input_file and therefore triggering a link
 line.

 Since we do not have a value for asm-macosx-version-min when processing the
 driver specs, we unconditionally inject 'multiply_defined suppress' which is
 used with shared libgcc (but only intended on very old Darwin).  This then
 causes the generation of a link job.

The solution, for the present, is to move version-specific link params to the
LINK_SPEC so that they are only processed when a link job has already been
decided.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/105599

gcc/ChangeLog:

* config/darwin.h: Move versions-specific handling of multiply_defined
from SUBTARGET_DRIVER_SELF_SPECS to LINK_SPEC.

(cherry picked from commit 794737976b9a6418eab817f143bb4eb2d0c834d2)

6 weeks agotsan: Don't instrument non-generic AS accesses [PR111736]
Jakub Jelinek [Tue, 26 Mar 2024 10:06:15 +0000 (11:06 +0100)] 
tsan: Don't instrument non-generic AS accesses [PR111736]

Similar to the asan and ubsan changes, we shouldn't instrument non-generic
address space accesses with tsan, because we just have library functions
which take address of the objects as generic address space pointers, so they
can't handle anything else.

2024-03-26  Jakub Jelinek  <jakub@redhat.com>

gcc/ChangeLog:

PR sanitizer/111736
* tsan.c (instrument_expr): Punt on non-generic address space
accesses.

gcc/testsuite/ChangeLog:

* gcc.dg/tsan/pr111736.c: New test.

(cherry picked from commit 471967ab8b4c49338ba77defbe24b06cc51c0093)

6 weeks agoubsan: Don't -fsanitize=null instrument __seg_fs/gs pointers [PR111736]
Jakub Jelinek [Fri, 22 Mar 2024 08:23:44 +0000 (09:23 +0100)] 
ubsan: Don't -fsanitize=null instrument __seg_fs/gs pointers [PR111736]

On x86 and avr some address spaces allow 0 pointers (on avr actually
even generic as, but libsanitizer isn't ported to it and
I'm not convinced we should completely kill -fsanitize=null in that
case).
The following patch makes sure those aren't diagnosed for -fsanitize=null,
though they are still sanitized for -fsanitize=alignment.

2024-03-22  Jakub Jelinek  <jakub@redhat.com>

gcc/ChangeLog:

PR sanitizer/111736
* ubsan.c (ubsan_expand_null_ifn, instrument_mem_ref): Avoid
SANITIZE_NULL instrumentation for non-generic address spaces
for which targetm.addr_space.zero_address_valid (as) is true.

gcc/testsuite/ChangeLog:

* gcc.dg/ubsan/pr111736.c: New test.

(cherry picked from commit ddd4a3ca87410886b039cc225907b4f6e650082e)

6 weeks agotree-optimization/111736 - avoid address sanitizing of __seg_gs
Richard Biener [Thu, 21 Mar 2024 07:30:39 +0000 (08:30 +0100)] 
tree-optimization/111736 - avoid address sanitizing of __seg_gs

The following more thoroughly avoids address sanitizing accesses
to non-generic address-spaces.

gcc/ChangeLog:

PR tree-optimization/111736
* asan.c (instrument_derefs): Do not instrument accesses
to non-generic address-spaces.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr111736.c: New testcase.

(cherry picked from commit 134ef2a8cac1a5cc718739bd7d3b3472947c80d6)

6 weeks agosanitizer/111736 - skip ASAN for globals in alternate address-space
Richard Biener [Tue, 5 Dec 2023 13:00:43 +0000 (14:00 +0100)] 
sanitizer/111736 - skip ASAN for globals in alternate address-space

gcc/ChangeLog:

PR sanitizer/111736
* asan.c (asan_protect_global): Do not protect globals
in non-generic address-space.

(cherry picked from commit 7e40497805c0831596334fe474112f991276e11b)

6 weeks agoDaily bump.
GCC Administrator [Wed, 24 Apr 2024 00:18:38 +0000 (00:18 +0000)] 
Daily bump.

6 weeks agotestsuite,X86: Fix missing USER_LABEL_PREFIX cases.
Iain Sandoe [Fri, 15 Apr 2022 14:51:22 +0000 (15:51 +0100)] 
testsuite,X86: Fix missing USER_LABEL_PREFIX cases.

Yet another set of testcases that do not account for targets that
use __USER_LABEL_PREFIX__.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* gcc.target/i386/memcpy-strategy-10.c: Account for
__USER_LABEL_PREFIX__.
* gcc.target/i386/memcpy-strategy-5.c: Likewise.
* gcc.target/i386/memset-strategy-5.c: Likewise.
* gcc.target/i386/memset-strategy-7.c: Likewise.

6 weeks agoadd missing dg-require alias to gcc.dg/torture/pr100786.c
Richard Biener [Mon, 28 Mar 2022 07:48:08 +0000 (09:48 +0200)] 
add missing dg-require alias to gcc.dg/torture/pr100786.c

2022-03-28  Richard Biener  <rguenther@suse.de>

* gcc.dg/torture/pr100786.c: Add dg-require alias.

(cherry picked from commit f6819b7fea38f2e5482c71aabab3d44a8bd7d904)

6 weeks agoDarwin: Fix a type mismatch warning for a non-GCC bootstrap compiler.
Iain Sandoe [Fri, 4 Mar 2022 12:39:03 +0000 (12:39 +0000)] 
Darwin: Fix a type mismatch warning for a non-GCC bootstrap compiler.

DECL_MD_FUNCTION_CODE() returns an int, on one particular compiler the
code in darwin_fold_builtin() triggers a warning.

Fixed thus.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config/darwin.c (darwin_fold_builtin): Make fcode an int to
avoid a mismatch with DECL_MD_FUNCTION_CODE().

(cherry picked from commit 25587472ccd223c861fe77cfeca4ba33c3f6cd99)

6 weeks agolibphobos, testsuite: Add prune clauses for two Darwin cases.
Iain Sandoe [Fri, 19 Nov 2021 15:48:53 +0000 (15:48 +0000)] 
libphobos, testsuite: Add prune clauses for two Darwin cases.

Depending on the permutation of CPU, OS version and shared/non-
shared library inclusion, we get can get two warnings from the
external tools (ld64, dsymutil) which are not actually GCC issues
but relate to the external tools.  These are alrrady pruned in
the main testsuite, this adds them to the library.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libphobos/ChangeLog:

* testsuite/lib/libphobos.exp: Prune warnings from external
tool bugs.

(cherry picked from commit 532fae74c3b1197023a765272892e12e123f0a56)

6 weeks agoconfigure, Darwin: Check ld64 support for -platform-version.
Iain Sandoe [Fri, 12 Nov 2021 17:03:09 +0000 (17:03 +0000)] 
configure, Darwin: Check ld64 support for -platform-version.

Newer versions of ld64 allow specifiying the OS target (e.g.
macos or ios) the version and the SDK version all in a single
command.  This checks the availability of the command for the
current toolchain.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Test ld64 for -platform-version support.

(cherry picked from commit d3cc82dc9cc2d4f1021fc5d4c1463c3a14fc6795)

6 weeks agotestsuite, Darwin : Do not claim 'GAS' for cctools assembler.
Iain Sandoe [Mon, 15 Mar 2021 21:38:31 +0000 (21:38 +0000)] 
testsuite, Darwin : Do not claim 'GAS' for cctools assembler.

Although the cctools assembler is based of GNU GAS, it is from a
very old version (1.38) which does not support many of the features
that the target supports test is expecting.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: Exclude cctools assembler based on
GAS 1.38.

(cherry picked from commit e42ea63bcc12e819c3e1066974a691988e86b724)

6 weeks agoObjective-C: Default flag_objc_sjlj_exceptions off for NeXT ABI >= 2.
Matt Jacobson [Thu, 29 Jul 2021 08:57:23 +0000 (09:57 +0100)] 
Objective-C: Default flag_objc_sjlj_exceptions off for NeXT ABI >= 2.

Signed-off-by: Matt Jacobson <mhjacobson@me.com>
gcc/c-family/ChangeLog:

* c-opts.c (c_common_post_options): Default to
flag_objc_sjlj_exceptions = 1 only when flag_objc_abi < 2.

gcc/objc/ChangeLog:

* objc-next-runtime-abi-02.c
(objc_next_runtime_abi_02_init): Warn about and reset
flag_objc_sjlj_exceptions regardless of flag_objc_exceptions.
(next_runtime_02_initialize): Use a checking assert that
flag_objc_sjlj_exceptions is off.

(cherry picked from commit 798666392b512a585f0de2983a5d3423e960959e)

6 weeks agoObjective-C, NeXT runtime: Correct the default for fobjc-nilcheck.
Iain Sandoe [Sun, 15 Aug 2021 11:52:30 +0000 (12:52 +0100)] 
Objective-C, NeXT runtime: Correct the default for fobjc-nilcheck.

It is intended that the default for the NeXT runtime at ABI 2 is to
check for nil message receivers.  This updates this to match the
documented behaviour and to match the behaviour of the system tools.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/objc/ChangeLog:

* objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init):
Default receiver nilchecks on.

(cherry picked from commit de0b250b2badb475f8c09f3cd2c57fd3f9127fe3)

6 weeks agoObjective-C: fix crash with -fobjc-nilcheck
Iain Sandoe [Sat, 14 Aug 2021 11:27:55 +0000 (12:27 +0100)] 
Objective-C: fix crash with -fobjc-nilcheck

When -fobjc-nilcheck is enabled, messages that result in a struct type should
yield a zero-initialized struct when sent to nil.  Currently, the frontend
crashes when it encounters this situation.  This patch fixes the crash by
generating the tree for the `{}` initializer.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
Co-authored-by: Matt Jacobson <mhjacobson@me.com>
PR objc/101666

gcc/objc/ChangeLog:

* objc-act.c (objc_build_constructor): Handle empty constructor
lists.
* objc-next-runtime-abi-02.c (build_v2_objc_method_fixup_call):
Handle nil receivers.
(build_v2_build_objc_method_call): Likewise.

gcc/testsuite/ChangeLog:

* obj-c++.dg/pr101666-0.mm: New test.
* obj-c++.dg/pr101666-1.mm: New test.
* obj-c++.dg/pr101666.inc: New.
* objc.dg/pr101666-0.m: New test.
* objc.dg/pr101666-1.m: New test.
* objc.dg/pr101666.inc: New.

(cherry picked from commit d2aa4e0b3b5053df8f5853d9ed29022ff0d3ecf6)

6 weeks agoDaily bump.
GCC Administrator [Tue, 23 Apr 2024 00:18:45 +0000 (00:18 +0000)] 
Daily bump.

6 weeks agoObjective-C, NeXT: Adjust symbol marking to match host tools.
Iain Sandoe [Mon, 2 May 2022 18:42:49 +0000 (19:42 +0100)] 
Objective-C, NeXT: Adjust symbol marking to match host tools.

Current host tools mark some additional symbols as 'no dead strip' and also
expose one additional group to the linker.  This does not affect older Darwin
versions or x86_64, but omitting these changes results in link errors for
aarch64.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config/darwin.c (darwin_label_is_anonymous_local_objc_name): Make
protocol class methods linker-visible.

gcc/objc/ChangeLog:

* objc-next-runtime-abi-02.c (next_runtime_abi_02_protocol_decl): Do
not dead-strip the runtime meta-data symbols.
(build_v2_classrefs_table): Likewise.
(build_v2_protocol_list_address_table): Likewise.

(cherry picked from commit ecd5727c0a662a8fea6b5f8eac6f3f15bf5ef851)

6 weeks agotestsuite: Fix weak_undefined handling on Darwin
Rainer Orth [Tue, 28 Mar 2023 08:40:05 +0000 (10:40 +0200)] 
testsuite: Fix weak_undefined handling on Darwin

The patch that introduced the weak_undefined effective-target keyword
and corresponding dg-add-options support

commit 378ec7b87a5265dbe2d489c245fac98ef37fa638
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Mar 23 00:45:05 2023 -0300

    [testsuite] test for weak_undefined support and add options

badly broke the affected tests on macOS like so:

ERROR: gcc.dg/addr_equal-1.c: unknown dg option: 89 for " dg-add-options 5 weak_undefined "
ERROR: gcc.dg/addr_equal-1.c: unknown dg option: 89 for " dg-add-options 5 weak_undefined "

add_options_for_weak_undefined tries to call an non-existant proc "89".
Even after fixing this by escaping the brackets, two tests still failed to
link since they lacked the corresponding calls do dg-add-options
weak_undefined.

Tested on x86_64-apple-darwin20.6.0 and i386-pc-solaris2.11.

2023-03-27  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* lib/target-supports.exp (add_options_for_weak_undefined): Escape
brackets.
* gcc.dg/visibility-22.c: Add weak_undefined options.

(cherry picked from commit 8443f42f05f9026dadad1236b9e44ec294c70337)

6 weeks agotestsuite, objective-c: Fix a testcase on Windows.
Iain Sandoe [Wed, 15 Feb 2023 10:47:51 +0000 (10:47 +0000)] 
testsuite, objective-c: Fix a testcase on Windows.

Windows needs to use uintptr_t to represent an integral pointer type (long
is not the right type there).

Patch from 'nightstike'.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* obj-c++.dg/proto-lossage-4.mm: Use uintptr_t for integral pointer
representations.

(cherry picked from commit 142bd88c5f609546a466743ab1066d5620a830bc)

6 weeks agoc++, driver: Fix -static-libstdc++ for targets without Bstatic/dynamic.
Iain Sandoe [Thu, 6 Jan 2022 08:37:18 +0000 (08:37 +0000)] 
c++, driver: Fix -static-libstdc++ for targets without Bstatic/dynamic.

The current implementation for swapping between the static and shared c++
runtimes relies on the static linker supporting Bstatic/dynamic which is
not available for every target (Darwin's linker does not support this).

Specs substitution (%s) is an alternative solution for this (which is what
Darwin uses for Fortran, D and Objective-C).  However, specs substitution
requires that the '-static-libstdc++' be preserved in the driver's command
line.  The patch here arranges for this to be done when the configuration
determines that linker support for Bstatic/dynamic is missing.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/ChangeLog:

* g++spec.c (lang_specific_driver): Preserve -static-libstdc++ in
the driver command line for targets without -Bstatic/dynamic support
in their static linker.

(cherry picked from commit a846817739c1e7b930d593cd51963d6b46b5dfc6)

6 weeks agotestsuite, Darwin: Fix darwin-comm-1.c error messages for Darwin <= 10.
Iain Sandoe [Sat, 25 Jun 2022 08:58:35 +0000 (09:58 +0100)] 
testsuite, Darwin: Fix darwin-comm-1.c error messages for Darwin <= 10.

When amending the allowed alignment size to accommodate the larger values
permitted by newer tools, we retained the object file limit of 2^15 for
Darwin versions <= 10, since that is what the native tools expect there.

This triggers a different diagnostic path with a distinct error message,
which is checked in the revised test here.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* gcc.dg/darwin-comm-1.c: Check for the correct error message for
Darwin <= 10.

(cherry picked from commit 54a5f478487a955c3ffaec3e9164a72599bc1cfb)

6 weeks agotestsuite, Darwin: Remove an unnecessary flags addition.
Iain Sandoe [Sun, 19 Jun 2022 19:47:43 +0000 (20:47 +0100)] 
testsuite, Darwin: Remove an unnecessary flags addition.

The addition of the multiply_defined suppress flag has been handled for some
considerable time now in the Darwin specs; remove it from the testsuite libs.
Avoid duplicates in the specs.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config/darwin.h: Avoid duplicate multiply_defined specs on
earlier Darwin versions with shared libgcc.

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp: Remove additional flag handled
by Darwin specs.

gcc/testsuite/ChangeLog:

* lib/g++.exp: Remove additional flag handled by Darwin specs.
* lib/obj-c++.exp: Likewise.

(cherry picked from commit 3c776fdf1a825818ad7248d442e846f532574ff7)

6 weeks agoconfigure, Darwin: Adjust handing of stdlib option.
Iain Sandoe [Sat, 16 Sep 2023 07:40:49 +0000 (08:40 +0100)] 
configure, Darwin: Adjust handing of stdlib option.

The intent of the configuration choices for -stdlib is that default
setting should choose reasonable options for the target.  This should
enable -stdlib= for Darwin targets where libc++ is the default on the
system (so that it is only necessary to provide the headers).

However, it seems that there are some cases where (external) config
scripts are using -stdlib (incorrectly) to determine if the compiler
in use is GCC or clang.

In order to allow for these cases, this patch refines the setting
like so:

--with-gxx-libcxx-include-dir= is used to configure the path containing
libc++ headers; it also controls the enabling of the -stdlib option.

We are adding a special value for path:
if --with-gxx-libcxx-include-dir is 'no' we disable the stdlib option.

Otherwise if the --with-gxx-libcxx-include-dir is set we use the path
provided, and enable the stdlib option.

if --with-gxx-libcxx-include-dir is unset
We decide on the stdlib option based on the OS type and revision being
targeted.  The path is set to a fixed position relative to the compiler
install (similar logic to that used for libstdc++ headers).

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* configure: Regenerate.
* configure.ac: Handle explict disable of stdlib option, set
defaults for Darwin.

(cherry picked from commit ce7a757fd9ecb99c4f54cfde5cf5ef9a9e7819fc)

6 weeks agoDaily bump.
GCC Administrator [Mon, 22 Apr 2024 00:18:33 +0000 (00:18 +0000)] 
Daily bump.

6 weeks agoDaily bump.
GCC Administrator [Sun, 21 Apr 2024 00:18:18 +0000 (00:18 +0000)] 
Daily bump.

6 weeks agoDaily bump.
GCC Administrator [Sat, 20 Apr 2024 00:18:08 +0000 (00:18 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Fri, 19 Apr 2024 00:18:25 +0000 (00:18 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Thu, 18 Apr 2024 00:18:36 +0000 (00:18 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Wed, 17 Apr 2024 00:20:08 +0000 (00:20 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Tue, 16 Apr 2024 00:19:53 +0000 (00:19 +0000)] 
Daily bump.

7 weeks ago[AArch64]: Do not allow SIMD clones with simdlen 1 [PR113552]
Tamar Christina [Mon, 15 Apr 2024 11:32:24 +0000 (12:32 +0100)] 
[AArch64]: Do not allow SIMD clones with simdlen 1 [PR113552]

This is a backport of g:306713c953d509720dc394c43c0890548bb0ae07.

The AArch64 vector PCS does not allow simd calls with simdlen 1,
however due to a bug we currently do allow it for num == 0.

This causes us to emit a symbol that doesn't exist and we fail to link.

gcc/ChangeLog:

PR tree-optimization/113552
* config/aarch64/aarch64.c
(aarch64_simd_clone_compute_vecsize_and_simdlen): Block simdlen 1.

gcc/testsuite/ChangeLog:

PR tree-optimization/113552
* gcc.target/aarch64/pr113552.c: New test.
* gcc.target/aarch64/simd_pcs_attribute-3.c: Remove bogus check.

7 weeks agomiddle-end/114599 - fix bitmap allocation for check_ifunc_callee_symtab_nodes
Richard Biener [Fri, 5 Apr 2024 08:16:41 +0000 (10:16 +0200)] 
middle-end/114599 - fix bitmap allocation for check_ifunc_callee_symtab_nodes

There's no default bitmap obstack during global CTORs, so allocate the
bitmap locally.

PR middle-end/114599
PR gcov-profile/114115
* symtab.c (ifunc_ref_map): Do not use auto_bitmap.
(is_caller_ifunc_resolver): Optimize bitmap_bit_p/bitmap_set_bit
pair.
(symtab_node::check_ifunc_callee_symtab_nodes): Properly
allocate ifunc_ref_map here.

(cherry picked from commit 9ab8fdfeef5b1a47b358e08a98177b2fad65fed9)

7 weeks agotree-profile: Disable indirect call profiling for IFUNC resolvers
H.J. Lu [Mon, 26 Feb 2024 16:38:58 +0000 (08:38 -0800)] 
tree-profile: Disable indirect call profiling for IFUNC resolvers

We can't profile indirect calls to IFUNC resolvers nor their callees as
it requires TLS which hasn't been set up yet when the dynamic linker is
resolving IFUNC symbols.

Add an IFUNC resolver caller marker to cgraph_node and set it if the
function is called by an IFUNC resolver.  Disable indirect call profiling
for IFUNC resolvers and their callees.

Tested with profiledbootstrap on Fedora 39/x86-64.

gcc/ChangeLog:

PR tree-optimization/114115
* cgraph.h (symtab_node): Add check_ifunc_callee_symtab_nodes.
(cgraph_node): Add called_by_ifunc_resolver.
* cgraphunit.c (symbol_table::compile): Call
symtab_node::check_ifunc_callee_symtab_nodes.
* symtab.c (check_ifunc_resolver): New.
(ifunc_ref_map): Likewise.
(is_caller_ifunc_resolver): Likewise.
(symtab_node::check_ifunc_callee_symtab_nodes): Likewise.
* tree-profile.c (gimple_gen_ic_func_profiler): Disable indirect
call profiling for IFUNC resolvers and their callees.

gcc/testsuite/ChangeLog:

PR tree-optimization/114115
* gcc.dg/pr114115.c: New test.

(cherry picked from commit cab32bacaea268ec062b1fb4fc662d90c9d1cfce)

7 weeks agoDaily bump.
GCC Administrator [Mon, 15 Apr 2024 00:19:14 +0000 (00:19 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Sun, 14 Apr 2024 00:19:38 +0000 (00:19 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Sat, 13 Apr 2024 00:19:14 +0000 (00:19 +0000)] 
Daily bump.

8 weeks agoRISC-V: Fix __atomic_compare_exchange with 32 bit value on RV64
Kito Cheng [Wed, 28 Feb 2024 08:01:52 +0000 (16:01 +0800)] 
RISC-V: Fix __atomic_compare_exchange with 32 bit value on RV64

atomic_compare_and_swapsi will use lr.w to do obtain the original value,
which sign extends to DI.  RV64 only has DI comparisons, so we also need
to sign extend the expected value to DI as otherwise the comparison will
fail when the expected value has the 32nd bit set.

gcc/ChangeLog:

PR target/114130
* config/riscv/sync.md (atomic_compare_and_swap<mode>): Sign
extend the expected value if needed.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/pr114130.c: New.

Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
(cherry picked from commit fd07a29e39f5347d6cef3e7042a32306f97a1719)

8 weeks agoDaily bump.
GCC Administrator [Fri, 12 Apr 2024 00:19:13 +0000 (00:19 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Thu, 11 Apr 2024 00:19:21 +0000 (00:19 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Wed, 10 Apr 2024 00:19:04 +0000 (00:19 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Tue, 9 Apr 2024 00:19:39 +0000 (00:19 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Mon, 8 Apr 2024 12:17:08 +0000 (12:17 +0000)] 
Daily bump.

2 months agoFortran: fix DATA and derived types with pointer components [PR114474]
Harald Anlauf [Wed, 27 Mar 2024 20:18:04 +0000 (21:18 +0100)] 
Fortran: fix DATA and derived types with pointer components [PR114474]

When matching actual arguments in match_actual_arg, these are initially
treated as a possible dummy procedure, assuming that the correct type is
determined later.  This resolution could fail when the procedure is a
derived type constructor with a pointer component and appears in a DATA
statement, where the pointer shall be associated with an initial data
target.  Check for those cases where the type obviously has not been
resolved yet, and which were missed because there was no component
reference.

gcc/fortran/ChangeLog:

PR fortran/114474
* primary.c (gfc_variable_attr): Catch variables used in structure
constructors within DATA statements that are still tagged with a
temporary type BT_PROCEDURE from match_actual_arg and which have the
target attribute, and fix their typespec.

gcc/testsuite/ChangeLog:

PR fortran/114474
* gfortran.dg/data_pointer_3.f90: New test.

(cherry picked from commit bbb7c513dddc5c9b2d5e9b78bc1c2f85a0cfe07e)

2 months agofortran: Fix setting of array lower bound for named arrays
Chung-Lin Tang [Fri, 3 Dec 2021 09:27:17 +0000 (17:27 +0800)] 
fortran: Fix setting of array lower bound for named arrays

This patch fixes a case of setting array low-bounds, found for particular uses
of SOURCE=/MOLD=. This adjusts the relevant part in gfc_trans_allocate() to
set e3_has_nodescriptor only for non-named arrays.

2021-12-03  Tobias Burnus  <tobias@codesourcery.com>

gcc/fortran/ChangeLog:

* trans-stmt.c (gfc_trans_allocate): Set e3_has_nodescriptor to true
only for non-named arrays.

gcc/testsuite/ChangeLog:

* gfortran.dg/allocate_with_source_26.f90: Adjust testcase.
* gfortran.dg/allocate_with_mold_4.f90: New testcase.

(cherry picked from commit 6262e3a22b3d86afc116480bc59a7bb30b0cfd40)

2 months agoDaily bump.
GCC Administrator [Fri, 5 Apr 2024 00:18:32 +0000 (00:18 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Thu, 4 Apr 2024 00:18:51 +0000 (00:18 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Wed, 3 Apr 2024 00:18:53 +0000 (00:18 +0000)] 
Daily bump.

2 months agoFix SSA corruption due to widening_mul opt on conflict across an abnormal edge [PR111407]
Qing Zhao [Mon, 25 Mar 2024 14:17:56 +0000 (14:17 +0000)] 
Fix SSA corruption due to widening_mul opt on conflict across an abnormal edge [PR111407]

This is a bug in tree-ssa-math-opts.c, when applying the widening mul
optimization, the compiler needs to check whether the operand is in a
ABNORMAL PHI, if YES, we should avoid the transformation.

PR tree-optimization/111407

gcc/ChangeLog:

* tree-ssa-math-opts.c (convert_mult_to_widen): Avoid the transform
when one of the operands is subject to abnormal coalescing.

gcc/testsuite/ChangeLog:

* gcc.dg/pr111407.c: New test.

(cherry picked from commit 4aca1cfd6235090e48a53dab734437740671bbf3)

2 months agofortran: Ignore use statements on error [PR107426]
Mikael Morin [Thu, 21 Mar 2024 16:27:54 +0000 (17:27 +0100)] 
fortran: Ignore use statements on error [PR107426]

This fixes an access to freed memory on the testcase from the PR.
The problem comes from an invalid subroutine statement in an interface,
which is ignored and causes the following statements forming the procedure
body to be rejected.  One of them use-associates the intrinsic ISO_C_BINDING
module, which imports new symbols in a namespace that is freed at the time
the statement is rejected.  However, this creates dangling pointers as
ISO_C_BINDING is special and its import creates a reference to the imported
C_PTR symbol in the return type of the global intrinsic symbol for C_LOC
(see the function create_intrinsic_function).

This change saves and restores the list of use statements, so that rejected
use statements are removed before they have a chance to be applied to the
current namespace and create dangling pointers.

PR fortran/107426

gcc/fortran/ChangeLog:

* gfortran.h (gfc_save_module_list, gfc_restore_old_module_list):
New declarations.
* module.c (old_module_list_tail): New global variable.
(gfc_save_module_list, gfc_restore_old_module_list): New functions.
(gfc_use_modules): Set module_list and old_module_list_tail.
* parse.c (next_statement): Save module_list before doing any work.
(reject_statement): Restore module_list to its saved value.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr89943_3.f90: Update error pattern.
* gfortran.dg/pr89943_4.f90: Likewise.
* gfortran.dg/use_31.f90: New test.

(cherry picked from commit a44d7e8a52007c2d45217709ca02947c6600de87)

2 months agoDaily bump.
GCC Administrator [Tue, 2 Apr 2024 00:18:16 +0000 (00:18 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Mon, 1 Apr 2024 00:17:58 +0000 (00:17 +0000)] 
Daily bump.

2 months agoObjective-C, NeXT: Fix messenging non-aggregate return-in-memory.
Iain Sandoe [Mon, 16 Aug 2021 20:22:13 +0000 (21:22 +0100)] 
Objective-C, NeXT: Fix messenging non-aggregate return-in-memory.

When a method returns a type that the platform ABI says should be
returned in memory, and that is done by a hidden 'sret' parameter,
the message send calls must be adjusted to inform the runtime that
the sret parameter is present.  As reported in the PR, this is not
working for non-aggregate types that use this mechanism.  The fix
here is to adjust the logic such that all return values that flag
'in memory' are considered to use the mechanism *unless* they
provide a struct_value_rtx *and* the return object is an aggregate.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR objc/101718 - Objective-C frontend emits wrong code to call methods returning scalar types returned in memory

PR objc/101718

gcc/objc/ChangeLog:

* objc-next-runtime-abi-02.c (build_v2_build_objc_method_call):
Revise for cases where scalar objects use an sret parameter.
(next_runtime_abi_02_build_objc_method_call): Likwise.

(cherry picked from commit 1cef3039b880a21fbdf4153e6fc42026619fd4ad)

2 months agoDaily bump.
GCC Administrator [Sun, 31 Mar 2024 00:18:40 +0000 (00:18 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 30 Mar 2024 00:18:25 +0000 (00:18 +0000)] 
Daily bump.

2 months agoFortran: fix NULL pointer dereference on overlapping initialization [PR50410]
Harald Anlauf [Thu, 28 Mar 2024 21:34:40 +0000 (22:34 +0100)] 
Fortran: fix NULL pointer dereference on overlapping initialization [PR50410]

gcc/fortran/ChangeLog:

PR fortran/50410
* trans-expr.c (gfc_conv_structure): Check for NULL pointer.

gcc/testsuite/ChangeLog:

PR fortran/50410
* gfortran.dg/data_initialized_4.f90: New test.

(cherry picked from commit 6fb253a25dff13253d63553f02e0fe72c5e3ab4e)