public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: "chenziyang (C)" <chenziyang4@huawei.com>
Cc: "elfutils-devel@sourceware.org" <elfutils-devel@sourceware.org>,
	lvying <lvying6@huawei.com>,
	"Fangxiuning (Jack, EulerOS)" <fangxiuning@huawei.com>,
	"xujing (AN)" <xujing125@huawei.com>
Subject: Re: 答复: eu-strip on .rustc section produce error information
Date: Mon, 31 Jul 2023 21:48:24 +0200	[thread overview]
Message-ID: <20230731194824.GH28605@gnu.wildebeest.org> (raw)
In-Reply-To: <82c6c1144dea43e59c0ec1e63135e18d@huawei.com>

Hi Ziyang,

On Sat, Jul 22, 2023 at 10:46:21AM +0000, chenziyang (C) wrote:
> Thanks for reply. First you may get libtarget_1.so from https://github.com/JetXujing/xujing/blob/main/libtarget_1.so

Thanks. So using that trying to remove the .rustc section I do get:

eu-strip: Cannot remove symbol [7873] from allocated symbol table [3]

Note that this is a warning, not an error. The section is still
removed.

The issues is that in the original file the .rustc section is:
$ eu-readelf -S libtarget_1.so.orig | grep .rustc
[28] .rustc               PROGBITS     0000000000000000 006c71f2 00011e16  0        0   0  1

And symbol table 3 is:
$ eu-readelf -S libtarget_1.so.orig | grep '\[ 3\]'
[ 3] .dynsym              DYNSYM       000000000000d388 0000d388 00032598 24 A      4   1  8

Symbol 7873 in .dynsym is:
$ eu-readelf --symbols=.dynsym libtarget_1.so.orig | grep 7873:
 7873: 0000000000000000  73238 OBJECT  GLOBAL DEFAULT       28 rust_metadata_target_af70f9bf599b19f0

Note that symbol refers to ndx (section) 28. That is out .rustc section.

Since .dynsym is an allocated symbol table it cannot simply remove
that symbol. But since it refers to a section that is about to be
removed it emits that warning and replaces the ndx (section) with
UNDEF:

$ eu-readelf --symbols=.dynsym libtarget_1.so.stripped | grep 7873:
 7873: 0000000000000000  73238 OBJECT  GLOBAL DEFAULT    UNDEF rust_metadata_target_af70f9bf599b19f0

> And I found the commit that trigger this error infor: https://sourceware.org/git/?p=elfutils.git;a=commitdiff;h=7bf4b63a4980788e6c1969cae02f0483e79c069f;hp=4f7b5ba9624489b5a2f714569c29ef865d4dcd6f
> Is this error info an expected behavior?

Yes. It is an expected warning.

Cheers,

Mark

      reply	other threads:[~2023-07-31 19:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d873925e62de4d8c95d72cfa1d8dacfe@huawei.com>
2023-07-20 14:57 ` Mark Wielaard
2023-07-22 10:46   ` 答复: " chenziyang (C)
2023-07-31 19:48     ` Mark Wielaard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230731194824.GH28605@gnu.wildebeest.org \
    --to=mark@klomp.org \
    --cc=chenziyang4@huawei.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=fangxiuning@huawei.com \
    --cc=lvying6@huawei.com \
    --cc=xujing125@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).