public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* RISC-V: Should the return value of print_insn_riscv() keep align with other platforms when read_memory_func() returns a non-zero value?
@ 2023-02-20 10:10 Xiaolin Zheng
  2023-02-21  1:28 ` Nelson Chu
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaolin Zheng @ 2023-02-20 10:10 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]

Hi, Binutils developers on the RISC-V backend:
Hope this is the right place to send one email to the Binutils mailing list. We have met a small issue [1] in OpenJDK when using the `disassembler()` API in `dis-asm.h` to disassemble. In the RISC-V backend of Binutils, if `read_memory_func` returns a `status`, a non-zero value, after calling `memory_error_func` we will use the `status` variable as the final return value [2], which is different from other platforms that use a `-1` as return value [3] [4] [5] [6]. Although we could have some workaround for this on our side, the question is, should the behavior keep the same as on other platforms?
Best Regards,
Xiaolin
[1] https://github.com/openjdk/jdk/pull/12551 <https://github.com/openjdk/jdk/pull/12551 >
[2] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/riscv-dis.c#L940 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/riscv-dis.c#L940 >
[3] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/aarch64-dis.c#L3792 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/aarch64-dis.c#L3792 >
[4] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/ppc-dis.c#L872 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/ppc-dis.c#L872 >
[5] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/s390-dis.c#L305 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/s390-dis.c#L305 >
[6] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/i386-dis.c#L9466 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/i386-dis.c#L9466 >

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

* Re: RISC-V: Should the return value of print_insn_riscv() keep align with other platforms when read_memory_func() returns a non-zero value?
  2023-02-20 10:10 RISC-V: Should the return value of print_insn_riscv() keep align with other platforms when read_memory_func() returns a non-zero value? Xiaolin Zheng
@ 2023-02-21  1:28 ` Nelson Chu
  2023-02-21  3:30   ` Xiaolin Zheng
  2023-03-01  9:09   ` Xiaolin Zheng
  0 siblings, 2 replies; 4+ messages in thread
From: Nelson Chu @ 2023-02-21  1:28 UTC (permalink / raw)
  To: Xiaolin Zheng; +Cc: binutils

It used to be "status", but I accidentally changed it to "1" when
porting mapping symbols, so I just changed it back to what it was
before.  Seems like it should be "-1", but not sure why it was
"status" for a long time ago.

Thanks
Nelson

On Mon, Feb 20, 2023 at 6:11 PM Xiaolin Zheng via Binutils
<binutils@sourceware.org> wrote:
>
> Hi, Binutils developers on the RISC-V backend:
> Hope this is the right place to send one email to the Binutils mailing list. We have met a small issue [1] in OpenJDK when using the `disassembler()` API in `dis-asm.h` to disassemble. In the RISC-V backend of Binutils, if `read_memory_func` returns a `status`, a non-zero value, after calling `memory_error_func` we will use the `status` variable as the final return value [2], which is different from other platforms that use a `-1` as return value [3] [4] [5] [6]. Although we could have some workaround for this on our side, the question is, should the behavior keep the same as on other platforms?
> Best Regards,
> Xiaolin
> [1] https://github.com/openjdk/jdk/pull/12551 <https://github.com/openjdk/jdk/pull/12551 >
> [2] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/riscv-dis.c#L940 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/riscv-dis.c#L940 >
> [3] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/aarch64-dis.c#L3792 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/aarch64-dis.c#L3792 >
> [4] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/ppc-dis.c#L872 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/ppc-dis.c#L872 >
> [5] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/s390-dis.c#L305 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/s390-dis.c#L305 >
> [6] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/i386-dis.c#L9466 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/i386-dis.c#L9466 >

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

