diff options
author | Nelson Chu <nelson@rivosinc.com> | 2022-10-27 09:39:13 +0800 |
---|---|---|
committer | Nelson Chu <nelson@rivosinc.com> | 2022-10-27 16:45:43 +0800 |
commit | f52fb009085e63da25eeacd39990ac6243ffed76 (patch) | |
tree | 9567e03c1468be0225b24ba0de92c8490156e410 /bfd | |
parent | ffbe89531c2e9bfd81a16241e1d17fff134fab9e (diff) | |
download | gdb-f52fb009085e63da25eeacd39990ac6243ffed76.zip gdb-f52fb009085e63da25eeacd39990ac6243ffed76.tar.gz gdb-f52fb009085e63da25eeacd39990ac6243ffed76.tar.bz2 |
RISC-V: Fix build failures for -Werror=sign-compare.
elfnn-riscv.c: In function ‘riscv_relax_resolve_delete_relocs’:
elfnn-riscv.c:4256:30: error: operand of ‘?:’ changes signedness from ‘int’ to ‘unsigned int’ due to unsignedness of other operand [-Werror=sign-compare]
So make the operands unsigned could resolve problem.
bfd/
* elfnn-riscv.c (riscv_relax_resolve_delete_relocs): Fixed build
failures for -Werror=sign-compare.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elfnn-riscv.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index cf85263..0570a97 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -4239,7 +4239,10 @@ riscv_relax_resolve_delete_relocs (bfd *abfd, rel_next = relocs + i; if (ELFNN_R_TYPE ((rel_next)->r_info) == R_RISCV_DELETE && (rel_next)->r_offset > rel->r_offset) - break; + { + BFD_ASSERT (rel_next - rel > 0); + break; + } else rel_next = NULL; } @@ -4253,7 +4256,8 @@ riscv_relax_resolve_delete_relocs (bfd *abfd, rel->r_info = ELFNN_R_INFO (0, R_RISCV_NONE); /* Skip ahead to the next delete reloc. */ - i = rel_next != NULL ? rel_next - relocs - 1 : sec->reloc_count; + i = rel_next != NULL ? (unsigned int) (rel_next - relocs - 1) + : sec->reloc_count; } return true; |