From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QDEDIuj18GAdXQAAWB0awg (envelope-from ) for ; Thu, 15 Jul 2021 22:58:48 -0400 Received: by simark.ca (Postfix, from userid 112) id 7BA8C1EDF0; Thu, 15 Jul 2021 22:58:48 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8910B1E79C for ; Thu, 15 Jul 2021 22:58:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E43BC384383F for ; Fri, 16 Jul 2021 02:58:46 +0000 (GMT) Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by sourceware.org (Postfix) with ESMTPS id 32C04385502C for ; Fri, 16 Jul 2021 02:58:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 32C04385502C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-io1-xd2a.google.com with SMTP id v26so8963259iom.11 for ; Thu, 15 Jul 2021 19:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8XnXOV93nQ/Qx/ObgkITK+n1wK+DHZGnlYit4CMwxkI=; b=LVEG3FYp7jMi5gvOzxqNdGVJZRZDQGxwrpZv9qNLRdfGT07G6A5wEBduT3vXd3hTO+ RnEJL+Kfs3eugKq1qA1bjGFFtS0+GNheiwjrNtTq4f3wrRJeT6o/+8llPYBKmFVq9AOJ pA+ylEtpmxtisOS5WkISbJHNC32dNS3sCwRkpWjNE73t06W2NauOaSPEV3xRjl/7O3KB 6xUsEZQ0Ox8QBhArnh9eaqk1VUA7CQOA/YYPlLjrZ1XSXuoqnyIrLsnZCyevaJ7Leknq w9cKsLL8OGu7KcmyWTYhCh3sik/yppZhkO7PbvA5cUlpCuCGnT1hTx2vfOFDmhZGchAf SqTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8XnXOV93nQ/Qx/ObgkITK+n1wK+DHZGnlYit4CMwxkI=; b=t0hWjivwGS4HtOZejDnMCmSsH1ABQmgUZR6/2NIaNFx+7EeUg6S/1K+beT69ZUa2L1 qt60WYfB5O/WGlgUoscjCfXi+jDnpzB/NHv1DLN6qifzv/wPX2ciM5xE+mDtgKQsehQt bJ6kWBeZJdy/7HzKHY3SNIoo0CIPDExKh0uXd31jS4Vm21HkBnlv4fuo38qhXnbEGvoW 8blLn3+XpsaSMZhPdoGQs+B0LJjnZCX7f4ETsslUCT7AW1yUrkK/eQgiC6ikqUboawhs tk+mTFmT4ZIezW9qkOagrBJ2b3LDbXWVytCYBp5WuA7e4x/mO5v5fWBNNuilVDj8fLmI WTsA== X-Gm-Message-State: AOAM531xjbyo5mNpF1eruIGBbUuVaY31Glp5z8PAJex1+xwkPynVLPNC mTnCJ2j2ViJRWyw0udKsJjE4VW5jlNxBSAkhM4UUaw== X-Google-Smtp-Source: ABdhPJweNkG83H/ONCr8ZSPslDYeFVvOCDskuLO/pzkd1l6bsMhlN2tziYo5xDsUSwN9oYm3wrLencb/FAbf1qGJ9U4= X-Received: by 2002:a02:6946:: with SMTP id e67mr6917903jac.4.1626404311703; Thu, 15 Jul 2021 19:58:31 -0700 (PDT) MIME-Version: 1.0 References: <20210709072825.13709-3-nelson.chu@sifive.com> In-Reply-To: From: Nelson Chu Date: Fri, 16 Jul 2021 10:58:21 +0800 Message-ID: Subject: Re: [PATCH v2 2/3] RISC-V: PR27916, Support mapping symbols. To: Palmer Dabbelt Content-Type: text/plain; charset="UTF-8" X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Waterman , Binutils , Kito Cheng , gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On Thu, Jul 15, 2021 at 11:16 PM Palmer Dabbelt wrote: > > +/* Define mapping symbols for riscv. */ > > + > > +bool > > +riscv_elf_is_mapping_symbols (const char *name) > > +{ > > + return (!strncmp (name, "$d", 2) > > + || !strncmp (name, "$x", 2) > > + || !strncmp (name, "$a", 2)); > > +} > > I can't quite figure this one out: this will treat something like > "$aWHATEVER" as a mapping symbol, does that cause binutils to crash > somewhere? All I'm seeing it do is mark these as hidden symbols, which > I guess is OK (we've kind of set the "anything with $ is inernal > precedent"). > > Either way, > Reviewed-by: Palmer Dabbelt Just filtering the mapping symbols in the bfd/elfnn-riscv.c/riscv_elf_is_target_special_symbol isn't enough. I notice that we also need to filter them in bfd/elfnn-riscv.c/riscv_maybe_function_sym and opcode/riscv-dis.c/riscv_symbol_is_valid, otherwise, something may be broken. For example, objudmp/nm/addr2line calls bfd_find_nearest_line to dump something, including the GNU note sections, and it will call _bfd_elf_find_function to get the function name. If we don't filter the mapping symbols here, then they may be regarded as function names, which is not the expected result. BTW, since the discussion from psabi, https://github.com/riscv/riscv-elf-psabi-doc/pull/196 The $a and $d+size are abandoned for now. So the v3 patch is a little bit different from this one. Thanks Nelson