From patchwork Tue Nov 29 00:45:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 2337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp38822wrr; Mon, 28 Nov 2022 16:47:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf6p3JMTu9K11m3qJuCIY+fXm/4V71vBqjoN30tcM/eib+WLeK04/pvX2L466jMH8cg/IqH4 X-Received: by 2002:a05:6402:321e:b0:469:ebc0:2247 with SMTP id g30-20020a056402321e00b00469ebc02247mr30297899eda.217.1669682825651; Mon, 28 Nov 2022 16:47:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669682825; cv=none; d=google.com; s=arc-20160816; b=jTieU1TszVitAXIxHxiHeJIAFgC/768jyo4Ra9kdvEg1pN610ZnEk50NpxHSPD0QB5 fobUDbG3SL2hKeXF7/qHDxGpoWVO9CJtv+EnF1YqmzzOtCU7/4Ha3z/UJXmll+bT8gwf S5upPMv1WE3xbpDrPni/AclmpH6EK3DPiXXQPsoa0zavxYBdA/YGaqGNSGmwSfXDjDJE vAIbGonE7obbSfizNlsgGG3zOooxPZ3Q0e5UGpjvpifEDE4DtWgQ9YNNXOrJf4uM/msQ VBDLvZguayb17G+DeR8DiDaZ8bQuQKfJjo0kaaTQ+/K0SVbZyJywrN6sni++MLrO4a2B h3Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=X6HsuLu+LDgdRIAvq3cnuMQtdFhATsScWovCPwGcKkU=; b=dIk5+GtOtzXhI+CDHiuJl/nt0nSkJN7kJJJPQ/5Md48uYw/FqqLO6arAvUzYxgjUth HeMN3RaL6BIqa189Z8FnWx9qTg0ynZ3GyTE6WKj3KaxcqTjGDXjzNYG6LF7xCShS0jWO OIVoFUXhcwJN8K5vKsY7m1nyZBdAGhLv+3WWIHIa0ZBRfUjRZdykBy3XF4OoP2O2lV26 eEiKIgPQLml//1HHi2BgcQSiVl7Ao/yjb7+4liHUJ8oJLK7wv5eJ6GS+a4+CpnwvgiGM qZY5sLu05dr1sMjjxgDly/fmubcqowREK76au5uU691CD6ieorsq0b+/dbYts7nGF3V1 9Y1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GyR8zOkP; 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id w14-20020a056402268e00b00461a144e981si12996903edd.356.2022.11.28.16.47.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 16:47:05 -0800 (PST) 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=GyR8zOkP; 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 E089C3855147 for ; Tue, 29 Nov 2022 00:46:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E089C3855147 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669682811; bh=X6HsuLu+LDgdRIAvq3cnuMQtdFhATsScWovCPwGcKkU=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=GyR8zOkP0QaIWhWSU6NHtMDCVh8ADXkpxzWAreRu9tZe9AJt8FVVGjqYmz6npt8ge 9sunzTcDhQLqaZ5xc3g+fvpQkqOBdoHRbTIY0W0ZBVvA6MNklwnw1wzHjeI3Uf0aEN vxvH9UgmLlFUHAZZe0IavxUA5bnUYVOPnAR29fpE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 7F4853858D28 for ; Tue, 29 Nov 2022 00:46:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F4853858D28 Received: by mail-pj1-x1029.google.com with SMTP id k2-20020a17090a4c8200b002187cce2f92so15761155pjh.2 for ; Mon, 28 Nov 2022 16:46:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X6HsuLu+LDgdRIAvq3cnuMQtdFhATsScWovCPwGcKkU=; b=AmVq++fdOsTlQGtsl73oRrQZu8uIPSttBlfE+6sgrq1FHDhfrF083ka9ykQ5qP2SRC KyN/isMA+z+yhqEwAsXKNyE/6mMgXSVpDUlb8/7ZhpMcqqr70UGrAm0Zq4neKmuITz9K mAFowHgrJnrxOLCru2gcqpbHK57rXru/saZEIzdsWESnymbLsjb3Ul0MQ1iBSoJh9f6R KRino/FAtkfWomCBaWJV0t5klrhlDdfLLsPH0WIbKj+tN0l189/pAsteh9KsjrHGaVvB ENKC+T47dQ+bGf+XNgKl8TWb7ZAN5bLZO6pIuFAlTHOp8FxKoSoQflxqbiWyB4FKHuYm IM3Q== X-Gm-Message-State: ANoB5pkSLizu0+S8XxyJWupIrF9/+m4j63802GPTwhuA3ec8fhPap2E1 Oa5tqYvLmZyTwOS3l+qpBsJt9Y+RL4s= X-Received: by 2002:a17:90b:4f85:b0:216:92a9:fd60 with SMTP id qe5-20020a17090b4f8500b0021692a9fd60mr61759896pjb.24.1669682767067; Mon, 28 Nov 2022 16:46:07 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:bb27:8901:5994:c758]) by smtp.gmail.com with ESMTPSA id s128-20020a625e86000000b005752201d4ffsm1687491pfb.213.2022.11.28.16.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 16:46:06 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Ian Lance Taylor , Max Filippov Subject: [PATCH v2 0/2] gcc: xtensa: allow dynamic configuration Date: Mon, 28 Nov 2022 16:45:49 -0800 Message-Id: <20221129004551.2213723-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Max Filippov via Gcc-patches From: Max Filippov Reply-To: Max Filippov Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750789338330856179?= X-GMAIL-MSGID: =?utf-8?q?1750789338330856179?= Hello, this series addresses the long standing issue with xtensa configuration support by adding a way to configure toolchain for a specific xtensa core at runtime using the xtensa-dynconfig [1] library as a plugin. On a platform with shared library support single toolchain binary becomes capable of building code for arbitrary xtensa configuration. At the same time it fully preserves the traditional way of configuring the toolchain using the xtensa configuration overlay. Currently xtensa toolchain needs to be patched and rebuilt for every new xtensa processor configuration. This has a number of downsides: - toolchain builders need to change the toolchain source code, and because xtensa configuration overlay is not a patch, this change is special, embedding it into the toolchain build process gets backpressure. - toolchain built for one configuration is usually not usable for any other configuration. It's not possible for a distribution to provide reusable prebuilt xtensa toolchain. This series allows building the toolchain (including target libraries) without its source code modification. Built toolchain takes configuration parameters from the shared object specified in the environment variable. That shared object may be built by the xtensa-dynconfig project [1]. The same shared object is used for gcc, all binutils and for gdb. Xtensa core specific information needed to build that shared object is taken from the configuration overlay. Both gcc and binutils-gdb get new shared header file include/xtensa-dynconfig.h that provides definition of configuration data structure, initialization macros, redefines XCHAL_* macros to access this structure and declares function for loading configuration dynamically. This is not the first submission of this series, it was first submitted in 2017 [2]. This version has improved configuration versioning and GPL-compatibility check that was suggested in comments for the v1. [1] https://github.com/jcmvbkbc/xtensa-dynconfig [2] https://gcc.gnu.org/pipermail/gcc-patches/2017-May/475109.html Max Filippov (2): gcc: xtensa: allow dynamic configuration libgcc: xtensa: use built-in configuration gcc/config.gcc | 1 + gcc/config/xtensa/t-xtensa | 8 +- gcc/config/xtensa/xtensa-dynconfig.c | 170 +++++++ gcc/config/xtensa/xtensa-protos.h | 1 + gcc/config/xtensa/xtensa.h | 22 +- include/xtensa-dynconfig.h | 442 +++++++++++++++++++ libgcc/config/xtensa/crti.S | 2 +- libgcc/config/xtensa/crtn.S | 2 +- libgcc/config/xtensa/lib1funcs.S | 2 +- libgcc/config/xtensa/lib2funcs.S | 2 +- libgcc/config/xtensa/xtensa-config-builtin.h | 198 +++++++++ 11 files changed, 828 insertions(+), 22 deletions(-) create mode 100644 gcc/config/xtensa/xtensa-dynconfig.c create mode 100644 include/xtensa-dynconfig.h create mode 100644 libgcc/config/xtensa/xtensa-config-builtin.h