From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 6AE51385840C for ; Sun, 16 Jul 2023 10:39:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AE51385840C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3159b524c56so890565f8f.1 for ; Sun, 16 Jul 2023 03:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689503946; x=1690108746; h=to:cc:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=GF1sdCLM6XDvKSM+ctn7XMOJrLMJH2sp82YkGtCrq6M=; b=payGGBymlKi/E1rVz5i7qUdJBcl6164JJdclzRK6OMAr6Zl6TvRmNlx0/9Zksc0eYe XtXVumLTLwLtLFoJzd9L3AiLQ8Egr0OjHVHU6ODVVZhrFcUvrcIvyHQyklg+KhJAUQkB /VykEnvKVgAbO2+Kemaklpb9Ka6O2AHwVQK4q0ZpwaS+Y5nlZXZZdu+AwtJ1EOJWUBeq d+L3SvdX1cEpFGuHlaNY7rJOWXslMmFGlinX1oLtuJ0axDmWqOptMTvbDxfgFzs4NgMo Pfndkc3MT828pGt+IjWq/FjSgssUmku2CtIrwPvlsoozjA/rcC/2K9G9b2IPWv8Y3a4j aZpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689503946; x=1690108746; h=to:cc:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GF1sdCLM6XDvKSM+ctn7XMOJrLMJH2sp82YkGtCrq6M=; b=go3QBpm4B/oV0uoYyexlJGkBq9pH+9BtJwuv54ym0/UDRler2wkOED3XkMe/Y7GWgu osi5axt66JoSgGqh+46r02aL6Ae38s5hVtywcOXLjbf6Mut6j59k+j2V1CJtV8j93IUx yUKqeYttyIntR9UmGfGgRCZCFgVGTpUs7+WPzsvVu3Yb0ZykUpxgZHrhlcPQOUCu9ic5 SEolfm+0FXAQbkDVQ+iDMtjXDyhRKKZbcUHruD7L4KgC1WOXcqXba688MCR26UYxNOy+ Xa+Idk1hE7Yo2v6/Pmc1swUL7vkJxuTMwO1affbWlM2cLNl6RZcEb+Hnw36C6+L1Tb40 rfzQ== X-Gm-Message-State: ABy/qLZRmzp/emyzWJSjnFiU7O4GK4oB8VdwhteOL/riOV7R1YLK3hQ7 PVBmWcgH3iRTfiTjDxJHLTektlAsxp0= X-Google-Smtp-Source: APBJJlFFpYAPLpaJsRpAj2wbDprLDYZIgMh1FIHCN2GqmhJ1PLoj0oRsWR1TBYUdA1GXgb4rMtOilQ== X-Received: by 2002:adf:efc1:0:b0:315:9d08:9d4a with SMTP id i1-20020adfefc1000000b003159d089d4amr704069wrp.4.1689503945889; Sun, 16 Jul 2023 03:39:05 -0700 (PDT) Received: from smtpclient.apple ([78.194.136.203]) by smtp.gmail.com with ESMTPSA id i10-20020a5d558a000000b0030fb828511csm16043795wrv.100.2023.07.16.03.39.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Jul 2023 03:39:05 -0700 (PDT) From: FX Coudert Content-Type: multipart/mixed; boundary="Apple-Mail=_3FD27E5F-A118-43CA-8ABE-7612B30CB0EC" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: [PATCH] core: Support heap-based trampolines Message-Id: Date: Sun, 16 Jul 2023 12:38:54 +0200 Cc: Iain Sandoe , maxim.blinov@embecosm.com, ebotcazou@adacore.com, Jeff Law To: gcc-patches@gcc.gnu.org X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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: --Apple-Mail=_3FD27E5F-A118-43CA-8ABE-7612B30CB0EC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, This is a reworked version (following review) of the patch by Maxim = Blinov and Iain Sandoe enabling heap-based trampolines. What has changed = since the last version: - wording changes, preferring to use =E2=80=9Cheap-based trampolines=E2=80= =9D rather than =E2=80=9Coff-stack trampolines=E2=80=9D - the option triggering generation of these new trampolines is now a = binary choice: -ftrampoline-impl=3D[stack|heap] - some adjustments due to changes in the macOS build flags in GCC since = last year Regarding testing, this patch has had excellent exposure on darwin (both = x86_64 and aarch64) because it was part of Iain=E2=80=99s branch, = distributed by many macOS distros/vendors (including Homebrew) for more = than a year, and there was no bug report against the feature or = implementation. On x86_64-linux, I have regression-tested it in three = different configurations: - a default build - a build with --enable-heap-trampolines - a build with --enable-heap-trampolines and heap trampolines forced by = default (forcing HEAP_TRAMPOLINES_INIT =3D 1) There are no regressions in any of these settings (apart from an = expected missing warning in gcc.dg/Wtrampolines.c). ---------- =46rom the original review, one question asked (by Jeff Law) was: = whether the two linux implementations should be dropped, and the = configure time=20 selectability as well. Regardless of the answer to the first question, I = think we probably want to retain the later, even if only for darwin, as = we want to implement this only on recent darwin versions. OK to commit? FX --Apple-Mail=_3FD27E5F-A118-43CA-8ABE-7612B30CB0EC Content-Disposition: attachment; filename=0001-core-Support-heap-based-trampolines.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-core-Support-heap-based-trampolines.patch" Content-Transfer-Encoding: quoted-printable =46rom=20d52627ab9aad754d872874401ec8de623ca775f1=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Maxim=20Blinov=20=0A= Date:=20Sat,=2013=20Nov=202021=2004:39:53=20+0000=0ASubject:=20[PATCH]=20= core:=20Support=20heap-based=20trampolines=0A=0A1.=20Generate=20= heap-based=20nested=20function=20trampolines=0A=0AAdd=20support=20for=20= allocating=20nested=20function=20trampolines=20on=20an=0Aexecutable=20= heap=20rather=20than=20on=20the=20stack.=20This=20is=20motivated=20by=20= targets=0Asuch=20as=20AArch64=20Darwin,=20which=20globally=20prohibit=20= executing=20code=20on=20the=0Astack.=0A=0AThe=20target-specific=20= routines=20for=20allocating=20and=20writing=20trampolines=20is=0Ato=20be=20= provided=20in=20libgcc,=20and=20is=20by-default=20_not_=20compiled=20in=20= unless=0Athe=20target=20specifically=20requires=20it,=20or=20you=20= manually=20provide=0A--enable-heap-trampolines=20when=20configuring=20= gcc/libgcc.=0A=0AThe=20gcc=20flag=20-ftrampoline-impl=20controls=20= whether=20to=20generate=20code=0Athat=20instantiates=20trampolines=20on=20= the=20stack,=20or=20to=20emit=20calls=20to=0A= __builtin_nested_func_ptr_created=20and=0A= __builtin_nested_func_ptr_deleted.=20Note=20that=20this=20flag=20is=20= completely=0Aindependent=20of=20libgcc:=20If=20libgcc=20is=20for=20any=20= reason=20missing=20those=0Asymbols,=20you=20will=20get=20a=20link=20= failure.=0A=0AThis=20implementation=20imposes=20some=20implicit=20= restrictions=20as=20compared=20to=0Astack=20trampolines.=20longjmp'ing=20= back=20to=20a=20state=20before=20a=20trampoline=20was=0Acreated=20will=20= cause=20us=20to=20skip=20over=20the=20corresponding=0A= __builtin_nested_func_ptr_deleted,=20which=20will=20leak=20trampolines=0A= starting=20from=20the=20beginning=20of=20the=20linked=20list=20of=20= allocated=0Atrampolines.=20There=20may=20be=20scope=20for=20= instrumenting=20longjmp/setjmp=20to=0Atrigger=20cleanups=20of=20= trampolines.=0A=0A2.=20Add=20x86_64-linux=20support=20for=20heap-based=20= trampolines=0A=0AImplement=20the=20= __builtin_nested_func_ptr_{created,deleted}=20functions=0Afor=20the=20= x86_64-linux=20platform.=20This=20serves=20to=20exercise=20the=0A= infrastructure=20added=20in=20libgcc=20(--enable-heap-trampolines)=20and=0A= gcc=20(-ftrampoline-impl=3Dheap)=20in=20supporting=20heap-based=20= trampoline=0Ageneration,=20and=20is=20intended=20primarily=20for=20= demonstration=20and=20debugging=0Apurposes.=0A=0A3.=20Add=20= aarch64-linux=20support=20for=20head-based=20trampolines=0A=0AImplement=20= the=20__builtin_nested_func_ptr_{created,deleted}=20functions=0Afor=20= the=20aarch64-linux=20platform.=20This=20serves=20to=20exercise=20the=0A= infrastructure=20added=20in=20libgcc=20(--enable-heap-trampolines)=20and=0A= gcc=20(-ftrampoline-impl=3Dheap)=20in=20supporting=20heap-based=20= trampoline=0Ageneration,=20and=20is=20intended=20primarily=20for=20= demonstration=20and=20debugging=0Apurposes.=0A=0A4.=20Darwin,=20aarch64,=20= x86_64:=20Support=20heap=20trampolines.=0A=0AImplement=20the=20= __builtin_nested_func_ptr_{created,deleted}=20functions=20for=0Ax86_64=20= and=20aarch64=20Darwin.=0A=0AFor=20aarch64=20--enable-heap-trampolines=20= is=20enabled=20by=20default,=20and=0A-ftrampoline-impl=3Dheap=20is=20= enabled=20by=20default=20if=20we=20are=20on=20host=20macOS=0Aversion=20= 11.x=20or=20greater.=0A=0AFor=20x86_64=20this=20is=20configure-time=20= opt-in=20(and=20can=20be=20applied=20from=2010.10=0Aonwards)=0A=0A= Co-Authored-By:=20Andrew=20Burgess=20=0A= Co-Authored-By:=20Iain=20Sandoe=20=0A=0A= gcc/ChangeLog:=0A=0A=09*=20builtins.def=20(BUILT_IN_NESTED_PTR_CREATED):=20= Define.=0A=09(BUILT_IN_NESTED_PTR_DELETED):=20Ditto.=0A=09*=20common.opt=20= (ftrampoline-impl):=20Add=20option=20to=20control=0A=09generation=20of=20= trampoline=20instantiation=20(heap=20or=20stack).=0A=09*=20config.gcc:=20= Default=20to=20heap=20trampolines=20on=20macOS=2011=20and=20above.=0A=09= *=20config.in:=20Regenerate.=0A=09*=20config/i386/darwin.h:=20Define=20= X86_CUSTOM_FUNCTION_TEST.=0A=09*=20config/i386/i386.h:=20Define=20= X86_CUSTOM_FUNCTION_TEST.=0A=09*=20config/i386/i386.cc:=20Use=20= X86_CUSTOM_FUNCTION_TEST.=0A=09*=20coretypes.h:=20Define=20enum=20= trampoline_impl.=0A=09*=20tree-nested.cc=20(convert_tramp_reference_op):=20= Don't=20bother=20calling=0A=09__builtin_adjust_trampoline=20for=20heap=20= trampolines.=0A=09(finalize_nesting_tree_1):=20Emit=20calls=20to=0A=09= __builtin_nested_...{created,deleted}=20if=20we're=20generating=20with=0A= =09-ftrampoline-impl=3Dheap.=0A=09*=20tree.cc=20= (build_common_builtin_nodes):=20Build=0A=09= __builtin_nested_...{created,deleted}.=0A=09*=20doc/invoke.texi=20= (-ftrampoline-impl):=20Document.=0A=0Alibgcc/ChangeLog:=0A=0A=09*=20= configure.ac:=20Add=20configure=20parameter=0A=09= --enable-heap-trampolines,=20and=20do=20error=20checking=20if=20we've=0A=09= trying=20to=20enable=20heap-based=20trampolines=20for=20a=20platform=20= that=20doesn't=0A=09provide=20any=20such=20implementation.=0A=09*=20= libgcc-std.ver.in:=20Ditto.=0A=09*=20libgcc2.h=20= (__builtin_nested_func_ptr_created):=20Declare.=0A=09= (__builtin_nested_func_ptr_deleted):=20Ditto.=0A=09*=20= config/aarch64/heap-trampoline.c:=20New=20file:=20Implement=20heap-based=0A= =09trampolines=20for=20aarch64.=0A=09*=20= config/aarch64/t-heap-trampoline:=20Add=20rule=20to=20build=0A=09= config/aarch64/heap-trampoline.c=0A=09*=20config/i386/heap-trampoline.c:=20= New=20file:=20Implement=20heap-based=0A=09trampolines=20for=20x86_64.=0A=09= *=20config/i386/t-heap-trampoline:=20Add=20rule=20to=20build=0A=09= config/i386/heap-trampoline.cc=0A=09*=20config.host:=20Handle=20= --enable-heap-trampolines=20on=0A=09x86_64-*-linux*,=20aarch64-*-linux*,=20= aarch64*-*darwin*.=0A=09*=20configure:=20Regenerate.=0A---=0A=20= gcc/builtins.def=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20|=20=20=202=20+=0A=20gcc/common.opt=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=2017=20++-=0A=20= gcc/config.gcc=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20|=20=2011=20++=0A=20gcc/config.in=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=20=203=20= +-=0A=20gcc/config/i386/darwin.h=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20|=20=20=206=20+=0A=20gcc/config/i386/i386.cc=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20|=20=20=202=20+-=0A=20gcc/config/i386/i386.h=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=20=206=20+=0A=20= gcc/coretypes.h=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20|=20=20=206=20+=0A=20gcc/doc/invoke.texi=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=2017=20++-=0A=20= gcc/tree-nested.cc=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20|=20121=20++++++++++++++---=0A=20gcc/tree.cc=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=20= 17=20+++=0A=20libgcc/config.host=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20|=20=20=209=20++=0A=20= libgcc/config/aarch64/heap-trampoline.c=20|=20172=20= ++++++++++++++++++++++++=0A=20libgcc/config/aarch64/t-heap-trampoline=20= |=20=2019=20+++=0A=20libgcc/config/i386/heap-trampoline.c=20=20=20=20|=20= 172=20++++++++++++++++++++++++=0A=20libgcc/config/i386/t-heap-trampoline=20= =20=20=20|=20=2019=20+++=0A=20libgcc/configure=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=2038=20++++++=0A=20= libgcc/configure.ac=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20|=20=2029=20++++=0A=20libgcc/libgcc-std.ver.in=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20|=20=20=203=20+=0A=20libgcc/libgcc2.h=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=20= =203=20+=0A=2020=20files=20changed,=20651=20insertions(+),=2021=20= deletions(-)=0A=20create=20mode=20100644=20= libgcc/config/aarch64/heap-trampoline.c=0A=20create=20mode=20100644=20= libgcc/config/aarch64/t-heap-trampoline=0A=20create=20mode=20100644=20= libgcc/config/i386/heap-trampoline.c=0A=20create=20mode=20100644=20= libgcc/config/i386/t-heap-trampoline=0A=0Adiff=20--git=20= a/gcc/builtins.def=20b/gcc/builtins.def=0Aindex=20= 76e7200e772..918389d863d=20100644=0A---=20a/gcc/builtins.def=0A+++=20= b/gcc/builtins.def=0A@@=20-1073,6=20+1073,8=20@@=20DEF_BUILTIN_STUB=20= (BUILT_IN_ADJUST_TRAMPOLINE,=20"__builtin_adjust_trampoline")=0A=20= DEF_BUILTIN_STUB=20(BUILT_IN_INIT_DESCRIPTOR,=20= "__builtin_init_descriptor")=0A=20DEF_BUILTIN_STUB=20= (BUILT_IN_ADJUST_DESCRIPTOR,=20"__builtin_adjust_descriptor")=0A=20= DEF_BUILTIN_STUB=20(BUILT_IN_NONLOCAL_GOTO,=20"__builtin_nonlocal_goto")=0A= +DEF_BUILTIN_STUB=20(BUILT_IN_NESTED_PTR_CREATED,=20= "__builtin_nested_func_ptr_created")=0A+DEF_BUILTIN_STUB=20= (BUILT_IN_NESTED_PTR_DELETED,=20"__builtin_nested_func_ptr_deleted")=0A=20= =0A=20/*=20Implementing=20__builtin_setjmp.=20=20*/=0A=20= DEF_BUILTIN_STUB=20(BUILT_IN_SETJMP_SETUP,=20"__builtin_setjmp_setup")=0A= diff=20--git=20a/gcc/common.opt=20b/gcc/common.opt=0Aindex=20= 25f650e2dae..4511930fe58=20100644=0A---=20a/gcc/common.opt=0A+++=20= b/gcc/common.opt=0A@@=20-2884,10=20+2884,25=20@@=20Common=20= Var(flag_tracer)=20Optimization=0A=20Perform=20superblock=20formation=20= via=20tail=20duplication.=0A=20=0A=20ftrampolines=0A-Common=20= Var(flag_trampolines)=20Init(0)=0A+Common=20Var(flag_trampolines)=20= Init(HEAP_TRAMPOLINES_INIT)=0A=20For=20targets=20that=20normally=20need=20= trampolines=20for=20nested=20functions,=20always=0A=20generate=20them=20= instead=20of=20using=20descriptors.=0A=20=0A+ftrampoline-impl=3D=0A= +Common=20Joined=20RejectNegative=20Enum(trampoline_impl)=20= Var(flag_trampoline_impl)=20Init(HEAP_TRAMPOLINES_INIT=20?=20= TRAMPOLINE_IMPL_HEAP=20:=20TRAMPOLINE_IMPL_STACK)=0A+Whether=20= trampolines=20are=20generated=20in=20executable=20memory=20rather=20than=0A= +executable=20stack.=0A+=0A+Enum=0A+Name(trampoline_impl)=20Type(enum=20= trampoline_impl)=20UnknownError(unknown=20trampoline=20implementation=20= %qs)=0A+=0A+EnumValue=0A+Enum(trampoline_impl)=20String(stack)=20= Value(TRAMPOLINE_IMPL_STACK)=0A+=0A+EnumValue=0A+Enum(trampoline_impl)=20= String(heap)=20Value(TRAMPOLINE_IMPL_HEAP)=0A+=0A+=0A=20;=20Zero=20means=20= that=20floating-point=20math=20operations=20cannot=20generate=20a=0A=20;=20= (user-visible)=20trap.=20=20This=20is=20the=20case,=20for=20example,=20= in=20nonstop=0A=20;=20IEEE=20754=20arithmetic.=0Adiff=20--git=20= a/gcc/config.gcc=20b/gcc/config.gcc=0Aindex=201446eb2b3ca..a94d86f85e7=20= 100644=0A---=20a/gcc/config.gcc=0A+++=20b/gcc/config.gcc=0A@@=20-1125,6=20= +1125,17=20@@=20case=20${target}=20in=0A=20=20=20;;=0A=20esac=0A=20=0A+#=20= Figure=20out=20if=20we=20need=20to=20enable=20-fheap-trampolines=20by=20= default=0A+case=20${target}=20in=0A+*-*-darwin2*)=0A+=20=20#=20= Currently,=20we=20do=20this=20for=20macOS=2011=20and=20above.=0A+=20=20= tm_defines=3D"$tm_defines=20HEAP_TRAMPOLINES_INIT=3D1"=0A+=20=20;;=0A+*)=0A= +=20=20tm_defines=3D"$tm_defines=20HEAP_TRAMPOLINES_INIT=3D0"=0A+=20=20= ;;=0A+esac=0A+=0A=20case=20${target}=20in=0A=20aarch64*-*-elf=20|=20= aarch64*-*-fuchsia*=20|=20aarch64*-*-rtems*)=0A=20=09tm_file=3D"${tm_file}= =20elfos.h=20newlib-stdint.h"=0Adiff=20--git=20a/gcc/config.in=20= b/gcc/config.in=0Aindex=200e62b9fbfc9..4cad077bfbe=20100644=0A---=20= a/gcc/config.in=0A+++=20b/gcc/config.in=0A@@=20-2239,7=20+2239,8=20@@=0A=20= #endif=0A=20=0A=20=0A-/*=20Define=20to=20the=20sub-directory=20where=20= libtool=20stores=20uninstalled=20libraries.=20*/=0A+/*=20Define=20to=20= the=20sub-directory=20in=20which=20libtool=20stores=20uninstalled=20= libraries.=0A+=20=20=20*/=0A=20#ifndef=20USED_FOR_TARGET=0A=20#undef=20= LT_OBJDIR=0A=20#endif=0Adiff=20--git=20a/gcc/config/i386/darwin.h=20= b/gcc/config/i386/darwin.h=0Aindex=20588bd669bdd..036eefbbb95=20100644=0A= ---=20a/gcc/config/i386/darwin.h=0A+++=20b/gcc/config/i386/darwin.h=0A@@=20= -308,3=20+308,9=20@@=20along=20with=20GCC;=20see=20the=20file=20= COPYING3.=20=20If=20not=20see=0A=20#define=20CLEAR_INSN_CACHE(beg,=20= end)=09=09=09=09\=0A=20=20=20extern=20void=20sys_icache_invalidate(void=20= *start,=20size_t=20len);=09\=0A=20=20=20sys_icache_invalidate=20((beg),=20= (size_t)((end)-(beg)))=0A+=0A+/*=20Disable=20custom=20function=20= descriptors=20for=20Darwin=20when=20we=20have=20off-stack=0A+=20=20=20= trampolines.=20=20*/=0A+#undef=20X86_CUSTOM_FUNCTION_TEST=0A+#define=20= X86_CUSTOM_FUNCTION_TEST=20\=0A+=20=20(flag_trampolines=20&&=20= flag_trampoline_impl=20=3D=3D=20TRAMPOLINE_IMPL_HEAP)=20?=200=20:=201=0A= diff=20--git=20a/gcc/config/i386/i386.cc=20b/gcc/config/i386/i386.cc=0A= index=20f0d6167e667..ec80c71200c=20100644=0A---=20= a/gcc/config/i386/i386.cc=0A+++=20b/gcc/config/i386/i386.cc=0A@@=20= -25565,7=20+25565,7=20@@=20ix86_libgcc_floating_mode_supported_p=0A=20= #define=20TARGET_HARD_REGNO_SCRATCH_OK=20ix86_hard_regno_scratch_ok=0A=20= =0A=20#undef=20TARGET_CUSTOM_FUNCTION_DESCRIPTORS=0A-#define=20= TARGET_CUSTOM_FUNCTION_DESCRIPTORS=201=0A+#define=20= TARGET_CUSTOM_FUNCTION_DESCRIPTORS=20X86_CUSTOM_FUNCTION_TEST=0A=20=0A=20= #undef=20TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID=0A=20#define=20= TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID=20= ix86_addr_space_zero_address_valid=0Adiff=20--git=20= a/gcc/config/i386/i386.h=20b/gcc/config/i386/i386.h=0Aindex=20= aea3209d5a3..19b535edf05=20100644=0A---=20a/gcc/config/i386/i386.h=0A+++=20= b/gcc/config/i386/i386.h=0A@@=20-755,6=20+755,12=20@@=20extern=20const=20= char=20*host_detect_local_cpu=20(int=20argc,=20const=20char=20**argv);=0A= =20/*=20Minimum=20allocation=20boundary=20for=20the=20code=20of=20a=20= function.=20=20*/=0A=20#define=20FUNCTION_BOUNDARY=208=0A=20=0A+/*=20We=20= will=20and=20with=20this=20value=20to=20test=20if=20a=20custom=20= function=20descriptor=20needs=0A+=20=20=20a=20static=20chain.=20=20The=20= function=20boundary=20must=20the=20adjusted=20so=20that=20the=20bit=0A+=20= =20=20this=20represents=20is=20no=20longer=20part=20of=20the=20address.=20= =200=20Disables=20the=20custom=0A+=20=20=20function=20descriptors.=20=20= */=0A+#define=20X86_CUSTOM_FUNCTION_TEST=201=0A+=0A=20/*=20C++=20stores=20= the=20virtual=20bit=20in=20the=20lowest=20bit=20of=20function=20= pointers.=20=20*/=0A=20#define=20TARGET_PTRMEMFUNC_VBIT_LOCATION=20= ptrmemfunc_vbit_in_pfn=0A=20=0Adiff=20--git=20a/gcc/coretypes.h=20= b/gcc/coretypes.h=0Aindex=20ca8837cef67..7e022a427c4=20100644=0A---=20= a/gcc/coretypes.h=0A+++=20b/gcc/coretypes.h=0A@@=20-199,6=20+199,12=20@@=20= enum=20tls_model=20{=0A=20=20=20TLS_MODEL_LOCAL_EXEC=0A=20};=0A=20=0A+/*=20= Types=20of=20trampoline=20implementation.=20=20*/=0A+enum=20= trampoline_impl=20{=0A+=20=20TRAMPOLINE_IMPL_STACK,=0A+=20=20= TRAMPOLINE_IMPL_HEAP=0A+};=0A+=0A=20/*=20Types=20of=20ABI=20for=20an=20= offload=20compiler.=20=20*/=0A=20enum=20offload_abi=20{=0A=20=20=20= OFFLOAD_ABI_UNSET,=0Adiff=20--git=20a/gcc/doc/invoke.texi=20= b/gcc/doc/invoke.texi=0Aindex=20cbc1282c274..6cb3b24221b=20100644=0A---=20= a/gcc/doc/invoke.texi=0A+++=20b/gcc/doc/invoke.texi=0A@@=20-710,7=20= +710,8=20@@=20Objective-C=20and=20Objective-C++=20Dialects}.=0A=20= -fverbose-asm=20=20-fpack-struct[=3D@var{n}]=0A=20-fleading-underscore=20= =20-ftls-model=3D@var{model}=0A=20-fstack-reuse=3D@var{reuse_level}=0A= --ftrampolines=20=20-ftrapv=20=20-fwrapv=0A+-ftrampolines=20= -ftrampoline-impl=3D@r{[}stack@r{|}heap@r{]}=0A+-ftrapv=20=20-fwrapv=0A=20= -fvisibility=3D@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}=0A= =20-fstrict-volatile-bitfields=20=20-fsync-libcalls}=0A=20=0A@@=20= -18801,6=20+18802,20=20@@=20For=20languages=20other=20than=20Ada,=20the=20= @code{-ftrampolines}=20and=0A=20trampolines=20are=20always=20generated=20= on=20platforms=20that=20need=20them=0A=20for=20nested=20functions.=0A=20=0A= +@opindex=20ftrampoline-impl=0A+@item=20= -ftrampoline-impl=3D@r{[}stack@r{|}heap@r{]}=0A+By=20default,=20= trampolines=20are=20generated=20on=20stack.=20However,=20certain=20= platforms=0A+(such=20as=20the=20Apple=20M1)=20do=20not=20permit=20an=20= executable=20stack.=20=20Compiling=20with=0A= +@option{-ftrampoline-impl=3Dheap}=20generate=20calls=20to=20= @code{__builtin_nested_func_ptr_created}=0A+and=20= @code{__builtin_nested_func_ptr_deleted}=20in=20order=20to=20allocate=20= and=0A+deallocate=20trampoline=20space=20on=20the=20executable=20heap.=20= Please=20note=20that=0A+these=20functions=20are=20implemented=20in=20= libgcc,=20and=20will=20not=20be=20compiled=20in=0A+unless=20you=20= provide=20@option{--enable-heap-trampolines}=20when=0A+building=20gcc.=20= =20@emph{PLEASE=20NOTE}:=20Heap=20trampolines=20are=20@emph{not}=0A= +guaranteed=20to=20be=20correctly=20deallocated=20if=20you=20= @code{setjmp},=0A+instantiate=20nested=20functions,=20and=20then=20= @code{longjmp}=20back=20to=20a=20state=0A+prior=20to=20having=20= allocated=20those=20nested=20functions.=0A+=0A=20@opindex=20fvisibility=0A= =20@item=20= -fvisibility=3D@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}=0A= =20Set=20the=20default=20ELF=20image=20symbol=20visibility=20to=20the=20= specified=20option---all=0Adiff=20--git=20a/gcc/tree-nested.cc=20= b/gcc/tree-nested.cc=0Aindex=20ae7d1f1f6a8..84ee9962485=20100644=0A---=20= a/gcc/tree-nested.cc=0A+++=20b/gcc/tree-nested.cc=0A@@=20-611,6=20= +611,14=20@@=20get_trampoline_type=20(struct=20nesting_info=20*info)=0A=20= =20=20if=20(trampoline_type)=0A=20=20=20=20=20return=20trampoline_type;=0A= =20=0A+=20=20/*=20When=20trampolines=20are=20created=20off-stack=20then=20= the=20only=20thing=20we=20need=20in=20the=0A+=20=20=20=20=20local=20= frame=20is=20a=20single=20pointer.=20=20*/=0A+=20=20if=20= (flag_trampoline_impl=20=3D=3D=20TRAMPOLINE_IMPL_HEAP)=0A+=20=20=20=20{=0A= +=20=20=20=20=20=20trampoline_type=20=3D=20build_pointer_type=20= (void_type_node);=0A+=20=20=20=20=20=20return=20trampoline_type;=0A+=20=20= =20=20}=0A+=0A=20=20=20align=20=3D=20TRAMPOLINE_ALIGNMENT;=0A=20=20=20= size=20=3D=20TRAMPOLINE_SIZE;=0A=20=0A@@=20-2788,17=20+2796,27=20@@=20= convert_tramp_reference_op=20(tree=20*tp,=20int=20*walk_subtrees,=20void=20= *data)=0A=20=0A=20=20=20=20=20=20=20/*=20Compute=20the=20address=20of=20= the=20field=20holding=20the=20trampoline.=20=20*/=0A=20=20=20=20=20=20=20= x=20=3D=20get_frame_field=20(info,=20target_context,=20x,=20&wi->gsi);=0A= -=20=20=20=20=20=20x=20=3D=20build_addr=20(x);=0A-=20=20=20=20=20=20x=20= =3D=20gsi_gimplify_val=20(info,=20x,=20&wi->gsi);=0A=20=0A-=20=20=20=20=20= =20/*=20Do=20machine-specific=20ugliness.=20=20Normally=20this=20will=20= involve=0A-=09=20computing=20extra=20alignment,=20but=20it=20can=20= really=20be=20anything.=20=20*/=0A-=20=20=20=20=20=20if=20(descr)=0A-=09= builtin=20=3D=20builtin_decl_implicit=20(BUILT_IN_ADJUST_DESCRIPTOR);=0A= +=20=20=20=20=20=20/*=20APB:=20We=20don't=20need=20to=20do=20the=20= adjustment=20calls=20when=20using=20off-stack=0A+=09=20trampolines,=20= any=20such=20adjustment=20will=20be=20done=20when=20the=20off-stack=0A+=09= =20trampoline=20is=20created.=20=20*/=0A+=20=20=20=20=20=20if=20(!descr=20= &&=20flag_trampoline_impl=20=3D=3D=20TRAMPOLINE_IMPL_HEAP)=0A+=09x=20=3D=20= gsi_gimplify_val=20(info,=20x,=20&wi->gsi);=0A=20=20=20=20=20=20=20else=0A= -=09builtin=20=3D=20builtin_decl_implicit=20= (BUILT_IN_ADJUST_TRAMPOLINE);=0A-=20=20=20=20=20=20call=20=3D=20= gimple_build_call=20(builtin,=201,=20x);=0A-=20=20=20=20=20=20x=20=3D=20= init_tmp_var_with_call=20(info,=20&wi->gsi,=20call);=0A+=09{=0A+=09=20=20= x=20=3D=20build_addr=20(x);=0A+=0A+=09=20=20x=20=3D=20gsi_gimplify_val=20= (info,=20x,=20&wi->gsi);=0A+=0A+=09=20=20/*=20Do=20machine-specific=20= ugliness.=20=20Normally=20this=20will=20involve=0A+=09=20=20=20=20=20= computing=20extra=20alignment,=20but=20it=20can=20really=20be=20= anything.=20=20*/=0A+=09=20=20if=20(descr)=0A+=09=20=20=20=20builtin=20=3D= =20builtin_decl_implicit=20(BUILT_IN_ADJUST_DESCRIPTOR);=0A+=09=20=20= else=0A+=09=20=20=20=20builtin=20=3D=20builtin_decl_implicit=20= (BUILT_IN_ADJUST_TRAMPOLINE);=0A+=09=20=20call=20=3D=20gimple_build_call=20= (builtin,=201,=20x);=0A+=09=20=20x=20=3D=20init_tmp_var_with_call=20= (info,=20&wi->gsi,=20call);=0A+=09}=0A=20=0A=20=20=20=20=20=20=20/*=20= Cast=20back=20to=20the=20proper=20function=20type.=20=20*/=0A=20=20=20=20= =20=20=20x=20=3D=20build1=20(NOP_EXPR,=20TREE_TYPE=20(t),=20x);=0A@@=20= -3377,6=20+3395,7=20@@=20build_init_call_stmt=20(struct=20nesting_info=20= *info,=20tree=20decl,=20tree=20field,=0A=20static=20void=0A=20= finalize_nesting_tree_1=20(struct=20nesting_info=20*root)=0A=20{=0A+=20=20= gimple_seq=20cleanup_list=20=3D=20NULL;=0A=20=20=20gimple_seq=20= stmt_list=20=3D=20NULL;=0A=20=20=20gimple=20*stmt;=0A=20=20=20tree=20= context=20=3D=20root->context;=0A@@=20-3508,9=20+3527,48=20@@=20= finalize_nesting_tree_1=20(struct=20nesting_info=20*root)=0A=20=09=20=20= if=20(!field)=0A=20=09=20=20=20=20continue;=0A=20=0A-=09=20=20x=20=3D=20= builtin_decl_implicit=20(BUILT_IN_INIT_TRAMPOLINE);=0A-=09=20=20stmt=20=3D= =20build_init_call_stmt=20(root,=20i->context,=20field,=20x);=0A-=09=20=20= gimple_seq_add_stmt=20(&stmt_list,=20stmt);=0A+=09=20=20if=20= (flag_trampoline_impl=20=3D=3D=20TRAMPOLINE_IMPL_HEAP)=0A+=09=20=20=20=20= {=0A+=09=20=20=20=20=20=20/*=20We=20pass=20a=20whole=20bunch=20of=20= arguments=20to=20the=20builtin=20function=20that=0A+=09=09=20creates=20= the=20off-stack=20trampoline,=20these=20are=0A+=09=09=201.=20The=20= nested=20function=20chain=20value=20(that=20must=20be=20passed=20to=20= the=0A+=09=09=20nested=20function=20so=20it=20can=20find=20the=20= function=20arguments).=0A+=09=09=202.=20A=20pointer=20to=20the=20nested=20= function=20implementation,=0A+=09=09=203.=20The=20address=20in=20the=20= local=20stack=20frame=20where=20we=20should=20write=0A+=09=09=20the=20= address=20of=20the=20trampoline.=0A+=0A+=09=09=20When=20this=20code=20= was=20originally=20written=20I=20just=20kind=20of=20threw=0A+=09=09=20= everything=20at=20the=20builtin,=20figuring=20I'd=20work=20out=20what=20= was=0A+=09=09=20actually=20needed=20later,=20I=20think,=20the=20stack=20= pointer=20could=0A+=09=09=20certainly=20be=20dropped,=20arguments=20#2=20= and=20#4=20are=20based=20off=20the=0A+=09=09=20stack=20pointer=20anyway,=20= so=20#1=20doesn't=20seem=20to=20add=20much=20value.=20=20*/=0A+=09=20=20=20= =20=20=20tree=20arg1,=20arg2,=20arg3;=0A+=0A+=09=20=20=20=20=20=20= gcc_assert=20(DECL_STATIC_CHAIN=20(i->context));=0A+=09=20=20=20=20=20=20= arg1=20=3D=20build_addr=20(root->frame_decl);=0A+=09=20=20=20=20=20=20= arg2=20=3D=20build_addr=20(i->context);=0A+=0A+=09=20=20=20=20=20=20x=20= =3D=20build3=20(COMPONENT_REF,=20TREE_TYPE=20(field),=0A+=09=09=09=20=20= root->frame_decl,=20field,=20NULL_TREE);=0A+=09=20=20=20=20=20=20arg3=20= =3D=20build_addr=20(x);=0A+=0A+=09=20=20=20=20=20=20x=20=3D=20= builtin_decl_implicit=20(BUILT_IN_NESTED_PTR_CREATED);=0A+=09=20=20=20=20= =20=20stmt=20=3D=20gimple_build_call=20(x,=203,=20arg1,=20arg2,=20arg3);=0A= +=09=20=20=20=20=20=20gimple_seq_add_stmt=20(&stmt_list,=20stmt);=0A+=0A= +=09=20=20=20=20=20=20/*=20This=20call=20to=20delete=20the=20nested=20= function=20trampoline=20is=20added=20to=0A+=09=09=20the=20cleanup=20= list,=20and=20called=20when=20we=20exit=20the=20current=20scope.=20=20*/=0A= +=09=20=20=20=20=20=20x=20=3D=20builtin_decl_implicit=20= (BUILT_IN_NESTED_PTR_DELETED);=0A+=09=20=20=20=20=20=20stmt=20=3D=20= gimple_build_call=20(x,=200);=0A+=09=20=20=20=20=20=20= gimple_seq_add_stmt=20(&cleanup_list,=20stmt);=0A+=09=20=20=20=20}=0A+=09= =20=20else=0A+=09=20=20=20=20{=0A+=09=20=20=20=20=20=20/*=20Original=20= code=20to=20initialise=20the=20on=20stack=20trampoline.=20=20*/=0A+=09=20= =20=20=20=20=20x=20=3D=20builtin_decl_implicit=20= (BUILT_IN_INIT_TRAMPOLINE);=0A+=09=20=20=20=20=20=20stmt=20=3D=20= build_init_call_stmt=20(root,=20i->context,=20field,=20x);=0A+=09=20=20=20= =20=20=20gimple_seq_add_stmt=20(&stmt_list,=20stmt);=0A+=09=20=20=20=20}=0A= =20=09}=0A=20=20=20=20=20}=0A=20=0A@@=20-3535,11=20+3593,40=20@@=20= finalize_nesting_tree_1=20(struct=20nesting_info=20*root)=0A=20=20=20/*=20= If=20we=20created=20initialization=20statements,=20insert=20them.=20=20= */=0A=20=20=20if=20(stmt_list)=0A=20=20=20=20=20{=0A-=20=20=20=20=20=20= gbind=20*bind;=0A-=20=20=20=20=20=20annotate_all_with_location=20= (stmt_list,=20DECL_SOURCE_LOCATION=20(context));=0A-=20=20=20=20=20=20= bind=20=3D=20gimple_seq_first_stmt_as_a_bind=20(gimple_body=20= (context));=0A-=20=20=20=20=20=20gimple_seq_add_seq=20(&stmt_list,=20= gimple_bind_body=20(bind));=0A-=20=20=20=20=20=20gimple_bind_set_body=20= (bind,=20stmt_list);=0A+=20=20=20=20=20=20if=20(flag_trampoline_impl=20= =3D=3D=20TRAMPOLINE_IMPL_HEAP)=0A+=09{=0A+=09=20=20/*=20Handle=20= off-stack=20trampolines.=20=20*/=0A+=09=20=20gbind=20*bind;=0A+=09=20=20= annotate_all_with_location=20(stmt_list,=20DECL_SOURCE_LOCATION=20= (context));=0A+=09=20=20annotate_all_with_location=20(cleanup_list,=20= DECL_SOURCE_LOCATION=20(context));=0A+=09=20=20bind=20=3D=20= gimple_seq_first_stmt_as_a_bind=20(gimple_body=20(context));=0A+=09=20=20= gimple_seq_add_seq=20(&stmt_list,=20gimple_bind_body=20(bind));=0A+=0A+=09= =20=20gimple_seq=20xxx_list=20=3D=20NULL;=0A+=0A+=09=20=20if=20= (cleanup_list=20!=3D=20NULL)=0A+=09=20=20=20=20{=0A+=09=20=20=20=20=20=20= /*=20Maybe=20we=20shouldn't=20be=20creating=20this=20try/finally=20if=20= -fno-exceptions=20is=0A+=09=09=20in=20use.=20=20If=20this=20is=20the=20= case,=20then=20maybe=20we=20should,=20instead,=20be=0A+=09=09=20= inserting=20the=20cleanup=20code=20onto=20every=20path=20out=20of=20this=20= function?=20=20Not=0A+=09=09=20yet=20figured=20out=20how=20we=20would=20= do=20this.=20=20*/=0A+=09=20=20=20=20=20=20gtry=20*t=20=3D=20= gimple_build_try=20(stmt_list,=20cleanup_list,=20GIMPLE_TRY_FINALLY);=0A= +=09=20=20=20=20=20=20gimple_seq_add_stmt=20(&xxx_list,=20t);=0A+=09=20=20= =20=20}=0A+=09=20=20else=0A+=09=20=20=20=20xxx_list=20=3D=20stmt_list;=0A= +=0A+=09=20=20gimple_bind_set_body=20(bind,=20xxx_list);=0A+=09}=0A+=20=20= =20=20=20=20else=0A+=09{=0A+=09=20=20/*=20The=20traditional,=20on=20= stack=20trampolines.=20=20*/=0A+=09=20=20gbind=20*bind;=0A+=09=20=20= annotate_all_with_location=20(stmt_list,=20DECL_SOURCE_LOCATION=20= (context));=0A+=09=20=20bind=20=3D=20gimple_seq_first_stmt_as_a_bind=20= (gimple_body=20(context));=0A+=09=20=20gimple_seq_add_seq=20(&stmt_list,=20= gimple_bind_body=20(bind));=0A+=09=20=20gimple_bind_set_body=20(bind,=20= stmt_list);=0A+=09}=0A=20=20=20=20=20}=0A=20=0A=20=20=20/*=20If=20a=20= chain_decl=20was=20created,=20then=20it=20needs=20to=20be=20registered=20= with=0Adiff=20--git=20a/gcc/tree.cc=20b/gcc/tree.cc=0Aindex=20= 420857b110c..3e7beba8744=20100644=0A---=20a/gcc/tree.cc=0A+++=20= b/gcc/tree.cc=0A@@=20-9870,6=20+9870,23=20@@=20= build_common_builtin_nodes=20(void)=0A=20=09=09=09= "__builtin_nonlocal_goto",=0A=20=09=09=09ECF_NORETURN=20|=20= ECF_NOTHROW);=0A=20=0A+=20=20tree=20ptr_ptr_type_node=20=3D=20= build_pointer_type=20(ptr_type_node);=0A+=0A+=20=20ftype=20=3D=20= build_function_type_list=20(void_type_node,=0A+=09=09=09=09=20=20=20=20= ptr_type_node,=20//=20void=20*chain=0A+=09=09=09=09=20=20=20=20= ptr_type_node,=20//=20void=20*func=0A+=09=09=09=09=20=20=20=20= ptr_ptr_type_node,=20//=20void=20**dst=0A+=09=09=09=09=20=20=20=20= NULL_TREE);=0A+=20=20local_define_builtin=20= ("__builtin_nested_func_ptr_created",=20ftype,=0A+=09=09=09= BUILT_IN_NESTED_PTR_CREATED,=0A+=09=09=09= "__builtin_nested_func_ptr_created",=20ECF_NOTHROW);=0A+=0A+=20=20ftype=20= =3D=20build_function_type_list=20(void_type_node,=0A+=09=09=09=09=20=20=20= =20NULL_TREE);=0A+=20=20local_define_builtin=20= ("__builtin_nested_func_ptr_deleted",=20ftype,=0A+=09=09=09= BUILT_IN_NESTED_PTR_DELETED,=0A+=09=09=09= "__builtin_nested_func_ptr_deleted",=20ECF_NOTHROW);=0A+=0A=20=20=20= ftype=20=3D=20build_function_type_list=20(void_type_node,=0A=20=09=09=09=09= =20=20=20=20ptr_type_node,=20ptr_type_node,=20NULL_TREE);=0A=20=20=20= local_define_builtin=20("__builtin_setjmp_setup",=20ftype,=0Adiff=20= --git=20a/libgcc/config.host=20b/libgcc/config.host=0Aindex=20= 9d7212028d0..e3e311b75a4=20100644=0A---=20a/libgcc/config.host=0A+++=20= b/libgcc/config.host=0A@@=20-423,6=20+423,9=20@@=20aarch64*-*-linux*)=0A=20= =09tmake_file=3D"${tmake_file}=20${cpu_type}/t-lse=20t-slibgcc-libgcc"=0A= =20=09tmake_file=3D"${tmake_file}=20${cpu_type}/t-softfp=20t-softfp=20= t-crtfm"=0A=20=09tmake_file=3D"${tmake_file}=20t-dfprules"=0A+=09if=20= test=20x$heap_trampolines=20=3D=20xyes;=20then=0A+=09=20=20=20=20= tmake_file=3D"${tmake_file}=20${cpu_type}/t-heap-trampoline"=0A+=09fi=0A=20= =09;;=0A=20aarch64*-*-vxworks7*)=0A=20=09extra_parts=3D"$extra_parts=20= crtfastmath.o"=0A@@=20-697,6=20+700,9=20@@=20x86_64-*-darwin*)=0A=20=09= tmake_file=3D"$tmake_file=20i386/t-crtpc=20t-crtfm=20i386/t-msabi"=0A=20=09= tm_file=3D"$tm_file=20i386/darwin-lib.h"=0A=20=09= extra_parts=3D"$extra_parts=20crtprec32.o=20crtprec64.o=20crtprec80.o=20= crtfastmath.o"=0A+=09if=20test=20x$heap_trampolines=20=3D=20xyes;=20then=0A= +=09=20=20=20=20tmake_file=3D"${tmake_file}=20i386/t-heap-trampoline"=0A= +=09fi=0A=20=09;;=0A=20i[34567]86-*-elfiamcu)=0A=20=09= tmake_file=3D"$tmake_file=20i386/t-crtstuff=20t-softfp-sfdftf=20= i386/32/t-softfp=20i386/32/t-iamcu=20i386/t-softfp=20t-softfp=20= t-dfprules"=0A@@=20-763,6=20+769,9=20@@=20x86_64-*-linux*)=0A=20=09= tmake_file=3D"${tmake_file}=20i386/t-crtpc=20t-crtfm=20i386/t-crtstuff=20= t-dfprules"=0A=20=09tm_file=3D"${tm_file}=20i386/elf-lib.h"=0A=20=09= md_unwind_header=3Di386/linux-unwind.h=0A+=09if=20test=20= x$heap_trampolines=20=3D=20xyes;=20then=0A+=09=20=20=20=20= tmake_file=3D"${tmake_file}=20i386/t-heap-trampoline"=0A+=09fi=0A=20=09= ;;=0A=20x86_64-*-kfreebsd*-gnu)=0A=20=09extra_parts=3D"$extra_parts=20= crtprec32.o=20crtprec64.o=20crtprec80.o=20crtfastmath.o"=0Adiff=20--git=20= a/libgcc/config/aarch64/heap-trampoline.c=20= b/libgcc/config/aarch64/heap-trampoline.c=0Anew=20file=20mode=20100644=0A= index=2000000000000..c8b83681ed7=0A---=20/dev/null=0A+++=20= b/libgcc/config/aarch64/heap-trampoline.c=0A@@=20-0,0=20+1,172=20@@=0A= +/*=20Copyright=20The=20GNU=20Toolchain=20Authors.=20*/=0A+=0A+#include=20= =0A+#include=20=0A+#include=20=0A= +#include=20=0A+#include=20=0A+#include=20=0A= +=0A+#if=20__APPLE__=0A+/*=20For=20pthread_jit_write_protect_np=20*/=0A= +#include=20=0A+#endif=0A+=0A+void=20= *allocate_trampoline_page=20(void);=0A+int=20get_trampolines_per_page=20= (void);=0A+struct=20tramp_ctrl_data=20*allocate_tramp_ctrl=20(struct=20= tramp_ctrl_data=20*parent);=0A+void=20*allocate_trampoline_page=20= (void);=0A+=0A+void=20__builtin_nested_func_ptr_created=20(void=20= *chain,=20void=20*func,=20void=20**dst);=0A+void=20= __builtin_nested_func_ptr_deleted=20(void);=0A+=0A+#if=20= defined(__gnu_linux__)=0A+static=20const=20uint32_t=20= aarch64_trampoline_insns[]=20=3D=20{=0A+=20=200xd503245f,=20/*=20hint=20=20= =20=2034=20*/=0A+=20=200x580000b1,=20/*=20ldr=20=20=20=20=20x17,=20.+20=20= */=0A+=20=200x580000d2,=20/*=20ldr=20=20=20=20=20x18,=20.+24=20*/=0A+=20=20= 0xd61f0220,=20/*=20br=20=20=20=20=20=20x17=20*/=0A+=20=200xd5033f9f,=20= /*=20dsb=20=20=20=20=20sy=20*/=0A+=20=200xd5033fdf=20/*=20isb=20*/=0A+};=0A= +=0A+#elif=20__APPLE__=0A+static=20const=20uint32_t=20= aarch64_trampoline_insns[]=20=3D=20{=0A+=20=200xd503245f,=20/*=20hint=20=20= =20=2034=20*/=0A+=20=200x580000b1,=20/*=20ldr=20=20=20=20=20x17,=20.+20=20= */=0A+=20=200x580000d0,=20/*=20ldr=20=20=20=20=20x16,=20.+24=20*/=0A+=20=20= 0xd61f0220,=20/*=20br=20=20=20=20=20=20x17=20*/=0A+=20=200xd5033f9f,=20= /*=20dsb=20=20=20=20=20sy=20*/=0A+=20=200xd5033fdf=20/*=20isb=20*/=0A+};=0A= +=0A+#else=0A+#error=20"Unsupported=20AArch64=20platform=20for=20heap=20= trampolines"=0A+#endif=0A+=0A+struct=20aarch64_trampoline=20{=0A+=20=20= uint32_t=20insns[6];=0A+=20=20void=20*func_ptr;=0A+=20=20void=20= *chain_ptr;=0A+};=0A+=0A+struct=20tramp_ctrl_data=0A+{=0A+=20=20struct=20= tramp_ctrl_data=20*prev;=0A+=0A+=20=20int=20free_trampolines;=0A+=0A+=20=20= /*=20This=20will=20be=20pointing=20to=20an=20executable=20mmap'ed=20= page.=20=20*/=0A+=20=20struct=20aarch64_trampoline=20*trampolines;=0A+};=0A= +=0A+int=0A+get_trampolines_per_page=20(void)=0A+{=0A+=20=20return=20= getpagesize()=20/=20sizeof(struct=20aarch64_trampoline);=0A+}=0A+=0A= +static=20_Thread_local=20struct=20tramp_ctrl_data=20*tramp_ctrl_curr=20= =3D=20NULL;=0A+=0A+void=20*=0A+allocate_trampoline_page=20(void)=0A+{=0A= +=20=20void=20*page;=0A+=0A+#if=20defined(__gnu_linux__)=0A+=20=20page=20= =3D=20mmap=20(0,=20getpagesize=20(),=20PROT_WRITE=20|=20PROT_EXEC,=0A+=09= =20=20=20=20=20=20=20MAP_ANON=20|=20MAP_PRIVATE,=200,=200);=0A+#elif=20= __APPLE__=0A+=20=20page=20=3D=20mmap=20(0,=20getpagesize=20(),=20= PROT_WRITE=20|=20PROT_EXEC,=0A+=09=20=20=20=20=20=20=20MAP_ANON=20|=20= MAP_PRIVATE=20|=20MAP_JIT,=200,=200);=0A+#else=0A+=20=20page=20=3D=20= MAP_FAILED;=0A+#endif=0A+=0A+=20=20return=20page;=0A+}=0A+=0A+struct=20= tramp_ctrl_data=20*=0A+allocate_tramp_ctrl=20(struct=20tramp_ctrl_data=20= *parent)=0A+{=0A+=20=20struct=20tramp_ctrl_data=20*p=20=3D=20malloc=20= (sizeof=20(struct=20tramp_ctrl_data));=0A+=20=20if=20(p=20=3D=3D=20NULL)=0A= +=20=20=20=20return=20NULL;=0A+=0A+=20=20p->trampolines=20=3D=20= allocate_trampoline_page=20();=0A+=0A+=20=20if=20(p->trampolines=20=3D=3D=20= MAP_FAILED)=0A+=20=20=20=20return=20NULL;=0A+=0A+=20=20p->prev=20=3D=20= parent;=0A+=20=20p->free_trampolines=20=3D=20get_trampolines_per_page();=0A= +=0A+=20=20return=20p;=0A+}=0A+=0A+void=0A= +__builtin_nested_func_ptr_created=20(void=20*chain,=20void=20*func,=20= void=20**dst)=0A+{=0A+=20=20if=20(tramp_ctrl_curr=20=3D=3D=20NULL)=0A+=20= =20=20=20{=0A+=20=20=20=20=20=20tramp_ctrl_curr=20=3D=20= allocate_tramp_ctrl=20(NULL);=0A+=20=20=20=20=20=20if=20(tramp_ctrl_curr=20= =3D=3D=20NULL)=0A+=09abort=20();=0A+=20=20=20=20}=0A+=0A+=20=20if=20= (tramp_ctrl_curr->free_trampolines=20=3D=3D=200)=0A+=20=20=20=20{=0A+=20=20= =20=20=20=20void=20*tramp_ctrl=20=3D=20allocate_tramp_ctrl=20= (tramp_ctrl_curr);=0A+=20=20=20=20=20=20if=20(!tramp_ctrl)=0A+=09abort=20= ();=0A+=0A+=20=20=20=20=20=20tramp_ctrl_curr=20=3D=20tramp_ctrl;=0A+=20=20= =20=20}=0A+=0A+=20=20struct=20aarch64_trampoline=20*trampoline=0A+=20=20=20= =20=3D=20&tramp_ctrl_curr->trampolines[get_trampolines_per_page=20()=0A+=09= =09=09=09=20=20=20=20-=20tramp_ctrl_curr->free_trampolines];=0A+=0A+#if=20= __APPLE__=0A+=20=20/*=20Disable=20write=20protection=20for=20the=20= MAP_JIT=20regions=20in=20this=20thread=20(see=0A+=20=20=20=20=20= https://developer.apple.com/documentation/apple-silicon/porting-just-in-ti= me-compilers-to-apple-silicon)=20*/=0A+=20=20= pthread_jit_write_protect_np=20(0);=0A+#endif=0A+=0A+=20=20memcpy=20= (trampoline->insns,=20aarch64_trampoline_insns,=0A+=09=20=20= sizeof(aarch64_trampoline_insns));=0A+=20=20trampoline->func_ptr=20=3D=20= func;=0A+=20=20trampoline->chain_ptr=20=3D=20chain;=0A+=0A+#if=20= __APPLE__=0A+=20=20/*=20Re-enable=20write=20protection.=20=20*/=0A+=20=20= pthread_jit_write_protect_np=20(1);=0A+#endif=0A+=0A+=20=20= tramp_ctrl_curr->free_trampolines=20-=3D=201;=0A+=0A+=20=20= __builtin___clear_cache=20((void=20*)trampoline->insns,=0A+=09=09=09=20=20= =20((void=20*)trampoline->insns=20+=20sizeof(trampoline->insns)));=0A+=0A= +=20=20*dst=20=3D=20&trampoline->insns;=0A+}=0A+=0A+void=0A= +__builtin_nested_func_ptr_deleted=20(void)=0A+{=0A+=20=20if=20= (tramp_ctrl_curr=20=3D=3D=20NULL)=0A+=20=20=20=20abort=20();=0A+=0A+=20=20= tramp_ctrl_curr->free_trampolines=20+=3D=201;=0A+=0A+=20=20if=20= (tramp_ctrl_curr->free_trampolines=20=3D=3D=20get_trampolines_per_page=20= ())=0A+=20=20=20=20{=0A+=20=20=20=20=20=20if=20(tramp_ctrl_curr->prev=20= =3D=3D=20NULL)=0A+=09return;=0A+=0A+=20=20=20=20=20=20munmap=20= (tramp_ctrl_curr->trampolines,=20getpagesize());=0A+=20=20=20=20=20=20= struct=20tramp_ctrl_data=20*prev=20=3D=20tramp_ctrl_curr->prev;=0A+=20=20= =20=20=20=20free=20(tramp_ctrl_curr);=0A+=20=20=20=20=20=20= tramp_ctrl_curr=20=3D=20prev;=0A+=20=20=20=20}=0A+}=0Adiff=20--git=20= a/libgcc/config/aarch64/t-heap-trampoline=20= b/libgcc/config/aarch64/t-heap-trampoline=0Anew=20file=20mode=20100644=0A= index=2000000000000..b22480800b2=0A---=20/dev/null=0A+++=20= b/libgcc/config/aarch64/t-heap-trampoline=0A@@=20-0,0=20+1,19=20@@=0A+#=20= Copyright=20The=20GNU=20Toolchain=20Authors.=0A+=0A+#=20This=20file=20is=20= part=20of=20GCC.=0A+#=0A+#=20GCC=20is=20free=20software;=20you=20can=20= redistribute=20it=20and/or=20modify=20it=0A+#=20under=20the=20terms=20of=20= the=20GNU=20General=20Public=20License=20as=20published=20by=0A+#=20the=20= Free=20Software=20Foundation;=20either=20version=203,=20or=20(at=20your=20= option)=0A+#=20any=20later=20version.=0A+#=0A+#=20GCC=20is=20distributed=20= in=20the=20hope=20that=20it=20will=20be=20useful,=20but=0A+#=20WITHOUT=20= ANY=20WARRANTY;=20without=20even=20the=20implied=20warranty=20of=0A+#=20= MERCHANTABILITY=20or=20FITNESS=20FOR=20A=20PARTICULAR=20PURPOSE.=20=20= See=20the=20GNU=0A+#=20General=20Public=20License=20for=20more=20= details.=0A+#=0A+#=20You=20should=20have=20received=20a=20copy=20of=20= the=20GNU=20General=20Public=20License=0A+#=20along=20with=20GCC;=20see=20= the=20file=20COPYING3.=20=20If=20not=20see=0A+#=20= .=0A+=0A+LIB2ADD=20+=3D=20= $(srcdir)/config/aarch64/heap-trampoline.c=0Adiff=20--git=20= a/libgcc/config/i386/heap-trampoline.c=20= b/libgcc/config/i386/heap-trampoline.c=0Anew=20file=20mode=20100644=0A= index=2000000000000..96e13bf828e=0A---=20/dev/null=0A+++=20= b/libgcc/config/i386/heap-trampoline.c=0A@@=20-0,0=20+1,172=20@@=0A+/*=20= Copyright=20The=20GNU=20Toolchain=20Authors.=20*/=0A+=0A+#include=20= =0A+#include=20=0A+#include=20=0A= +#include=20=0A+#include=20=0A+#include=20=0A= +=0A+#if=20__APPLE__=20&&=20= __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=20>=3D=20101400=0A+/*=20= For=20pthread_jit_write_protect_np=20*/=0A+#include=20=0A= +#endif=0A+=0A+void=20*allocate_trampoline_page=20(void);=0A+int=20= get_trampolines_per_page=20(void);=0A+struct=20tramp_ctrl_data=20= *allocate_tramp_ctrl=20(struct=20tramp_ctrl_data=20*parent);=0A+void=20= *allocate_trampoline_page=20(void);=0A+=0A+void=20= __builtin_nested_func_ptr_created=20(void=20*chain,=20void=20*func,=20= void=20**dst);=0A+void=20__builtin_nested_func_ptr_deleted=20(void);=0A+=0A= +static=20const=20uint8_t=20trampoline_insns[]=20=3D=20{=0A+=20=20/*=20= movabs=20$,%r11=20=20*/=0A+=20=200x49,=200xbb,=0A+=20=200x00,=20= 0x00,=200x00,=200x00,=200x00,=200x00,=200x00,=200x00,=0A+=0A+=20=20/*=20= movabs=20$,%r10=20=20*/=0A+=20=200x49,=200xba,=0A+=20=200x00,=20= 0x00,=200x00,=200x00,=200x00,=200x00,=200x00,=200x00,=0A+=0A+=20=20/*=20= rex.WB=20jmpq=20*%r11=20=20*/=0A+=20=200x41,=200xff,=200xe3=0A+};=0A+=0A= +union=20ix86_trampoline=20{=0A+=20=20uint8_t=20= insns[sizeof(trampoline_insns)];=0A+=0A+=20=20struct=20= __attribute__((packed))=20fields=20{=0A+=20=20=20=20uint8_t=20insn_0[2];=0A= +=20=20=20=20void=20*func_ptr;=0A+=20=20=20=20uint8_t=20insn_1[2];=0A+=20= =20=20=20void=20*chain_ptr;=0A+=20=20=20=20uint8_t=20insn_2[3];=0A+=20=20= }=20fields;=0A+};=0A+=0A+struct=20tramp_ctrl_data=0A+{=0A+=20=20struct=20= tramp_ctrl_data=20*prev;=0A+=0A+=20=20int=20free_trampolines;=0A+=0A+=20=20= /*=20This=20will=20be=20pointing=20to=20an=20executable=20mmap'ed=20= page.=20=20*/=0A+=20=20union=20ix86_trampoline=20*trampolines;=0A+};=0A+=0A= +int=0A+get_trampolines_per_page=20(void)=0A+{=0A+=20=20return=20= getpagesize()=20/=20sizeof(union=20ix86_trampoline);=0A+}=0A+=0A+static=20= _Thread_local=20struct=20tramp_ctrl_data=20*tramp_ctrl_curr=20=3D=20= NULL;=0A+=0A+void=20*=0A+allocate_trampoline_page=20(void)=0A+{=0A+=20=20= void=20*page;=0A+=0A+#if=20defined(__gnu_linux__)=0A+=20=20page=20=3D=20= mmap=20(0,=20getpagesize=20(),=20PROT_WRITE=20|=20PROT_EXEC,=0A+=09=20=20= =20=20=20=20=20MAP_ANON=20|=20MAP_PRIVATE,=200,=200);=0A+#elif=20= __APPLE__=0A+#=20if=20=20__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=20= >=3D=20101400=0A+=20=20page=20=3D=20mmap=20(0,=20getpagesize=20(),=20= PROT_WRITE=20|=20PROT_EXEC,=0A+=09=20=20=20=20=20=20=20MAP_ANON=20|=20= MAP_PRIVATE=20|=20MAP_JIT,=200,=200);=0A+#=20else=0A+=20=20page=20=3D=20= mmap=20(0,=20getpagesize=20(),=20PROT_WRITE=20|=20PROT_EXEC,=0A+=09=20=20= =20=20=20=20=20MAP_ANON=20|=20MAP_PRIVATE,=200,=200);=0A+#=20endif=0A= +#else=0A+=20=20page=20=3D=20MAP_FAILED;=0A+#endif=0A+=0A+=20=20return=20= page;=0A+}=0A+=0A+struct=20tramp_ctrl_data=20*=0A+allocate_tramp_ctrl=20= (struct=20tramp_ctrl_data=20*parent)=0A+{=0A+=20=20struct=20= tramp_ctrl_data=20*p=20=3D=20malloc=20(sizeof=20(struct=20= tramp_ctrl_data));=0A+=20=20if=20(p=20=3D=3D=20NULL)=0A+=20=20=20=20= return=20NULL;=0A+=0A+=20=20p->trampolines=20=3D=20= allocate_trampoline_page=20();=0A+=0A+=20=20if=20(p->trampolines=20=3D=3D=20= MAP_FAILED)=0A+=20=20=20=20return=20NULL;=0A+=0A+=20=20p->prev=20=3D=20= parent;=0A+=20=20p->free_trampolines=20=3D=20get_trampolines_per_page();=0A= +=0A+=20=20return=20p;=0A+}=0A+=0A+void=0A= +__builtin_nested_func_ptr_created=20(void=20*chain,=20void=20*func,=20= void=20**dst)=0A+{=0A+=20=20if=20(tramp_ctrl_curr=20=3D=3D=20NULL)=0A+=20= =20=20=20{=0A+=20=20=20=20=20=20tramp_ctrl_curr=20=3D=20= allocate_tramp_ctrl=20(NULL);=0A+=20=20=20=20=20=20if=20(tramp_ctrl_curr=20= =3D=3D=20NULL)=0A+=09abort=20();=0A+=20=20=20=20}=0A+=0A+=20=20if=20= (tramp_ctrl_curr->free_trampolines=20=3D=3D=200)=0A+=20=20=20=20{=0A+=20=20= =20=20=20=20void=20*tramp_ctrl=20=3D=20allocate_tramp_ctrl=20= (tramp_ctrl_curr);=0A+=20=20=20=20=20=20if=20(!tramp_ctrl)=0A+=09abort=20= ();=0A+=0A+=20=20=20=20=20=20tramp_ctrl_curr=20=3D=20tramp_ctrl;=0A+=20=20= =20=20}=0A+=0A+=20=20union=20ix86_trampoline=20*trampoline=0A+=20=20=20=20= =3D=20&tramp_ctrl_curr->trampolines[get_trampolines_per_page=20()=0A+=09=09= =09=09=20=20=20=20-=20tramp_ctrl_curr->free_trampolines];=0A+=0A+#if=20= __APPLE__=20&&=20__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=20>=3D=20= 101400=0A+=20=20/*=20Disable=20write=20protection=20for=20the=20MAP_JIT=20= regions=20in=20this=20thread=20(see=0A+=20=20=20=20=20= https://developer.apple.com/documentation/apple-silicon/porting-just-in-ti= me-compilers-to-apple-silicon)=20*/=0A+=20=20= pthread_jit_write_protect_np=20(0);=0A+#endif=0A+=0A+=20=20memcpy=20= (trampoline->insns,=20trampoline_insns,=0A+=09=20=20= sizeof(trampoline_insns));=0A+=20=20trampoline->fields.func_ptr=20=3D=20= func;=0A+=20=20trampoline->fields.chain_ptr=20=3D=20chain;=0A+=0A+#if=20= __APPLE__=20&&=20__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=20>=3D=20= 101400=0A+=20=20/*=20Re-enable=20write=20protection.=20=20*/=0A+=20=20= pthread_jit_write_protect_np=20(1);=0A+#endif=0A+=0A+=20=20= tramp_ctrl_curr->free_trampolines=20-=3D=201;=0A+=0A+=20=20= __builtin___clear_cache=20((void=20*)trampoline->insns,=0A+=09=09=09=20=20= =20((void=20*)trampoline->insns=20+=20sizeof(trampoline->insns)));=0A+=0A= +=20=20*dst=20=3D=20&trampoline->insns;=0A+}=0A+=0A+void=0A= +__builtin_nested_func_ptr_deleted=20(void)=0A+{=0A+=20=20if=20= (tramp_ctrl_curr=20=3D=3D=20NULL)=0A+=20=20=20=20abort=20();=0A+=0A+=20=20= tramp_ctrl_curr->free_trampolines=20+=3D=201;=0A+=0A+=20=20if=20= (tramp_ctrl_curr->free_trampolines=20=3D=3D=20get_trampolines_per_page=20= ())=0A+=20=20=20=20{=0A+=20=20=20=20=20=20if=20(tramp_ctrl_curr->prev=20= =3D=3D=20NULL)=0A+=09return;=0A+=0A+=20=20=20=20=20=20munmap=20= (tramp_ctrl_curr->trampolines,=20getpagesize());=0A+=20=20=20=20=20=20= struct=20tramp_ctrl_data=20*prev=20=3D=20tramp_ctrl_curr->prev;=0A+=20=20= =20=20=20=20free=20(tramp_ctrl_curr);=0A+=20=20=20=20=20=20= tramp_ctrl_curr=20=3D=20prev;=0A+=20=20=20=20}=0A+}=0Adiff=20--git=20= a/libgcc/config/i386/t-heap-trampoline=20= b/libgcc/config/i386/t-heap-trampoline=0Anew=20file=20mode=20100644=0A= index=2000000000000..613f635b1f6=0A---=20/dev/null=0A+++=20= b/libgcc/config/i386/t-heap-trampoline=0A@@=20-0,0=20+1,19=20@@=0A+#=20= Copyright=20The=20GNU=20Toolchain=20Authors.=0A+=0A+#=20This=20file=20is=20= part=20of=20GCC.=0A+#=0A+#=20GCC=20is=20free=20software;=20you=20can=20= redistribute=20it=20and/or=20modify=20it=0A+#=20under=20the=20terms=20of=20= the=20GNU=20General=20Public=20License=20as=20published=20by=0A+#=20the=20= Free=20Software=20Foundation;=20either=20version=203,=20or=20(at=20your=20= option)=0A+#=20any=20later=20version.=0A+#=0A+#=20GCC=20is=20distributed=20= in=20the=20hope=20that=20it=20will=20be=20useful,=20but=0A+#=20WITHOUT=20= ANY=20WARRANTY;=20without=20even=20the=20implied=20warranty=20of=0A+#=20= MERCHANTABILITY=20or=20FITNESS=20FOR=20A=20PARTICULAR=20PURPOSE.=20=20= See=20the=20GNU=0A+#=20General=20Public=20License=20for=20more=20= details.=0A+#=0A+#=20You=20should=20have=20received=20a=20copy=20of=20= the=20GNU=20General=20Public=20License=0A+#=20along=20with=20GCC;=20see=20= the=20file=20COPYING3.=20=20If=20not=20see=0A+#=20= .=0A+=0A+LIB2ADD=20+=3D=20= $(srcdir)/config/i386/heap-trampoline.c=0Adiff=20--git=20= a/libgcc/configure=20b/libgcc/configure=0Aindex=20= be5d45f1755..f607f592a90=20100755=0A---=20a/libgcc/configure=0A+++=20= b/libgcc/configure=0A@@=20-654,6=20+654,7=20@@=20build_cpu=0A=20build=0A=20= with_aix_soname=0A=20enable_vtable_verify=0A+heap_trampolines=0A=20= enable_shared=0A=20libgcc_topdir=0A=20target_alias=0A@@=20-701,6=20= +702,7=20@@=20with_target_subdir=0A=20with_cross_host=0A=20with_ld=0A=20= enable_shared=0A+enable_heap_trampolines=0A=20enable_vtable_verify=0A=20= with_aix_soname=0A=20enable_version_specific_runtime_libs=0A@@=20-1342,6=20= +1344,9=20@@=20Optional=20Features:=0A=20=20=20--disable-FEATURE=20=20=20= =20=20=20=20do=20not=20include=20FEATURE=20(same=20as=20= --enable-FEATURE=3Dno)=0A=20=20=20--enable-FEATURE[=3DARG]=20=20include=20= FEATURE=20[ARG=3Dyes]=0A=20=20=20--disable-shared=20=20=20=20=20=20=20=20= don't=20provide=20a=20shared=20libgcc=0A+=20=20--enable-heap-trampolines=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20Specify=20whether=20= to=20support=20generating=20heap=20trampolines=0A+=0A=20=20=20= --enable-vtable-verify=20=20=20=20Enable=20vtable=20verification=20= feature=0A=20=20=20--enable-version-specific-runtime-libs=20=20=20=20= Specify=20that=20runtime=20libraries=20should=20be=20installed=20in=20a=20= compiler-specific=20directory=0A=20=20=20--enable-maintainer-mode=0A@@=20= -2252,6=20+2257,39=20@@=20fi=0A=20=0A=20=0A=20=0A+#=20Check=20whether=20= --enable-heap-trampolines=20was=20given.=0A+if=20test=20= "${enable_heap_trampolines+set}"=20=3D=20set;=20then=20:=0A+=20=20= enableval=3D$enable_heap_trampolines;=0A+case=20"$target"=20in=0A+=20=20= x86_64-*-linux*=20|=20x86_64-*-darwin1[4-9]*=20|=20x86_64-*-darwin2*)=0A= +=20=20=20=20heap_trampolines=3D$enableval=0A+=20=20=20=20;;=0A+=20=20= aarch64*-*-linux*=20)=0A+=20=20=20=20heap_trampolines=3D$enableval=0A+=20= =20=20=20;;=0A+=20=20aarch64*-*darwin*=20)=0A+=20=20=20=20= heap_trampolines=3D$enableval=0A+=20=20=20=20;;=0A+=20=20*)=0A+=20=20=20=20= as_fn_error=20$?=20"Configure=20option=20--enable-off-stack-trampolines=20= is=20not=20supported=20\=0A+for=20this=20platform"=20"$LINENO"=205=0A+=20= =20=20=20heap_trampolines=3Dno=0A+=20=20=20=20;;=0A+esac=0A+else=0A+=0A= +case=20"$target"=20in=0A+=20=20*-*-darwin2*)=0A+=20=20=20=20= heap_trampolines=3Dyes=0A+=20=20=20=20;;=0A+=20=20*)=0A+=20=20=20=20= heap_trampolines=3Dno=0A+=20=20=20=20;;=0A+esac=0A+fi=0A+=0A+=0A+=0A=20#=20= Check=20whether=20--enable-vtable-verify=20was=20given.=0A=20if=20test=20= "${enable_vtable_verify+set}"=20=3D=20set;=20then=20:=0A=20=20=20= enableval=3D$enable_vtable_verify;=20case=20"$enableval"=20in=0Adiff=20= --git=20a/libgcc/configure.ac=20b/libgcc/configure.ac=0Aindex=20= 2fc9d5d7c93..459657838e0=20100644=0A---=20a/libgcc/configure.ac=0A+++=20= b/libgcc/configure.ac=0A@@=20-68,6=20+68,35=20@@=20AC_ARG_ENABLE(shared,=0A= =20],=20[enable_shared=3Dyes])=0A=20AC_SUBST(enable_shared)=0A=20=0A= +AC_ARG_ENABLE([heap-trampolines],=0A+=20=20= [AS_HELP_STRING([--enable-heap-trampolines]=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20[Specify=20whether=20to=20support=20= generating=20heap=20trampolines])],[=0A+case=20"$target"=20in=0A+=20=20= x86_64-*-linux*=20|=20x86_64-*-darwin1[[4-9]]*=20|=20x86_64-*-darwin2*)=0A= +=20=20=20=20heap_trampolines=3D$enableval=0A+=20=20=20=20;;=0A+=20=20= aarch64*-*-linux*=20)=0A+=20=20=20=20heap_trampolines=3D$enableval=0A+=20= =20=20=20;;=0A+=20=20aarch64*-*darwin*=20)=0A+=20=20=20=20= heap_trampolines=3D$enableval=0A+=20=20=20=20;;=0A+=20=20*)=0A+=20=20=20=20= AC_MSG_ERROR([Configure=20option=20--enable-off-stack-trampolines=20is=20= not=20supported=20\=0A+for=20this=20platform])=0A+=20=20=20=20= heap_trampolines=3Dno=0A+=20=20=20=20;;=0A+esac],[=0A+case=20"$target"=20= in=0A+=20=20*-*-darwin2*)=0A+=20=20=20=20heap_trampolines=3Dyes=0A+=20=20= =20=20;;=0A+=20=20*)=0A+=20=20=20=20heap_trampolines=3Dno=0A+=20=20=20=20= ;;=0A+esac])=0A+AC_SUBST(heap_trampolines)=0A+=0A=20= AC_ARG_ENABLE(vtable-verify,=0A=20[=20=20--enable-vtable-verify=20=20=20=20= Enable=20vtable=20verification=20feature=20],=0A=20[case=20"$enableval"=20= in=0Adiff=20--git=20a/libgcc/libgcc-std.ver.in=20= b/libgcc/libgcc-std.ver.in=0Aindex=20c4f87a50e70..a48f4899eb6=20100644=0A= ---=20a/libgcc/libgcc-std.ver.in=0A+++=20b/libgcc/libgcc-std.ver.in=0A@@=20= -1943,4=20+1943,7=20@@=20GCC_4.8.0=20{=0A=20GCC_7.0.0=20{=0A=20=20=20= __PFX__divmoddi4=0A=20=20=20__PFX__divmodti4=0A+=0A+=20=20= __builtin_nested_func_ptr_created=0A+=20=20= __builtin_nested_func_ptr_deleted=0A=20}=0Adiff=20--git=20= a/libgcc/libgcc2.h=20b/libgcc/libgcc2.h=0Aindex=20= 3ec9bbd8164..ac7eaab4f01=20100644=0A---=20a/libgcc/libgcc2.h=0A+++=20= b/libgcc/libgcc2.h=0A@@=20-29,6=20+29,9=20@@=20see=20the=20files=20= COPYING3=20and=20COPYING.RUNTIME=20respectively.=20=20If=20not,=20see=0A=20= #pragma=20GCC=20visibility=20push(default)=0A=20#endif=0A=20=0A+extern=20= void=20__builtin_nested_func_ptr_created=20(void=20*,=20void=20*,=20void=20= **);=0A+extern=20void=20__builtin_nested_func_ptr_deleted=20(void);=0A+=0A= =20extern=20int=20__gcc_bcmp=20(const=20unsigned=20char=20*,=20const=20= unsigned=20char=20*,=20size_t);=0A=20extern=20void=20__clear_cache=20= (void=20*,=20void=20*);=0A=20extern=20void=20__eprintf=20(const=20char=20= *,=20const=20char=20*,=20unsigned=20int,=20const=20char=20*)=0A--=20=0A= 2.34.1=0A=0A= --Apple-Mail=_3FD27E5F-A118-43CA-8ABE-7612B30CB0EC--