* Re: RISC-V: Should the return value of print_insn_riscv() keep align with other platforms when read_memory_func() returns a non-zero value?
  2023-02-21  1:28 ` Nelson Chu
@ 2023-02-21  3:30   ` Xiaolin Zheng
  2023-03-01  9:09   ` Xiaolin Zheng
  1 sibling, 0 replies; 4+ messages in thread
From: Xiaolin Zheng @ 2023-02-21  3:30 UTC (permalink / raw)
  To: Nelson Chu; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 3079 bytes --]

Hi Nelson,
Thanks for the response. Yes, it is indeed "status" in the initial load. Well, I am not sure if the "status" is going to get changed in the future, but OpenJDK does not depend on a certain version of Binutils, that OpenJDK developers (or users) could specify a Binutils source code path (maybe any version) in configurations and use Makefiles in OpenJDK to generate `libopcodes.a` and friends to archive a certain dynamic lib used for disassembling. So seems that even if this issue is fixed, we need to keep the RISC-V-specific workaround in JDK as well. Do you think there are other better solutions to this issue?
Thanks,
Xiaolin
------------------------------------------------------------------
From:Nelson Chu <nelson@rivosinc.com>
Send Time:2023年2月21日(星期二) 09:28
To:郑孝林(云矅) <yunyao.zxl@alibaba-inc.com>
Cc:binutils <binutils@sourceware.org>
Subject:Re: RISC-V: Should the return value of print_insn_riscv() keep align with other platforms when read_memory_func() returns a non-zero value?
It used to be "status", but I accidentally changed it to "1" when
porting mapping symbols, so I just changed it back to what it was
before. Seems like it should be "-1", but not sure why it was
"status" for a long time ago.
Thanks
Nelson
On Mon, Feb 20, 2023 at 6:11 PM Xiaolin Zheng via Binutils
<binutils@sourceware.org> wrote:
>
> Hi, Binutils developers on the RISC-V backend:
> Hope this is the right place to send one email to the Binutils mailing list. We have met a small issue [1] in OpenJDK when using the `disassembler()` API in `dis-asm.h` to disassemble. In the RISC-V backend of Binutils, if `read_memory_func` returns a `status`, a non-zero value, after calling `memory_error_func` we will use the `status` variable as the final return value [2], which is different from other platforms that use a `-1` as return value [3] [4] [5] [6]. Although we could have some workaround for this on our side, the question is, should the behavior keep the same as on other platforms?
> Best Regards,
> Xiaolin
> [1] https://github.com/openjdk/jdk/pull/12551 <https://github.com/openjdk/jdk/pull/12551 >
> [2] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/riscv-dis.c#L940 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/riscv-dis.c#L940 >
> [3] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/aarch64-dis.c#L3792 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/aarch64-dis.c#L3792 >
> [4] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/ppc-dis.c#L872 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/ppc-dis.c#L872 >
> [5] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/s390-dis.c#L305 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/s390-dis.c#L305 >
> [6] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/i386-dis.c#L9466 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/i386-dis.c#L9466 >

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

* Re: RISC-V: Should the return value of print_insn_riscv() keep align with other platforms when read_memory_func() returns a non-zero value?
  2023-02-21  1:28 ` Nelson Chu
  2023-02-21  3:30   ` Xiaolin Zheng
@ 2023-03-01  9:09   ` Xiaolin Zheng
  1 sibling, 0 replies; 4+ messages in thread
From: Xiaolin Zheng @ 2023-03-01  9:09 UTC (permalink / raw)
  To: Nelson Chu; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 2633 bytes --]

I have filed a bug [1] for this issue. Hope this could get fixed :-)
Best,
Xiaolin
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=30184 <https://sourceware.org/bugzilla/show_bug.cgi?id=30184 >
------------------------------------------------------------------
From:Nelson Chu <nelson@rivosinc.com>
Send Time:2023年2月21日(星期二) 09:28
To:郑孝林(云矅) <yunyao.zxl@alibaba-inc.com>
Cc:binutils <binutils@sourceware.org>
Subject:Re: RISC-V: Should the return value of print_insn_riscv() keep align with other platforms when read_memory_func() returns a non-zero value?
It used to be "status", but I accidentally changed it to "1" when
porting mapping symbols, so I just changed it back to what it was
before. Seems like it should be "-1", but not sure why it was
"status" for a long time ago.
Thanks
Nelson
On Mon, Feb 20, 2023 at 6:11 PM Xiaolin Zheng via Binutils
<binutils@sourceware.org> wrote:
>
> Hi, Binutils developers on the RISC-V backend:
> Hope this is the right place to send one email to the Binutils mailing list. We have met a small issue [1] in OpenJDK when using the `disassembler()` API in `dis-asm.h` to disassemble. In the RISC-V backend of Binutils, if `read_memory_func` returns a `status`, a non-zero value, after calling `memory_error_func` we will use the `status` variable as the final return value [2], which is different from other platforms that use a `-1` as return value [3] [4] [5] [6]. Although we could have some workaround for this on our side, the question is, should the behavior keep the same as on other platforms?
> Best Regards,
> Xiaolin
> [1] https://github.com/openjdk/jdk/pull/12551 <https://github.com/openjdk/jdk/pull/12551 >
> [2] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/riscv-dis.c#L940 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/riscv-dis.c#L940 >
> [3] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/aarch64-dis.c#L3792 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/aarch64-dis.c#L3792 >
> [4] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/ppc-dis.c#L872 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/ppc-dis.c#L872 >
> [5] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/s390-dis.c#L305 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/s390-dis.c#L305 >
> [6] https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/i386-dis.c#L9466 <https://github.com/bminor/binutils-gdb/blob/binutils-2_38-branch/opcodes/i386-dis.c#L9466 >

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

end of thread, other threads:[~2023-03-01  9:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 10:10 RISC-V: Should the return value of print_insn_riscv() keep align with other platforms when read_memory_func() returns a non-zero value? Xiaolin Zheng
2023-02-21  1:28 ` Nelson Chu
2023-02-21  3:30   ` Xiaolin Zheng
2023-03-01  9:09   ` Xiaolin Zheng

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