From patchwork Thu Jul 20 14:35:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Lapshin X-Patchwork-Id: 123312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3163841vqt; Thu, 20 Jul 2023 07:36:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlHQB46lz0ydpaYNopt+4L6u4pCrX7w1MQmZpfJX8AWqJ47La0zzJkbcEss/5f1NnErr/ckt X-Received: by 2002:a17:906:1013:b0:99b:4890:812d with SMTP id 19-20020a170906101300b0099b4890812dmr2609354ejm.16.1689863768023; Thu, 20 Jul 2023 07:36:08 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u25-20020a1709063b9900b00986631b58d2si747503ejf.837.2023.07.20.07.36.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 07:36:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WeffTgcc; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B0792385C420 for ; Thu, 20 Jul 2023 14:36:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0792385C420 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689863766; bh=HhvM50c3f9XuaEq+GDDs28U1OXeYVtV8Sp4txWaAtqo=; h=To:CC:Subject:Date:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=WeffTgccA2PRN4ZMEQJSl6UPswQBiXiEnM3CpcsIuUNq9zPDAy2CFvfpemC2FPhKC kaMGIm6dimRV3GoWdgIGw06y1j0u5fe5BPd7yrBxQ2WIZcNUXA/K1Rfb10YedkyKKg 0qG0Nv0c3VdGjLIoYvtHFVt1Wtauw618mbZdDzPc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2092.outbound.protection.outlook.com [40.107.117.92]) by sourceware.org (Postfix) with ESMTPS id F02AF3857004 for ; Thu, 20 Jul 2023 14:35:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F02AF3857004 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uq/9jU13nL/7TObSS0k7onB0HV7QIqX5b6MFSfFnNQRU1QwcxI6bux0haYcNOQ/NhV7aSvlPf4vdxdto85trcs9A3VmxRQeg/37yNMdAAYM4Y5m7W3WhLRQDcue9gQYiDLMO3oKD3jCWFa7u1eVvbqMU9xZmdrf4Jju0sLJ2zLKCIXlGp3YbKhB7oErkZ5YI4GE1Q/qovQ2WJqofv0lfE+CfgytZ+dSX8gnrUg8rv547rQQFDZbBFu4zxapbNveYbG7MZqIPZ0c3BibMtG1kubnnWzXgA6g8tYH2QVt4bsahSRFh6a5zG2P/YOoQngEzhcVJFf+k219yOul05OsGuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HhvM50c3f9XuaEq+GDDs28U1OXeYVtV8Sp4txWaAtqo=; b=mM6zBR5nFOs+F/WGV6hz4cLUOa6NDUbdNdKI/AlmoFlWr3yQ3pmDexippPWcQaFMKuxtdRz2ApYkTk6ym722iXxz1nZkQ6sx98xv67lazxH5wV7ukNHbD1/MsCBOg3sGtl/OcHhPHaEdaBvHZdq9ne3FraunoebCm0JUT/oQ19JAfewujBt9Jw3CnayT8glrMBv9hft70QI94djG8u+sWsyYZJpVcVIEmt3YtBDHsZGmroatbi86e6crHOdVa8rHTORW6vAQSnmniu1d0/fmzA7E5UTfjA4nI5U+yjjtsImOHE/NQhmG02tO4YQpF3gHJlI9mZLmW3gi6LQ93NJb5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=espressif.com; dmarc=pass action=none header.from=espressif.com; dkim=pass header.d=espressif.com; arc=none Received: from TYZPR04MB5736.apcprd04.prod.outlook.com (2603:1096:400:1fa::7) by KL1PR0401MB6226.apcprd04.prod.outlook.com (2603:1096:820:c3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Thu, 20 Jul 2023 14:35:19 +0000 Received: from TYZPR04MB5736.apcprd04.prod.outlook.com ([fe80::cb3d:7677:ae5b:c6a9]) by TYZPR04MB5736.apcprd04.prod.outlook.com ([fe80::cb3d:7677:ae5b:c6a9%5]) with mapi id 15.20.6588.031; Thu, 20 Jul 2023 14:35:19 +0000 To: "gcc-patches@gcc.gnu.org" CC: Alexey Gerenkov , Ivan Grokhotkov , "jcmvbkbc@gmail.com" Subject: [PATCH 1/3] gcc: xtensa: add mdynconfig option Thread-Topic: [PATCH 1/3] gcc: xtensa: add mdynconfig option Thread-Index: AQHZuxdoQRlt7KenZkmp9IuIBVLgEw== Date: Thu, 20 Jul 2023 14:35:19 +0000 Message-ID: References: <485a6a6c62a8632d9e3ac44b2d8fd935c0e0a78b.camel@espressif.com> In-Reply-To: <485a6a6c62a8632d9e3ac44b2d8fd935c0e0a78b.camel@espressif.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: TYZPR04MB5736:EE_|KL1PR0401MB6226:EE_ x-ms-office365-filtering-correlation-id: ff11a44d-6b13-41a2-5bea-08db892e8acc x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fvC1zfszS2mbn+PJiThZdSLgMmh4xeRcoykb5AvMUt0NIp8c6md+5kJ5xuT270dlv2zb/Qbdlq/gLb+Ld7hfLF+mF2jDG4v6NE5Jman1N8HM7TN/1QSNSmxqQvAq8bDC5wzCYQwZZ3B9HpDuRJ6UzHUDagjWmG4UNOW31E/wp9nTmLcfE3Chuwl1Uk5OBc5bz8FYF24DEmB5EgoLhD4g2zRicFzEB+bSjmbvQEsmOuVNdqxa+XoddwPj5Z1YIUfK+SmwfnRq7deUvBeguqwAs57vjkx+jL0Zeuff/pznjjs6+B3W9ySYV8L6/LVZcdr53B3UsnPKtCVzkbDhgrs7z7xuHq9OoqFLVxRc050jJWhP0Wt61vY0Mas2qeNXxcrOos8CzxmVsTjO6DUPGQW3+1rhHUF07bPoiqq220zsgNCGKI0+Bqt0Ym+oGDmeLrUeFGeEOLBDRJD9Bdo2D1n+8khzcqP+0ivUcVr2YDKTE3cmt5rDlTLcYUlGIALhAHNaUiQjAffxrJbyEsuOQlOaZhAkBk0WD1NvZWZ3PoMP+gaxDx2qsL1MIFutKHcuaNGi7F3ArM4MHfT9NeQ8zLaD7RqdiIBEsRsvez1k7wZ3uQMf0evvle/hi+MEqbVjZpTq x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR04MB5736.apcprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(346002)(376002)(39850400004)(136003)(396003)(451199021)(8676002)(41300700001)(8936002)(44832011)(6916009)(64756008)(91956017)(66476007)(66446008)(66946007)(76116006)(66556008)(54906003)(4326008)(186003)(478600001)(2906002)(6506007)(26005)(316002)(83380400001)(2616005)(5660300002)(6512007)(38100700002)(122000001)(36756003)(6486002)(38070700005)(71200400001)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?lpSDBqYJlbxc3qSUKFTbhLolP7kK?= =?utf-8?q?qUFunls3Diqih16Xihbhu8imDIPMXLffOUIPWqgybxjkQ7NDZgTFP00iQKvRQmUL6?= =?utf-8?q?6NHauwQW5g9/r+VPvR3q27+D71UOfxXwIPl/hKbmrVpnHGnB3LGRMQVCR9s9vNrB3?= =?utf-8?q?KHfyOuG1vg4iOKxpHNILFfMGrJoL8jgG11plH8RyWmrUHBsBKsbxza+GAoNqCDPyJ?= =?utf-8?q?PlyWNYdUMRY3AOzWMjsL8nWDeJEvi0UouBNeir9NbWzq5dmfWy+gywCfR3nreFRWS?= =?utf-8?q?qovyZPk5mDDvxrxgQylDoOIbZiP/LTQIv8LLX81k/nDKleuOYhXji2SbllS91jkRl?= =?utf-8?q?cegTWXZfYW+/ETx9aCKHpCiKrfxegDF/FpbWRIWr5kI4FbqKjkVm9W25oBdEqMZW+?= =?utf-8?q?Hg6Zmla4BfLznlF96Yx2khpU5n6ikr6qh89kDFBA/lpCJ9qp182iOKs7IMi6S4o2C?= =?utf-8?q?eKku1SsgX+kzDMDEsyZaetL41yNxXLRMCmoE/2W4iN5v54/VsdOOKY5hNkFEh0YFA?= =?utf-8?q?+lGBmN8N/gDWArud9/GOiCbsfYRbmoscUyDZSYNfimOIkurDDIKLVfCRoiFtPFLDS?= =?utf-8?q?YMumOJfHHIp7uSrOX8JWGnyiM+fFE5OidOxdVj9SSR9dpAzXr6shrezy6+gAA0OEg?= =?utf-8?q?OVXE0BCDlkyPyl17gMswaOiuRj2MU52B/bbWNTa3PWDFkf6Jux4X2t9Kv23vkrgBM?= =?utf-8?q?mgA5vJcEbbgz8Gr8SoKsUfEgnVDoiasLxQFKGgo/DTFzC6RIrhl//jhX7fzQAEgjD?= =?utf-8?q?aPmLV+hpYx3ME4MjYuDJ5hWAEpJBGqY7sz966yxwXu27Gv4dmVt4AeblOf4u2f3kf?= =?utf-8?q?NhM2lvYbFMLLB2UoCUqeq3CZIatYyW+QxsKIpAQVbBjnBH8joxW/KKBMuNFIVXOiw?= =?utf-8?q?+3QALxvU3UOrf0VaKKt4yPR8Dhjsz9pSWp+NP0nLKDAz7haM1YWkQ80FIBjSwsMkK?= =?utf-8?q?wVQl4s4DIB98hUtV/hAEztVa1w2Ad7ZNWC7auAm6TY9403OrEBplLN7ztMqwb1zx2?= =?utf-8?q?rjZnf8LFxTUXeopFucsXd3MvenVJbBF/+BW52GJE8KVGFj6Bu9RkpISBN+tZRbBOa?= =?utf-8?q?MWfvQxZqfLREoHh2iB+iqJFlWjLuThuOtasU3oj0qMp4DF/6aliVicCk2oWL+pDlX?= =?utf-8?q?g4Jrh8v4KWGqDb7HTMguhB5WEbVbbw1njapsRsa1KtWsvcBq1I+a8djpLpXN64EBk?= =?utf-8?q?ME0a88pKlQzDjNBRAyWGdcIUITZY2yUvE4vhWZ8RIkDSEkd+QSuqez5SAw2VU3crw?= =?utf-8?q?LoENEefoVMVG9bUHMnauPTRe5x6mq4nCi/EFW6IMBVZz107Ll1aNna5vROLmK8K2t?= =?utf-8?q?dD9pmNqbTlA+LALHGGoqMD8MHjuw1XVafr3thLDANQjt7L+eLhLwgJSs2kU0eO6Rh?= =?utf-8?q?hMVwYFnE3eFM8bXzv1uFgSYkWQ9ATOvvFm+6zRPn9fakNaJugY2iSQ6Rc2NSw5ecN?= =?utf-8?q?DZWqkoVyVPgSqSOo4q6USr33cZ5vlsr15KO5iAyJuVG//8knkM3H4nXssHv8z55xq?= =?utf-8?q?EaA+7TWNXS7yhmI+ydx0bnTvpbQO44uTJNQxa2vUt45TbxBLlqKtvW0=3D?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: espressif.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYZPR04MB5736.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff11a44d-6b13-41a2-5bea-08db892e8acc X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 14:35:19.3057 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5faf27fd-3557-4294-9545-8ea74a409f39 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WGdz2aFvoJDXSL0iXrGEr6uzCYW/NXKKDKeDrbWLpJRxB7D5zAy2XFzvt5Y+dYJFnTTXbMmEzwWXKuWcgySQxe9KI/dwQHfb69ITZOiqH8c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0401MB6226 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alexey Lapshin via Gcc-patches From: Alexey Lapshin Reply-To: Alexey Lapshin Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771950590202432863 X-GMAIL-MSGID: 1771950590202432863 gcc/ * config/xtensa/elf.h (ASM_SPEC, LINK_SPEC): Pass dynconfig to assembler/linker. * config/xtensa/linux.h (ASM_SPEC, LINK_SPEC): Likewise. * config/xtensa/uclinux.h (ASM_SPEC, LINK_SPEC): Likewise. * config/xtensa/xtensa-dynconfig.cc: May build dynconfig path with dir in XTENSA_GNU_CONFIG and filename in mdynconfig option. * doc/invoke.texi: Add XTENSA_GNU_CONFIG and mdynconfig doc. --- gcc/config/xtensa/elf.h | 6 ++- gcc/config/xtensa/linux.h | 6 ++- gcc/config/xtensa/uclinux.h | 6 ++- gcc/config/xtensa/xtensa-dynconfig.cc | 55 ++++++++++++++++++++++++++- gcc/config/xtensa/xtensa.opt | 4 ++ gcc/doc/invoke.texi | 14 +++++++ 6 files changed, 83 insertions(+), 8 deletions(-) -- 2.34.1 diff --git a/gcc/config/xtensa/elf.h b/gcc/config/xtensa/elf.h index 715b3a0b1d2..6683edea1de 100644 --- a/gcc/config/xtensa/elf.h +++ b/gcc/config/xtensa/elf.h @@ -49,7 +49,8 @@ along with GCC; see the file COPYING3. If not see %{mauto-litpools:--auto-litpools} \ %{mno-auto-litpools:--no-auto-litpools} \ %{mabi=windowed:--abi-windowed} \ - %{mabi=call0:--abi-call0}" + %{mabi=call0:--abi-call0} \ + %{mdynconfig=*:--dynconfig=%*}" #undef LIB_SPEC #define LIB_SPEC "-lc -lsim -lc -lhandlers-sim -lhal" @@ -69,7 +70,8 @@ along with GCC; see the file COPYING3. If not see %{rdynamic:-export-dynamic} \ %{static:-static}}} \ %{mabi=windowed:--abi-windowed} \ - %{mabi=call0:--abi-call0}" + %{mabi=call0:--abi-call0} \ + %{mdynconfig=*:--dynconfig=%*}" #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "." diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h index e684e7deebf..928e8c36923 100644 --- a/gcc/config/xtensa/linux.h +++ b/gcc/config/xtensa/linux.h @@ -46,7 +46,8 @@ along with GCC; see the file COPYING3. If not see %{mauto-litpools:--auto-litpools} \ %{mno-auto-litpools:--no-auto-litpools} \ %{mabi=windowed:--abi-windowed} \ - %{mabi=call0:--abi-call0}" + %{mabi=call0:--abi-call0} \ + %{mdynconfig=*:--dynconfig=%*}" #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" @@ -60,7 +61,8 @@ along with GCC; see the file COPYING3. If not see %{static-pie:-static -pie --no-dynamic-linker -z text} \ %{static:-static}} \ %{mabi=windowed:--abi-windowed} \ - %{mabi=call0:--abi-call0}" + %{mabi=call0:--abi-call0} \ + %{mdynconfig=*:--dynconfig=%*}" #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "." diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h index da9e619fb05..68c209bbebb 100644 --- a/gcc/config/xtensa/uclinux.h +++ b/gcc/config/xtensa/uclinux.h @@ -53,13 +53,15 @@ along with GCC; see the file COPYING3. If not see %{mauto-litpools:--auto-litpools} \ %{mno-auto-litpools:--no-auto-litpools} \ %{mabi=windowed:--abi-windowed} \ - %{mabi=call0:--abi-call0}" + %{mabi=call0:--abi-call0} \ + %{mdynconfig=*:--dynconfig=%*}" #undef LINK_SPEC #define LINK_SPEC \ "%{!no-elf2flt:%{!elf2flt*:-elf2flt}} \ %{mabi=windowed:--abi-windowed} \ - %{mabi=call0:--abi-call0}" + %{mabi=call0:--abi-call0} \ + %{mdynconfig=*:--dynconfig=%*}" #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "." diff --git a/gcc/config/xtensa/xtensa-dynconfig.cc b/gcc/config/xtensa/xtensa-dynconfig.cc index 9aea9f253c2..3d6938a134b 100644 --- a/gcc/config/xtensa/xtensa-dynconfig.cc +++ b/gcc/config/xtensa/xtensa-dynconfig.cc @@ -22,6 +22,7 @@ #include "coretypes.h" #include "diagnostic.h" #include "intl.h" +#include "options.h" #define XTENSA_CONFIG_DEFINITION #include "xtensa-config.h" #include "xtensa-dynconfig.h" @@ -67,6 +68,55 @@ dlerror (void) #define CONFIG_ENV_NAME "XTENSA_GNU_CONFIG" +#ifdef ENABLE_PLUGIN + +static char *get_xtensa_dynconfig_file (void) +{ + const char *xtensa_dynconfig_env = getenv (CONFIG_ENV_NAME); + if (!strlen (xtensa_dynconfig_file)) + { + if (xtensa_dynconfig_env && !strlen (lbasename (xtensa_dynconfig_env))) + { + /* XTENSA_GNU_CONFIG has directory path, but dynconfig file is not set */ + return NULL; + } + else if (xtensa_dynconfig_env) + { + /* XTENSA_GNU_CONFIG has filepath */ + return xstrdup (xtensa_dynconfig_env); + } + /* dynconfig is not set */ + return NULL; + } + if (!xtensa_dynconfig_env) + { + /* XTENSA_GNU_CONFIG has filepath */ + return xstrdup (xtensa_dynconfig_file); + } + if (!strlen (lbasename (xtensa_dynconfig_env))) + { + /* XTENSA_GNU_CONFIG has directory path and dynconfig file is set */ + const size_t len = strlen (xtensa_dynconfig_env) + + strlen (xtensa_dynconfig_file) + 1; + char *path = ( char *) xmalloc (len); + strcpy (path, xtensa_dynconfig_env); + strcat (path, xtensa_dynconfig_file); + return path; + } + if (strcmp (lbasename (xtensa_dynconfig_env), + lbasename (xtensa_dynconfig_file))) + { + fatal_error (input_location, + "Both %qs and \"-dynconfig=\" specified but pointed different files: \"%qs\" \"%qs\"", + CONFIG_ENV_NAME, xtensa_dynconfig_env, xtensa_dynconfig_file); + exit (FATAL_EXIT_CODE); + } + /* XTENSA_GNU_CONFIG and mdynconfig option point to the same file */ + return xstrdup (xtensa_dynconfig_env); +} + +#endif /* ENABLE_PLUGIN */ + const void *xtensa_load_config (const char *name ATTRIBUTE_UNUSED, const void *no_plugin_def, const void *no_name_def ATTRIBUTE_UNUSED) @@ -78,12 +128,13 @@ const void *xtensa_load_config (const char *name ATTRIBUTE_UNUSED, if (!init) { - const char *path = getenv (CONFIG_ENV_NAME); + char *path = get_xtensa_dynconfig_file(); init = 1; if (!path) return no_plugin_def; handle = dlopen (path, RTLD_LAZY); + free (path); if (!handle) { fatal_error (input_location, @@ -119,7 +170,7 @@ const void *xtensa_load_config (const char *name ATTRIBUTE_UNUSED, #else if (!init) { - const char *path = getenv (CONFIG_ENV_NAME); + const char *path = strcmp(xtensa_dynconfig_file, "") ? xtensa_dynconfig_file : getenv (CONFIG_ENV_NAME); init = 1; if (path) diff --git a/gcc/config/xtensa/xtensa.opt b/gcc/config/xtensa/xtensa.opt index 3a129a4c039..62959fc76c7 100644 --- a/gcc/config/xtensa/xtensa.opt +++ b/gcc/config/xtensa/xtensa.opt @@ -64,3 +64,7 @@ Use call0 ABI. mabi=windowed Target RejectNegative Var(xtensa_windowed_abi, 1) Use windowed registers ABI. + +mdynconfig= +Target RejectNegative Joined Var(xtensa_dynconfig_file) Init("") +Directory or path to dynconfig library. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a38547f53e5..c8bc5c40f49 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -34258,6 +34258,14 @@ Choose startup files and linker script suitable for the simulator. These options are supported for Xtensa targets: @table @gcctabopt + +@vindex XTENSA_GNU_CONFIG +@item XTENSA_GNU_CONFIG +@env{XTENSA_GNU_CONFIG} is designed to set dir/fullpath to dynconfig +library. In case directory is present in @env{XTENSA_GNU_CONFIG} +filename of dynconfig library must be set in @option{-mdynconfig}. +Must ends with directory separator in case contains direcrory path. + @opindex mconst16 @opindex mno-const16 @item -mconst16 @@ -34394,6 +34402,12 @@ instructions, in clock cycles. This affects, when optimizing for speed, whether loading a constant from literal pool using @code{L32R} or synthesizing the constant from a small one with a couple of arithmetic instructions. The default value is 0. + +@opindex mdynconfig +@item -mdynconfig=@var{path} +Set the filename/path to xtensa dynconfig. +In case filename is set the directory part must be present in +@env{XTENSA_GNU_CONFIG} environment variable. @end table @node zSeries Options