From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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-pj1-x1029.google.com with SMTP id k2-20020a17090a4c8200b002187cce2f92so15761155pjh.2 for ; Mon, 28 Nov 2022 16:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=X6HsuLu+LDgdRIAvq3cnuMQtdFhATsScWovCPwGcKkU=; b=P7d4p6SG/N8PFkuVk7DaLqnHex6yfxTniUyoibLCDeR8PIXt4EceeiZfXxXFdWGD9w 0AOuee1yD6QEOK910wWvommmZjhbU9yQmBc7rn/JAiHaU0PvUyZnYQksNiHTftdxCQyc Qma0Ke6tiQwO4psbBx1lFyALKvf5VwfLeul0/qIfL3EtPm85GKb97XaBfMnZqzYyNFfp F/s+7tVYpJfGCOJu0OGR2Yib1JY5pl6nN/7zbBOVX1BLp3k+B15Xqb0MNw0vT8PY9MBM m6/WVYG4lmV+eY8pu8Ssjy4nNn23b5Z+xcMDO5O4ktykQbsIosLU7QwgniQ79h2Zfn/P PAkA== 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-Google-Smtp-Source: AA0mqf6ISR78aqChabLrtkb9ZRQxRLLJ4TILAsixuI18UdNWk4SyFf60jLSrHwP47C+8RhFJ2GoSng== 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) From: Max Filippov 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.30.2