From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1298) id 226833858C2D; Tue, 11 Oct 2022 07:28:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 226833858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665473310; bh=Oq5SHmHdJxH7+mvUCiOT70NuqaACHLAiCKM4JLM13BA=; h=From:To:Subject:Date:From; b=A/mTLr0LLTOa7LY/q3WP0wv8Ayr06icpnP9OZqGdCez7r8/VAS4S7IjEWJC62W3Nl 4j6/BUeObwn2BKBjoGMSGDUW6lOkcFm1n6m+93hXmL1P6x4Y8VIpkPesEDMDR2Tteg qQOWcvHW7BGYBRUtGUp4BQxWnXuvwGui/0rzD6BI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Olivier Hainque To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3215] Tigthen the addition of -lgcc_eh to vxworks_libgcc_spec X-Act-Checkin: gcc X-Git-Author: Olivier Hainque X-Git-Refname: refs/heads/master X-Git-Oldrev: 70d81e3a782ca8451c1c6b2c57ed154d20906aa3 X-Git-Newrev: 46325c16324b06fa1b3ea7f8cb05f2109ed66cf6 Message-Id: <20221011072830.226833858C2D@sourceware.org> Date: Tue, 11 Oct 2022 07:28:30 +0000 (GMT) List-Id: https://gcc.gnu.org/g:46325c16324b06fa1b3ea7f8cb05f2109ed66cf6 commit r13-3215-g46325c16324b06fa1b3ea7f8cb05f2109ed66cf6 Author: Olivier Hainque Date: Fri Feb 18 22:44:53 2022 +0000 Tigthen the addition of -lgcc_eh to vxworks_libgcc_spec This change refines VXWORKS_LIBGCC_SPEC wrt the inclusion of -lgcc_eh. Unless the compiler features support for dual sjlj and table based eh, libgcc_eh.a is available only with multilib variants for which we build a shared lib (mrtp on VxWorks). Rework logic to handle absence of libgcc_s for -mrtp -mcmodel=large, using a conditional expr kind of spec. The gthread support in libgcc_eh might resort to libgcc functions on some targets, e.g. cas synchronisation routines on aarch64. Arrange to append -lgcc also after -lgcc_eh in VXWORKS_LIBGCC_SPEC. 2022-10-09 Olivier Hainque gcc/ * config/vxworks.h (VX_LGCC_EH_SO0, VX_LGCC_EH_SO1): New internal macros. (VXWORKS_LIBGCC_SPEC): Use them and document. Diff: --- gcc/config/vxworks.h | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h index 075a45109e8..e7e5ffe9999 100644 --- a/gcc/config/vxworks.h +++ b/gcc/config/vxworks.h @@ -224,14 +224,54 @@ extern void vxworks_driver_init (unsigned int *, struct cl_decoded_option **); #undef VXWORKS_LINK_SPEC #define VXWORKS_LINK_SPEC VXWORKS_BASE_LINK_SPEC " " VXWORKS_EXTRA_LINK_SPEC +/* Control how to include libgcc in the link closure, handling both "shared" + and "non-static" in addition to "static-libgcc" when shared lib support is + enabled. */ + #undef VXWORKS_LIBGCC_SPEC + +/* libgcc_eh control; libgcc_eh.a is available either together with libgcc_s + (mrtp and mcmodel!=large when configured with --enable-shared) or when the + compiler is specially setup to support dual sjlj/table-based eh. */ + +/* VX_LGCC_EH_SO1: The "-lgcc_eh" part we need in situations where we know a + shared libgcc is available (ENABLE_SHARED_LIBGCC + mrtp multilib). */ + +#define VX_LGCC_EH_SO1 " -lgcc_eh -lgcc" +/* Extra -lgcc to handle functions from libgcc_eh that refer to symbols + exposed by libgcc and not guaranteed to be dragged in before -lgcc_eh + appears. */ + +/* VX_LGCC_EH_SO0: The "-lgcc_eh" part we need in situations where we know a + shared libgcc is not available (!ENABLE_SHARED_LIBGCC or !mrtp multlib). */ + +#if !defined(CONFIG_DUAL_EXCEPTIONS) + +/* No shared lib && !DUAL_EH -> no libgcc_eh available at all. */ +#define VX_LGCC_EH_SO0 + +#else /* CONFIG_DUAL_EXCEPTIONS */ + +/* No shared lib but DUAL_EH -> libgcc_eh around and spec handled by the driver + depending on ENABLE_SHARED_LIBGCC. If defined, the driver expects a regular + sequence. Otherwise, the driver is expected to turn -lgcc into -lgcc_eh on + its own and just add an instance to address possible cross refs. */ + +#if defined(ENABLE_SHARED_LIBGCC) +#define VX_LGCC_EH_SO0 " -lgcc_eh -lgcc" +#else +#define VX_LGCC_EH_SO0 " -lgcc" +#endif + +#endif /* CONFIG_DUAL_EXCEPTIONS */ + #if defined(ENABLE_SHARED_LIBGCC) #define VXWORKS_LIBGCC_SPEC \ -"%{!mrtp:-lgcc -lgcc_eh} \ - %{mrtp:%{!static-libgcc:%{shared|non-static:-lgcc_s;:-lgcc -lgcc_eh}} \ - %{static-libgcc:-lgcc -lgcc_eh}}" + "%{!mrtp|mcmodel=large:-lgcc" VX_LGCC_EH_SO0 ";" \ + " :%{!static-libgcc:%{shared|non-static:-lgcc_s;:-lgcc" VX_LGCC_EH_SO1 "}} \ + %{static-libgcc:-lgcc" VX_LGCC_EH_SO1 "}}" #else -#define VXWORKS_LIBGCC_SPEC "-lgcc" +#define VXWORKS_LIBGCC_SPEC "-lgcc" VX_LGCC_EH_SO0 #endif /* Setup the crtstuff begin/end we might need for dwarf EH registration