public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
* [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
@ 2024-04-18  8:35 akyragvtdizi at gmail dot com
  2024-05-15 11:25 ` [Bug debugedit/31653] " mark at klomp dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: akyragvtdizi at gmail dot com @ 2024-04-18  8:35 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

            Bug ID: 31653
           Summary: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128
                    relocations: [debugedit 5.0] testsuite: 10 11 19 23
                    failed
           Product: debugedit
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debugedit
          Assignee: unassigned at sourceware dot org
          Reporter: akyragvtdizi at gmail dot com
                CC: debugedit at sourceware dot org
  Target Milestone: ---

Created attachment 15471
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15471&action=edit
testsuite log

While building debugedit-5.0 in a RISC-V nspawn environment, I encountered test
failures during the make check phase. Specifically, tests 10, 11, 19, and 23
failed due to unsupported relocation types as indicated by readelf warnings in
the logs. The exact messages are:

readelf: Warning: unable to apply unsupported reloc type 60 to section
.debug_loclists
readelf: Warning: unable to apply unsupported reloc type 61 to section
.debug_loclists

These warnings relate to relocation types 60 and 61, which correspond to
R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128, respectively. I am currently using
binutils version 2.42, and upon reviewing the readelf source code, it appears
that readelf may not yet support these RISC-V specific relocation types.

Given this issue, I propose temporarily skipping the affected tests (10, 11,
19, 23) for the RISC-V architecture to allow for successful test completions
while a solution is being developed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug debugedit/31653] RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
  2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
@ 2024-05-15 11:25 ` mark at klomp dot org
  2024-10-30 13:10 ` laokz at foxmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2024-05-15 11:25 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
I am not seeing this with gcc 13.2.0 and binutils 2.41 as used in the buildbot:
https://builder.sourceware.org/buildbot/#/builders/debugedit-ubuntu-riscv

What (gcc?) generates these new relocations?

Could we get rid of this by grepping out the Warnings?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug debugedit/31653] RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
  2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
  2024-05-15 11:25 ` [Bug debugedit/31653] " mark at klomp dot org
@ 2024-10-30 13:10 ` laokz at foxmail dot com
  2024-11-02 19:03 ` mark at klomp dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: laokz at foxmail dot com @ 2024-10-30 13:10 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

laokz <laokz at foxmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |laokz at foxmail dot com

--- Comment #2 from laokz <laokz at foxmail dot com> ---
(In reply to Mark Wielaard from comment #1)
> I am not seeing this with gcc 13.2.0 and binutils 2.41 as used in the
> buildbot:
> https://builder.sourceware.org/buildbot/#/builders/debugedit-ubuntu-riscv
> 
> What (gcc?) generates these new relocations?
> 
> Could we get rid of this by grepping out the Warnings?

Sorry for the late response. The issue produced with gcc-12.3, binutils-2.41.
Surely we could get rid of it by grepping out the warnings.

When compiled the tests, we added -O2 option. Without -O2, all tests passed and
no R_RISCV_SET/SUB_ULEB128 generated. It seems that gcc/binutils do support
generating these relocs but readelf doesn't support applying them yet.
Reproduce steps:

0. platform: openSUSE Tumbleweed 20241029 - Kernel 6.11.5-1-default, riscv qemu
vm, gcc-14.2.1, binutils-2.43.1.20240828-2
1. echo "int main(){}" >z.c
2. gcc -g -O2 z.c
3. readelf -Wr z.o|grep 128                                                     
0000000000000015  0000001f0000003c R_RISCV_SET_ULEB128    0000000000000004
.LFE0 + 0                                                                       
0000000000000015  0000001e0000003d R_RISCV_SUB_ULEB128    0000000000000000
.LFB0 + 0
4. readelf --debug-dump=info z.o                                          
readelf: Warning: unable to apply unsupported reloc type 60 to section
.debug_rnglists                                                                 
readelf: Warning: unable to apply unsupported reloc type 61 to section
.debug_rnglists
...

This might not a BUG to debugedit. But if there some information in debugedit,
it might be helpful. Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug debugedit/31653] RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
  2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
  2024-05-15 11:25 ` [Bug debugedit/31653] " mark at klomp dot org
  2024-10-30 13:10 ` laokz at foxmail dot com
@ 2024-11-02 19:03 ` mark at klomp dot org
  2024-11-03  3:01 ` laokz at foxmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2024-11-02 19:03 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
(In reply to laokz from comment #2)
> When compiled the tests, we added -O2 option. Without -O2, all tests passed
> and no R_RISCV_SET/SUB_ULEB128 generated. It seems that gcc/binutils do
> support generating these relocs but readelf doesn't support applying them
> yet.

How exactly do you add the -O2 option?

> Reproduce steps:
> 0. platform: openSUSE Tumbleweed 20241029 - Kernel 6.11.5-1-default, riscv
> qemu vm, gcc-14.2.1, binutils-2.43.1.20240828-2
> 1. echo "int main(){}" >z.c
> 2. gcc -g -O2 z.c

plus -c

> 3. readelf -Wr z.o|grep 128                                                 

So this "reproduces" the warnings.

But I cannot replicate using the debugedit build/tests.
Is there a special way you are configuring/building and/or running make check?

If you are editing debugedit.at to explicitly add -O2 then please just don't do
that.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug debugedit/31653] RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
  2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
                   ` (2 preceding siblings ...)
  2024-11-02 19:03 ` mark at klomp dot org
@ 2024-11-03  3:01 ` laokz at foxmail dot com
  2024-11-03 16:47 ` mark at klomp dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: laokz at foxmail dot com @ 2024-11-03  3:01 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

--- Comment #4 from laokz <laokz at foxmail dot com> ---
(In reply to Mark Wielaard from comment #3)
> (In reply to laokz from comment #2)
> > When compiled the tests, we added -O2 option. Without -O2, all tests passed
> > and no R_RISCV_SET/SUB_ULEB128 generated. It seems that gcc/binutils do
> > support generating these relocs but readelf doesn't support applying them
> > yet.
> 
> How exactly do you add the -O2 option?
>
We work for openEuler Linux. It uses gcc_secure[1], which is a wrapper of gcc,
to optimize and enhance security. Gcc_secure added the -O2 option.

> > Reproduce steps:
> > 0. platform: openSUSE Tumbleweed 20241029 - Kernel 6.11.5-1-default, riscv
> > qemu vm, gcc-14.2.1, binutils-2.43.1.20240828-2
> > 1. echo "int main(){}" >z.c
> > 2. gcc -g -O2 z.c
> 
> plus -c
> 
Oops

> > 3. readelf -Wr z.o|grep 128                                                 
> 
> So this "reproduces" the warnings.
> 
> But I cannot replicate using the debugedit build/tests.
> Is there a special way you are configuring/building and/or running make
> check?
> 
> If you are editing debugedit.at to explicitly add -O2 then please just don't
> do that.

No. 

We could avoid the problem by adding debugedit to gcc_secure exclusive list, or
by other means. Thanks for your reply.

[1] https://gitee.com/src-openeuler/gcc_secure

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug debugedit/31653] RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
  2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
                   ` (3 preceding siblings ...)
  2024-11-03  3:01 ` laokz at foxmail dot com
@ 2024-11-03 16:47 ` mark at klomp dot org
  2024-11-04  4:12 ` laokz at foxmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2024-11-03 16:47 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |mark at klomp dot org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-11-03

--- Comment #5 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 15777
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15777&action=edit
Ignore stderr in AT_CHECK for readelf stderr warnings

Aha, OK now I understand how to replicate it.
./configure CC="gcc -O2 -g"
Will do the same. Always run gcc with -O2 even in the testsuite.

Even though I think you should not add extra compiler flags to the testsuite I
see how if you do warnings from readelf would be an issue.

Luckily it is easy to ignore stderr warnings with AT_CHECK.
Could you try the attached patch?

If there is no bug yet, we should file a binutils bug against readelf
(apply_relocations) should handle R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug debugedit/31653] RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
  2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
                   ` (4 preceding siblings ...)
  2024-11-03 16:47 ` mark at klomp dot org
@ 2024-11-04  4:12 ` laokz at foxmail dot com
  2024-11-05 23:46 ` mark at klomp dot org
  2024-11-05 23:46 ` mark at klomp dot org
  7 siblings, 0 replies; 9+ messages in thread
From: laokz at foxmail dot com @ 2024-11-04  4:12 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

--- Comment #6 from laokz <laokz at foxmail dot com> ---
(In reply to Mark Wielaard from comment #5)
> Created attachment 15777 [details]
> Ignore stderr in AT_CHECK for readelf stderr warnings
> 
> Aha, OK now I understand how to replicate it.
> ./configure CC="gcc -O2 -g"
> Will do the same. Always run gcc with -O2 even in the testsuite.
> 
> Even though I think you should not add extra compiler flags to the testsuite
> I see how if you do warnings from readelf would be an issue.
> 
> Luckily it is easy to ignore stderr warnings with AT_CHECK.
> Could you try the attached patch?
Yes. I tried and it worked! (rebased against our debugedit-5.0 package)
> If there is no bug yet, we should file a binutils bug against readelf
> (apply_relocations) should handle R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128
Indeed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug debugedit/31653] RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
  2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
                   ` (5 preceding siblings ...)
  2024-11-04  4:12 ` laokz at foxmail dot com
@ 2024-11-05 23:46 ` mark at klomp dot org
  2024-11-05 23:46 ` mark at klomp dot org
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2024-11-05 23:46 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=32342

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug debugedit/31653] RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed
  2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
                   ` (6 preceding siblings ...)
  2024-11-05 23:46 ` mark at klomp dot org
@ 2024-11-05 23:46 ` mark at klomp dot org
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2024-11-05 23:46 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=31653

--- Comment #7 from Mark Wielaard <mark at klomp dot org> ---
(In reply to laokz from comment #6)
> (In reply to Mark Wielaard from comment #5)
> > Luckily it is easy to ignore stderr warnings with AT_CHECK.
> > Could you try the attached patch?
>
> Yes. I tried and it worked! (rebased against our debugedit-5.0 package)

Thanks for testing. Committed as:

commit 785f451a1b05f89c3b24eb5550f35488b80152b7
Author: Mark Wielaard <mark@klomp.org>
Date:   Wed Nov 6 00:28:40 2024 +0100

    tests: Ignore stderr output of readelf in debugedit.at

    readelf might produce some warning messages that don't matter for the
    specific tests in debugedit.at. So ignore stderr output and just check
    stdout output is as expected.

    https://sourceware.org/bugzilla/show_bug.cgi?id=31653

    Signed-off-by: Mark Wielaard <mark@klomp.org>

> > If there is no bug yet, we should file a binutils bug against readelf
> > (apply_relocations) should handle R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128
> Indeed.

Filed: https://sourceware.org/bugzilla/show_bug.cgi?id=32342

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-11-05 23:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18  8:35 [Bug debugedit/31653] New: RISC-V: readelf fails to apply R_RISCV_SET/SUB_ULEB128 relocations: [debugedit 5.0] testsuite: 10 11 19 23 failed akyragvtdizi at gmail dot com
2024-05-15 11:25 ` [Bug debugedit/31653] " mark at klomp dot org
2024-10-30 13:10 ` laokz at foxmail dot com
2024-11-02 19:03 ` mark at klomp dot org
2024-11-03  3:01 ` laokz at foxmail dot com
2024-11-03 16:47 ` mark at klomp dot org
2024-11-04  4:12 ` laokz at foxmail dot com
2024-11-05 23:46 ` mark at klomp dot org
2024-11-05 23:46 ` mark at klomp dot org

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