From patchwork Mon May 22 21:12:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 20541 Received: (qmail 1457 invoked by alias); 22 May 2017 21:13:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 1324 invoked by uid 89); 22 May 2017 21:12:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-lf0-f65.google.com Received: from mail-lf0-f65.google.com (HELO mail-lf0-f65.google.com) (209.85.215.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 May 2017 21:12:58 +0000 Received: by mail-lf0-f65.google.com with SMTP id 99so6432771lfu.2; Mon, 22 May 2017 14:13:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ozY2+wC/GkzwV92WScCjXzizY/0ReQsi5SbOGzoheFw=; b=W70Xe2FvVK47yuOt8/xbJiKFcq+wiCp1qUDMgBe4ZV5oiXW+zBaIo9lE9lAfH4Kgq6 qer5+JqE3ygsN3pYfNYUuY7imunfBnDnWjXp35Fn69UMlmBSEC4MyW+xu6HuJnbdx+cD hjBih3VMUC0/QpMBq6fF1Vy85xnWPq5WkT9TkhGAcd6mTu6Xr6Vn1FuzzzU0IG2szFMZ nlktMrHlQEDzva0JVN9fk3Rsha7kW/f46E/zE0iByLo4F162Es4zmoqDqHNw2iOvfKr9 UWlDXr6JSyrSPJB4Im9AZjBOTJmR5f55TIjIGg8w8b3OLeIdI0x3ZgqgcluGiy5a8QQy mWrw== X-Gm-Message-State: AODbwcCIhD0app1NuUVYezbDNSGw3JDGSNA9HzZ+CaDI9XTVIvhc61r2 kgZ5JE6e65FJuccZ X-Received: by 10.46.6.26 with SMTP id 26mr6598173ljg.29.1495487579253; Mon, 22 May 2017 14:12:59 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by smtp.gmail.com with ESMTPSA id a7sm3335749ljb.44.2017.05.22.14.12.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 May 2017 14:12:58 -0700 (PDT) From: Max Filippov To: binutils@sourceware.org, gdb-patches@sourceware.org Cc: Sterling Augustine , David Weatherford , Maxim Grigoriev , Woody LaRue , Max Filippov Subject: [RFC 4/5] xtensa: make xtensa_modules dynamic Date: Mon, 22 May 2017 14:12:32 -0700 Message-Id: <1495487553-19078-5-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1495487553-19078-1-git-send-email-jcmvbkbc@gmail.com> References: <1495487553-19078-1-git-send-email-jcmvbkbc@gmail.com> 2017-05-22 Max Filippov bfd/ * xtensa-isa.c (xtensa-dynconfig.h): New #include'd header. (xtensa_get_modules): New function. (xtensa_isa_init): Call xtensa_get_modules instead of taking address of global xtensa_modules. --- bfd/xtensa-isa.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c index 8da75be..79fb76b 100644 --- a/bfd/xtensa-isa.c +++ b/bfd/xtensa-isa.c @@ -23,6 +23,7 @@ #include "libbfd.h" #include "xtensa-isa.h" #include "xtensa-isa-internal.h" +#include "xtensa-dynconfig.h" xtensa_isa_status xtisa_errno; char xtisa_error_msg[1024]; @@ -233,10 +234,20 @@ xtensa_insnbuf_from_chars (xtensa_isa isa, extern xtensa_isa_internal xtensa_modules; +static xtensa_isa_internal *xtensa_get_modules (void) +{ + static xtensa_isa_internal *modules; + + if (!modules) + modules = xtensa_load_config ("xtensa_modules", &xtensa_modules); + + return modules; +} + xtensa_isa xtensa_isa_init (xtensa_isa_status *errno_p, char **error_msg_p) { - xtensa_isa_internal *isa = &xtensa_modules; + xtensa_isa_internal *isa = xtensa_get_modules (); int n, is_user; /* Set up the opcode name lookup table. */