From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 59DB03858D3C for ; Mon, 22 Jan 2024 08:23:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 59DB03858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 59DB03858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705911809; cv=none; b=rOEiV4Ejnxl55ZoqdA+YisOUQ8VqtR52A6TK++zh/kdF4xKd7a940VUAKTBH0Mdv/0BLU4KZxpubYEWAS5PtUew8BPWg2/FPyT2lC51W696BPG5JI7BpkugaW1mxVEPdOvWcdFSSRsd56Xn4VWaRr/rieJTMA77XNLhDemrDaMo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705911809; c=relaxed/simple; bh=p/nyCwFuxTV3nS1RpEnotWDDCHMhFznff3iUUj6Sqhc=; h=DKIM-Signature:Mime-Version:Subject:From:Date:Message-Id:To; b=DcGUICrQ3J/PNSIOQ+6nDZT39d/1hnHTy0nWzYf8Y/T517zmZvJ+s4yH2u/8SLj9x0WAqmK3IcxTxAbci08hVknZCBL8yvrZmXdkPp0ygJSXIKp7bcWZGAGmV7jd1wwc4FmrotWQ46RsnMwAEAuPIV+8iteGp+fFy5ABvIIgavI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40e880121efso32353815e9.3 for ; Mon, 22 Jan 2024 00:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705911803; x=1706516603; darn=gcc.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=13PPRb0SOsSHRxN2fGtrGJJ9bzmfw5z8r01OaMpQ4fo=; b=aefj/oY03yEuc4H4kv96rbkEuIWyRKXR0WEHQhXt66qUNO6731XV6cTbStIwmbOD/i s/K76fKiEoXz5jDmuJFgd7HBYjuiLHYRs+Lme1n43u7Wb6eHILNPy12XdAIQpTPSVTsl /HFZkqG+Lwoxx71RIzQKQpZ8JIukheoeOHIcJwOmVZHz1jEbxby9BsKMoRKHEEm1u6n0 +YLz4lDowFHFNjy8OYzB4vhG2qaCss1sLLzXirSooSifyGLy9HI/TtEFAkb4AotiI6Hh I8ymoGZFpF5/wY1Y3WgKGPf7LA0p/qSKSv5VYGVq1hCZsNPSoX1EyxRWq5aeQqmo1Fl7 8dZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705911803; x=1706516603; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=13PPRb0SOsSHRxN2fGtrGJJ9bzmfw5z8r01OaMpQ4fo=; b=PKSGUpRr1PxJnJez7//8LdUdZuSXJU+mTx1f4WtUL+fu2tehifZ1U/fmCNKYuvMxOD tYlJd2WlPYlpSnLq1p/sy4iMuRA2+7dxf3qcfGkiDNv8Zf2LB7nqQjfUg0FAGow7Baf8 r2LX3nmVr5at+GIPlBVWHPuD5HE5yMNSmUyn1ulKfgNZvM+R11xd5R6bRnTZ0qCtRasH gvpReMvmuNTt4iL6mJNptZVZ8iQ2yvxTNlcegqR7ROzjvhoyPYGiWKlfGQfzGKROKK4v CuIFIGKypiIJEIu+Rbas4J0jqLXqEQZ3RTYOe+99MrYR02b/0xvnxTdksBm9IrjZqSz7 80yA== X-Gm-Message-State: AOJu0Yx+ODHNxEVIpl+SRwAO5kj2Pp7v4PjEtSM4sIcY2S0eygIVsVbl l4dr9HdSB2B0MYytnS0u29SenMZ4XOZV9hTC/+qPXsdTiRSZua0o X-Google-Smtp-Source: AGHT+IH6mXsj30DdJegZhjqXrlwlVv9jI55BAAtTCyWAmbuNxCFe4LnIa8ALVIeuPQnR9a7SRsf51A== X-Received: by 2002:a05:600c:4fc1:b0:40e:67e9:af1 with SMTP id o1-20020a05600c4fc100b0040e67e90af1mr1966510wmq.3.1705911802630; Mon, 22 Jan 2024 00:23:22 -0800 (PST) Received: from smtpclient.apple (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id g14-20020a05600c4ece00b0040e8bf3c9a9sm17452278wmq.21.2024.01.22.00.23.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2024 00:23:22 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: Re: [PATCH] jit, Darwin: Implement library exports list. From: Iain Sandoe In-Reply-To: <20240116111025.14659-1-iain@sandoe.co.uk> Date: Mon, 22 Jan 2024 08:23:21 +0000 Cc: GCC Patches Content-Transfer-Encoding: quoted-printable Message-Id: <291D46D7-B8AA-4EBB-995D-CC7782B28A86@gmail.com> References: <20240116111025.14659-1-iain@sandoe.co.uk> To: dmalcolm@redhat.com X-Mailer: Apple Mail (2.3696.120.41.1.4) X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: gentle ping, this fixes quite a few of the new jit fails on darwin. thanks Iain > On 16 Jan 2024, at 11:10, Iain Sandoe wrote: >=20 > Tested on x86_64, i686 Darwin and x86_64 Linux, > OK for trunk? when ? > thanks, > Iain >=20 > --- 8< --- >=20 > 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. >=20 > 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). >=20 > This fixes a number of new failures in jit testing. >=20 > gcc/jit/ChangeLog: >=20 > * Make-lang.in: Implement exports list, and use a shared > libgcc. > * libgccjit.exp: New file. >=20 > Signed-off-by: Iain Sandoe > --- > gcc/jit/Make-lang.in | 38 ++++--- > gcc/jit/libgccjit.exp | 229 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 251 insertions(+), 16 deletions(-) > create mode 100644 gcc/jit/libgccjit.exp >=20 > diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in > index b1f0ce73e12..52dc2c24908 100644 > --- a/gcc/jit/Make-lang.in > +++ b/gcc/jit/Make-lang.in > @@ -55,7 +55,10 @@ else >=20 > ifneq (,$(findstring darwin,$(host))) >=20 > -LIBGCCJIT_AGE =3D 1 > +LIBGCCJIT_CURRENT =3D 26 > +LIBGCCJIT_REVISION =3D 0 > +LIBGCCJIT_AGE =3D 26 > +LIBGCCJIT_COMPAT =3D 0 > LIBGCCJIT_BASENAME =3D libgccjit >=20 > LIBGCCJIT_SONAME =3D \ > @@ -63,15 +66,15 @@ LIBGCCJIT_SONAME =3D \ > LIBGCCJIT_FILENAME =3D = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib > LIBGCCJIT_LINKER_NAME =3D $(LIBGCCJIT_BASENAME).dylib >=20 > -# Conditionalize the use of the LD_VERSION_SCRIPT_OPTION and > -# LD_SONAME_OPTION depending if configure found them, using $(if) > -# We have to define a COMMA here, otherwise the commas in the "true" > -# result are treated as separators by the $(if). > -COMMA :=3D , > +# Darwin does not have a version script option. Exported symbols are = controlled > +# by the following, and library versioning is done using libtool. > LIBGCCJIT_VERSION_SCRIPT_OPTION =3D \ > - $(if $(LD_VERSION_SCRIPT_OPTION),\ > - = -Wl$(COMMA)$(LD_VERSION_SCRIPT_OPTION)$(COMMA)$(srcdir)/jit/libgccjit.map)= > + -Wl,-exported_symbols_list,$(srcdir)/jit/libgccjit.exp >=20 > +# Conditionalize the use of LD_SONAME_OPTION on configure finding = it, using > +# $(if). We have to define a COMMA here, otherwise the commas in the = "true" > +# result are treated as separators by the $(if). > +COMMA :=3D , > LIBGCCJIT_SONAME_OPTION =3D \ > $(if $(LD_SONAME_OPTION), \ > -Wl$(COMMA)$(LD_SONAME_OPTION)$(COMMA)$(LIBGCCJIT_SONAME)) > @@ -143,15 +146,18 @@ ifneq (,$(findstring mingw,$(target))) > # Create import library > LIBGCCJIT_EXTRA_OPTS =3D -Wl,--out-implib,$(LIBGCCJIT_IMPORT_LIB) > else > - > ifneq (,$(findstring darwin,$(host))) > -# TODO : Construct a Darwin-style symbol export file. > -LIBGCCJIT_EXTRA_OPTS =3D = -Wl,-compatibility_version,$(LIBGCCJIT_VERSION_NUM) \ > - = -Wl,-current_version,$(LIBGCCJIT_VERSION_NUM).$(LIBGCCJIT_MINOR_NUM).$(LIB= GCCJIT_AGE) \ > - $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \ > - $(LIBGCCJIT_SONAME_OPTION) > +LIBGCCJIT_VERS =3D = $(LIBGCCJIT_CURRENT).$(LIBGCCJIT_REVISION).$(LIBGCCJIT_AGE) > +LIBGCCJIT_EXTRA_OPTS =3D -Wl,-current_version,$(LIBGCCJIT_VERS) \ > + -Wl,-compatibility_version,$(LIBGCCJIT_COMPAT) \ > + $(LIBGCCJIT_VERSION_SCRIPT_OPTION) $(LIBGCCJIT_SONAME_OPTION) > +# Use the default (shared) libgcc. > +JIT_LDFLAGS =3D $(filter-out -static-libgcc, $(LDFLAGS)) > +ifeq (,$(findstring darwin8,$(host))) > +JIT_LDFLAGS +=3D -Wl,-rpath,@loader_path > +endif > else > - > +JIT_LDFLAGS =3D $(LDFLAGS) > LIBGCCJIT_EXTRA_OPTS =3D $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \ > $(LIBGCCJIT_SONAME_OPTION) > endif > @@ -170,7 +176,7 @@ $(LIBGCCJIT_FILENAME): $(jit_OBJS) \ > $(LIBDEPS) $(srcdir)/jit/libgccjit.map \ > $(EXTRA_GCC_OBJS_EXCLUSIVE) $(jit.prev) > @$(call LINK_PROGRESS,$(INDEX.jit),start) > - +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ -shared \ > + +$(LLINKER) $(ALL_LINKERFLAGS) $(JIT_LDFLAGS) -o $@ -shared \ > $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \ > $(CPPLIB) $(LIBDECNUMBER) $(EXTRA_GCC_LIBS) $(LIBS) = $(BACKENDLIBS) \ > $(EXTRA_GCC_OBJS_EXCLUSIVE) \ > diff --git a/gcc/jit/libgccjit.exp b/gcc/jit/libgccjit.exp > new file mode 100644 > index 00000000000..0829503a53e > --- /dev/null > +++ b/gcc/jit/libgccjit.exp > @@ -0,0 +1,229 @@ > +# Linker export list for Darwin libgccjit.dylib > + > +# Contributed by Iain Sandoe . > +# > +# This file is part of GCC. > +# > +# GCC is free software you can redistribute it and/or modify it > +# under the terms of the GNU General Public License as published by > +# the Free Software Foundation either version 3, or (at your option) > +# any later version. > +# > +# GCC is distributed in the hope that it will be useful, but > +# WITHOUT ANY WARRANTY without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +# General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with GCC see the file COPYING3. If not see > +# . */ > + > +# The initial release of the library. > +# Keep this list sorted alphabetically: > +_gcc_jit_block_add_assignment > +_gcc_jit_block_add_assignment_op > +_gcc_jit_block_add_comment > +_gcc_jit_block_add_eval > +_gcc_jit_block_as_object > +_gcc_jit_block_end_with_conditional > +_gcc_jit_block_end_with_jump > +_gcc_jit_block_end_with_return > +_gcc_jit_block_end_with_void_return > +_gcc_jit_block_get_function > +_gcc_jit_context_acquire > +_gcc_jit_context_compile > +_gcc_jit_context_compile_to_file > +_gcc_jit_context_dump_to_file > +_gcc_jit_context_dump_reproducer_to_file > +_gcc_jit_context_enable_dump > +_gcc_jit_context_get_builtin_function > +_gcc_jit_context_get_first_error > +_gcc_jit_context_get_last_error > +_gcc_jit_context_get_type > +_gcc_jit_context_get_int_type > +_gcc_jit_context_new_array_access > +_gcc_jit_context_new_array_type > +_gcc_jit_context_new_binary_op > +_gcc_jit_context_new_call > +_gcc_jit_context_new_call_through_ptr > +_gcc_jit_context_new_cast > +_gcc_jit_context_new_child_context > +_gcc_jit_context_new_comparison > +_gcc_jit_context_new_field > +_gcc_jit_context_new_function > +_gcc_jit_context_new_function_ptr_type > +_gcc_jit_context_new_global > +_gcc_jit_context_new_location > +_gcc_jit_context_new_opaque_struct > +_gcc_jit_context_new_param > +_gcc_jit_context_new_rvalue_from_double > +_gcc_jit_context_new_rvalue_from_int > +_gcc_jit_context_new_rvalue_from_long > +_gcc_jit_context_new_rvalue_from_ptr > +_gcc_jit_context_new_string_literal > +_gcc_jit_context_new_struct_type > +_gcc_jit_context_new_unary_op > +_gcc_jit_context_new_union_type > +_gcc_jit_context_null > +_gcc_jit_context_one > +_gcc_jit_context_release > +_gcc_jit_context_set_bool_option > +_gcc_jit_context_set_int_option > +_gcc_jit_context_set_logfile > +_gcc_jit_context_set_str_option > +_gcc_jit_context_zero > +_gcc_jit_field_as_object > +_gcc_jit_function_as_object > +_gcc_jit_function_dump_to_dot > +_gcc_jit_function_get_param > +_gcc_jit_function_new_block > +_gcc_jit_function_new_local > +_gcc_jit_location_as_object > +_gcc_jit_lvalue_as_object > +_gcc_jit_lvalue_as_rvalue > +_gcc_jit_lvalue_access_field > +_gcc_jit_lvalue_get_address > +_gcc_jit_object_get_context > +_gcc_jit_object_get_debug_string > +_gcc_jit_param_as_lvalue > +_gcc_jit_param_as_object > +_gcc_jit_param_as_rvalue > +_gcc_jit_result_get_code > +_gcc_jit_result_get_global > +_gcc_jit_result_release > +_gcc_jit_rvalue_access_field > +_gcc_jit_rvalue_as_object > +_gcc_jit_rvalue_dereference > +_gcc_jit_rvalue_dereference_field > +_gcc_jit_rvalue_get_type > +_gcc_jit_struct_as_type > +_gcc_jit_struct_set_fields > +_gcc_jit_type_as_object > +_gcc_jit_type_get_const > +_gcc_jit_type_get_pointer > +_gcc_jit_type_get_volatile > + > +# Add support for adding arbitrary command-line options (PR = jit/66628). > +# LIBGCCJIT_ABI_1 > +_gcc_jit_context_add_command_line_option > + > +# Add support for disabling the check for unreachable blocks (PR = jit/66546). > +# LIBGCCJIT_ABI_2 > +_gcc_jit_context_set_bool_allow_unreachable_blocks > + > +# Add support for switch statements. > +# LIBGCCJIT_ABI_3 > +_gcc_jit_block_end_with_switch > +_gcc_jit_case_as_object > +_gcc_jit_context_new_case > + > +# Add timing API. > +#LIBGCCJIT_ABI_4 > +_gcc_jit_context_get_timer > +_gcc_jit_context_set_timer > +_gcc_jit_timer_new > +_gcc_jit_timer_release > +_gcc_jit_timer_push > +_gcc_jit_timer_pop > +_gcc_jit_timer_print > + > +# LIBGCCJIT_ABI_5 > +_gcc_jit_context_set_bool_use_external_driver > + > +# LIBGCCJIT_ABI_6 > +_gcc_jit_rvalue_set_bool_require_tail_call > + > +# LIBGCCJIT_ABI_7 > +_gcc_jit_type_get_aligned > + > +# LIBGCCJIT_ABI_8 > +_gcc_jit_type_get_vector > + > +# LIBGCCJIT_ABI_9 > +_gcc_jit_function_get_address > + > +# LIBGCCJIT_ABI_10 > +_gcc_jit_context_new_rvalue_from_vector > + > +# LIBGCCJIT_ABI_11 > +_gcc_jit_context_add_driver_option > + > +# LIBGCCJIT_ABI_12 > +_gcc_jit_context_new_bitfield > + > +# LIBGCCJIT_ABI_13 > +_gcc_jit_version_major > +_gcc_jit_version_minor > +_gcc_jit_version_patchlevel > + > +# LIBGCCJIT_ABI_14 > +_gcc_jit_global_set_initializer > + > +# LIBGCCJIT_ABI_15 > +_gcc_jit_block_add_extended_asm > +_gcc_jit_block_end_with_extended_asm_goto > +_gcc_jit_extended_asm_as_object > +_gcc_jit_extended_asm_set_volatile_flag > +_gcc_jit_extended_asm_set_inline_flag > +_gcc_jit_extended_asm_add_output_operand > +_gcc_jit_extended_asm_add_input_operand > +_gcc_jit_extended_asm_add_clobber > +_gcc_jit_context_add_top_level_asm > + > +# LIBGCCJIT_ABI_16 > +_gcc_jit_function_get_return_type > +_gcc_jit_function_get_param_count > +_gcc_jit_function_type_get_return_type > +_gcc_jit_function_type_get_param_count > +_gcc_jit_function_type_get_param_type > +_gcc_jit_type_unqualified > +_gcc_jit_type_dyncast_array > +_gcc_jit_type_is_bool > +_gcc_jit_type_dyncast_function_ptr_type > +_gcc_jit_type_is_integral > +_gcc_jit_type_is_pointer > +_gcc_jit_type_dyncast_vector > +_gcc_jit_vector_type_get_element_type > +_gcc_jit_vector_type_get_num_units > +_gcc_jit_struct_get_field > +_gcc_jit_type_is_struct > +_gcc_jit_struct_get_field_count > + > +# LIBGCCJIT_ABI_17 > +_gcc_jit_lvalue_set_tls_model > + > +# LIBGCCJIT_ABI_18 > +_gcc_jit_lvalue_set_link_section > + > +#LIBGCCJIT_ABI_19 > +_gcc_jit_context_new_array_constructor > +_gcc_jit_context_new_struct_constructor > +_gcc_jit_context_new_union_constructor > +_gcc_jit_global_set_initializer_rvalue > + > +# LIBGCCJIT_ABI_20 > +_gcc_jit_compatible_types > +_gcc_jit_type_get_size > + > +# LIBGCCJIT_ABI_21 > +_gcc_jit_context_new_bitcast > + > +# LIBGCCJIT_ABI_22 > +_gcc_jit_lvalue_set_register_name > + > +# LIBGCCJIT_ABI_23 > +_gcc_jit_context_set_bool_print_errors_to_stderr > + > +# LIBGCCJIT_ABI_24 > +_gcc_jit_lvalue_set_alignment > +_gcc_jit_lvalue_get_alignment > + > +# LIBGCCJIT_ABI_25 > +_gcc_jit_type_get_restrict > + > +# LIBGCCJIT_ABI_26=20 > +_gcc_jit_function_add_attribute > +_gcc_jit_function_add_string_attribute > +_gcc_jit_lvalue_add_string_attribute > +_gcc_jit_function_add_integer_array_attribute > + > --=20 > 2.39.2 (Apple Git-143) >=20