From patchwork Mon Jun 18 21:01:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 10472705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9AA836032A for ; Mon, 18 Jun 2018 21:01:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B7F728A6B for ; Mon, 18 Jun 2018 21:01:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 805CE28A7A; Mon, 18 Jun 2018 21:01:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E1F628A72 for ; Mon, 18 Jun 2018 21:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935531AbeFRVBt (ORCPT ); Mon, 18 Jun 2018 17:01:49 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36362 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935709AbeFRVBt (ORCPT ); Mon, 18 Jun 2018 17:01:49 -0400 Received: by mail-wm0-f68.google.com with SMTP id v131-v6so18135541wma.1 for ; Mon, 18 Jun 2018 14:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Fep8fwgf8v/18io3U23rRRzJIWDrNvnbUt1pxkSZ8Xo=; b=lDTQg+ksss06Omlz798nEM9iIg7O8GNmZcitNxzIyoH5TkHLRChmGtMXIlUUIMyYC+ e9snNYhO7VOs55/BaTrZ8yA/4jV7jiVv7y/x5t5vcKaJ+/tHafIiDyqNp1SNWlg3D1sF gtFJssjpUOBleO8BzYEIQcv8y5O/6wRNiNnaYkph+47naqP6Ahw8ZlXvdr2mKMzulahP g9e7ErklYwMu7zzjPvsHUC3RwF9eEpMXUoJb8vsrHTwEDWL+jRfLB14MxyV3/ehIy0tb 4e6c2o+4VYZ/6vmD+ksKET2JuWcAdzXLl56d3YE+ssgmBmQXLVRKlwJZsx53pHJLNpcW Es1g== 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=Fep8fwgf8v/18io3U23rRRzJIWDrNvnbUt1pxkSZ8Xo=; b=Az5aX/n0OWKMOBYcrWhPiTzEBBBZOSK8N4KhwGJb68TIfysEIeXSYr+Ik1k25Y2XxN N9qwkwd4VafvYVVN+55PPUpFRZX177V741eWEG82gLbK2HkjlCXDOHlgw+iJUFwZY8yx i7PJTK7VW6nEol5tx+10uEkgL0TD1o4Bn9MT9CXPGEh1wWeCye2wjMUiiyoBEH++/ar7 6P2v+EzT0C9vb/8NYZNviX7366tMBZZgK4SdhHmPoniXH/Dq8pN82WUuA/oTTEbWVwHC /rSt8PG7v9iScEYY4NRW4v3zQxxoAkq87YIH8rzVy6UpHZdck0FKS2QXPzo7BVACcnXM bEjQ== X-Gm-Message-State: APt69E2cG4F3Vd1oKPaazQA7Xe9QZ2SxaOMdlEQKUESZePDC3Dj2Ko1d GYHcD8+CyEL08Gr3r1UtcChkbuf2 X-Google-Smtp-Source: ADUXVKJAYNmBJEcNQSQ2GR9B3kMXCVGNinEKzA9/ifjAFJniZR9pNCh+su7XQ3IzHrL5EkssYXmjdA== X-Received: by 2002:a50:bc16:: with SMTP id j22-v6mr12394342edh.240.1529355707904; Mon, 18 Jun 2018 14:01:47 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:419e:1700:1d86:8bc0:bbb1:c152]) by smtp.gmail.com with ESMTPSA id r15-v6sm6743919edp.92.2018.06.18.14.01.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 14:01:47 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 2/2] symaddr: give a type to OP_SYMADDR Date: Mon, 18 Jun 2018 23:01:40 +0200 Message-Id: <20180618210140.69467-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618210140.69467-1-luc.vanoostenryck@gmail.com> References: <20180618210140.69467-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, OP_SYMADDR are given a size but not a type. But the type is needed for several things. Fix this by giving them the type of the pointer. Signed-off-by: Luc Van Oostenryck --- linearize.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linearize.c b/linearize.c index e9354e437..ed49931ce 100644 --- a/linearize.c +++ b/linearize.c @@ -1018,13 +1018,13 @@ static pseudo_t add_setfval(struct entrypoint *ep, struct symbol *ctype, long do return target; } -static pseudo_t add_symbol_address(struct entrypoint *ep, struct symbol *sym) +static pseudo_t add_symbol_address(struct entrypoint *ep, struct expression *expr) { - struct instruction *insn = alloc_instruction(OP_SYMADDR, bits_in_pointer); + struct instruction *insn = alloc_typed_instruction(OP_SYMADDR, expr->ctype); pseudo_t target = alloc_pseudo(insn); insn->target = target; - use_pseudo(insn, symbol_pseudo(ep, sym), &insn->src); + use_pseudo(insn, symbol_pseudo(ep, expr->symbol), &insn->src); add_one_insn(ep, insn); return target; } @@ -1616,7 +1616,7 @@ static pseudo_t linearize_expression(struct entrypoint *ep, struct expression *e switch (expr->type) { case EXPR_SYMBOL: linearize_one_symbol(ep, expr->symbol); - return add_symbol_address(ep, expr->symbol); + return add_symbol_address(ep, expr); case EXPR_VALUE: return value_pseudo(expr->value);