From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by sourceware.org (Postfix) with ESMTPS id 1AF4A3858D38 for ; Thu, 13 Aug 2020 05:42:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1AF4A3858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=maskray.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emacsray@gmail.com Received: by mail-pl1-f194.google.com with SMTP id q19so2155817pll.0 for ; Wed, 12 Aug 2020 22:42:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IgiG763QzYAx7o4ur3j38wAq+2vswlaqhXw4o8y0gU4=; b=tUNojZFLDJxYMZ84VbP9h1D1ue/wpdO2Hh0v7Hf6HYupt1L65oMdF7HYasNJpEsXJL e3Jq/I82g/XcA9LpHJ2SuDuy7VYdeQYLmJOEzGH8tdjgBlsMVsuBibz0TJ2AJOA/4wr2 /2kyyy83pF4OzyNbCRKDnlrAWwODRHj5T5xEsM5UJ3OWzEK29ENE4sRufrYkjKREThJH ffsyYeVg744qgXK1/wwG2KTbCOtm51CSBa8EHpR0wKDPEA9S017YxatOEACpSBuA/v5t CTgOpXy3TeYGAvzucz4FOUGdx9lwb7oht8aRh6jaP8pPDMe5ON/DlZ6HMOTW+FAe2rnV Pjbg== X-Gm-Message-State: AOAM532EQCGUoDpNV4xBkAMuH/2sv1IiXWa9qBufzqEWNUoGwDo1L5OO aAFmWvf9/rHkqhx7a3Uy2PU= X-Google-Smtp-Source: ABdhPJwFoRSPRxvbK9LtQlQhc0oYXDBbKdVwgV90ybLfz5OCPoqfyIWd2kRNmCZHTS2gmg2/GPP6Aw== X-Received: by 2002:a17:90a:e687:: with SMTP id s7mr3481449pjy.48.1597297374142; Wed, 12 Aug 2020 22:42:54 -0700 (PDT) Received: from localhost ([2601:647:4b01:ae80::51fb]) by smtp.gmail.com with ESMTPSA id f89sm3975039pje.11.2020.08.12.22.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 22:42:53 -0700 (PDT) Date: Wed, 12 Aug 2020 22:42:52 -0700 From: Fangrui Song To: "H.J. Lu" Cc: Alan Modra , Nick Clifton , Binutils Subject: Re: [PATCH] nm: Remove --with-symbol-versions Message-ID: <20200813054252.huxskahmjbqzznps@gmail.com> References: <20200727134417.638165-1-hjl.tools@gmail.com> <20200807145527.GA679176@gmail.com> <20200813024202.u6aiyypj6piyp3z5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Thu, 13 Aug 2020 05:42:56 -0000 On 2020-08-12, H.J. Lu wrote: >On Wed, Aug 12, 2020 at 7:42 PM Fangrui Song wrote: >> >> "bfd: Display symbol version for nm -D" has a minor problem: an >> undefined symbol (e.g. strlen@GLIBC_2.2.5 in cat) should use one @, >> instead of two @@. nm -D output is currently inconsistent with readelf -Ws's >> output and ld -y's behavior. >> > >nm -D is consistent with readelf -sW and nm: > >[hjl@gnu-cfl-2 tmp]$ cat x.c >#include > >void >foo (void) >{ > printf ("foo\n"); >} >[hjl@gnu-cfl-2 tmp]$ gcc -shared -fPIC x.c >[hjl@gnu-cfl-2 tmp]$ readelf -sW a.out | grep UND | grep @@ > 47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.2.5 > 51: 0000000000000000 0 FUNC WEAK DEFAULT UND >__cxa_finalize@@GLIBC_2.2.5 >[hjl@gnu-cfl-2 tmp]$ nm a.out | grep " U " | grep @@ > U puts@@GLIBC_2.2.5 >[hjl@gnu-cfl-2 tmp]$ nm -D a.out | grep " U " | grep @@ > U puts@@GLIBC_2.2.5 >[hjl@gnu-cfl-2 tmp]$ > >But readelf --dyn-syms only displays a single @ puts@GLIBC_2.2.5 in .dynsym (st_name concatenated with the version string in .gnu.version_r) and puts@@GLIBC_2.2.5 in .symtab (st_name). This looks like another minor thing which should be fixed in ld. Version strings in VERNEED should use a single @.