public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: eu-strip on .rustc section produce error information
       [not found] <d873925e62de4d8c95d72cfa1d8dacfe@huawei.com>
@ 2023-07-20 14:57 ` Mark Wielaard
  2023-07-22 10:46   ` 答复: " chenziyang (C)
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2023-07-20 14:57 UTC (permalink / raw)
  To: chenziyang (C), elfutils-devel
  Cc: lvying, Fangxiuning (Jack, EulerOS), xujing (AN)

Hi Ziyang,

On Thu, 2023-07-20 at 13:14 +0000, chenziyang (C) via Elfutils-devel
wrote:
> Hi elfutils maintainers
> 
> I am running 'rpmbuild -ba sysmaster.spec', and produce following error info:
> eu-strip: Cannot remove symbol [742] from allocated symbol table [3]
> 
> This error is caused by strip_to_debug() function in /usr/bin/find-debuginfo.sh which is triggered by rpm-build
> [cid:image003.png@01D9BB4F.19E5EE90]
> 
> Steps to Reproduce:
> eu-strip -R .rustc libtarget_1.so
> Actual result:
> eu-strip: Cannot remove symbol [742] from allocated symbol table [3]
> 
> OR
> eu-strip -remove-comment libtarget.so.debug1 libtarget_1.so
> Actual result: eu-strip: Cannot remove symbol [742] from allocated symbol table [3]

Would you be able to show the sections and symbols for libtarget_1.so.
Specifically what symbol table section 3 is and what 742th symbol in
that table is? And does libtarget_1.so actually contain a .rustc
section?

Thanks,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 答复: eu-strip on .rustc section produce error information
  2023-07-20 14:57 ` eu-strip on .rustc section produce error information Mark Wielaard
@ 2023-07-22 10:46   ` chenziyang (C)
  2023-07-31 19:48     ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: chenziyang (C) @ 2023-07-22 10:46 UTC (permalink / raw)
  To: Mark Wielaard, elfutils-devel
  Cc: lvying, Fangxiuning (Jack, EulerOS), xujing (AN)

Hi Mark,

Thanks for reply. First you may get libtarget_1.so from https://github.com/JetXujing/xujing/blob/main/libtarget_1.so
Second, below are the sections of libtarget_1.so 

# readelf -S libtarget_1.so
There are 44 section headers, starting at offset 0x3626548:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .note.gnu.bu[...] NOTE             0000000000000270  00000270
       0000000000000024  0000000000000000   A       0     0     4
  [ 2] .gnu.hash         GNU_HASH         0000000000000298  00000298
       000000000000d0f0  0000000000000000   A       3     0     8
  [ 3] .dynsym           DYNSYM           000000000000d388  0000d388
       0000000000032598  0000000000000018   A       4     1     8
  [28] .rustc            PROGBITS         0000000000000000  006c71f2
       0000000000011e16  0000000000000000           0     0     1
  [29] .gnu.build.a[...] NOTE             00000000006ca838  006d9008
       0000000000000024  0000000000000000           0     0     4
  [30] .debug_aranges    PROGBITS         0000000000000000  006d902c
       00000000000292e0  0000000000000000           0     0     1

As for table 3 and symbol 742, I used gbd to get the following information, but cannot map the index to symbol name, if you know how to do so please give some hint(Thanks so much!)

I used elfutils-185 version 
p shdr_info[cnt].shdr
$11 = {sh_name = 104, sh_type = 11, sh_flags = 2, sh_addr = 54488, sh_offset = 54488, sh_size = 207768, sh_link = 4, sh_info = 1, sh_addralign = 8, sh_entsize = 24}
AND
p shdr_info[cnt]
$9 = {scn = 0x5555555b1fe8, shdr = {sh_name = 104, sh_type = 11, sh_flags = 2, sh_addr = 54488, sh_offset = 54488, sh_size = 207768, sh_link = 4, sh_info = 1, sh_addralign = 8,
    sh_entsize = 24}, data = 0x5555555b1fe8, debug_data = 0x0, name = 0x5555555b1878 ".dynsym", idx = 3, old_sh_link = 4, symtab_idx = 0, version_idx = 5, group_idx = 0,
  group_cnt = 0, newscn = 0x5555555b44b8, se = 0x5555555b74e0, newsymidx = 0x5555555ca470}

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?

Best
Ziyang

-----邮件原件-----
发件人: Mark Wielaard [mailto:mark@klomp.org] 
发送时间: 2023年7月20日 22:58
收件人: chenziyang (C) <chenziyang4@huawei.com>; elfutils-devel@sourceware.org
抄送: lvying <lvying6@huawei.com>; Fangxiuning (Jack, EulerOS) <fangxiuning@huawei.com>; xujing (AN) <xujing125@huawei.com>
主题: Re: eu-strip on .rustc section produce error information

Hi Ziyang,

On Thu, 2023-07-20 at 13:14 +0000, chenziyang (C) via Elfutils-devel
wrote:
> Hi elfutils maintainers
> 
> I am running 'rpmbuild -ba sysmaster.spec', and produce following error info:
> eu-strip: Cannot remove symbol [742] from allocated symbol table [3]
> 
> This error is caused by strip_to_debug() function in 
> /usr/bin/find-debuginfo.sh which is triggered by rpm-build 
> [cid:image003.png@01D9BB4F.19E5EE90]
> 
> Steps to Reproduce:
> eu-strip -R .rustc libtarget_1.so
> Actual result:
> eu-strip: Cannot remove symbol [742] from allocated symbol table [3]
> 
> OR
> eu-strip -remove-comment libtarget.so.debug1 libtarget_1.so Actual 
> result: eu-strip: Cannot remove symbol [742] from allocated symbol 
> table [3]

Would you be able to show the sections and symbols for libtarget_1.so.
Specifically what symbol table section 3 is and what 742th symbol in that table is? And does libtarget_1.so actually contain a .rustc section?

Thanks,

Mark


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 答复: eu-strip on .rustc section produce error information
  2023-07-22 10:46   ` 答复: " chenziyang (C)
@ 2023-07-31 19:48     ` Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2023-07-31 19:48 UTC (permalink / raw)
  To: chenziyang (C)
  Cc: elfutils-devel, lvying, Fangxiuning (Jack, EulerOS), xujing (AN)

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-31 19:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <d873925e62de4d8c95d72cfa1d8dacfe@huawei.com>
2023-07-20 14:57 ` eu-strip on .rustc section produce error information Mark Wielaard
2023-07-22 10:46   ` 答复: " chenziyang (C)
2023-07-31 19:48     ` Mark Wielaard

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).