From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by sourceware.org (Postfix) with ESMTPS id 338E83864832 for ; Fri, 16 Jul 2021 02:58:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 338E83864832 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-xd30.google.com with SMTP id l5so8980869iok.7 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=Ro10a12azdMhfl8sXiwjV9cNabMHD/nb3mjbvOaEdfRDZsw348Ys1vhZbE5Othue7p +NlAxrc64cSqlr5sjMm3ADgyvdTdlCKeNWTsm15RZGbHdZhNFX3Wi97WtBmZ+601OpHq uCdZeV1i/W7T/RMZ2FADRH7f9iTbYtVofmJTnUrB5Tg+MtEbM/Fxa7FYqTJ+KLf7e4PJ JmklY9jrHqgzLaLFkw7pCNr2fAcgyJjLpu790YapeFV1txRq01cBfCdBeXEvLMEG3dF8 TuKHw3jkQI6bMxsK8fSy09nJGs3ppYtOIFR6j7OsAx+Nk3a+bj7YO35eSUlov4oilazZ AUnQ== X-Gm-Message-State: AOAM5306DFDDkeQhIYc7FduDyUV+VQR6C8o5FMWHhqSI2MUndarMHUDK xltHw5Lr4ARFsbkNsD2LTCNnz11fT4aaJWz1I0RgNg== 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 Cc: Binutils , gdb-patches@sourceware.org, Jim Wilson , Andrew Burgess , Kito Cheng , Andrew Waterman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 02:58:36 -0000 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