[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] RISC-V: Restore the typcast to 64bit type
From: |
Andreas Schwab |
Subject: |
Re: [PATCH] RISC-V: Restore the typcast to 64bit type |
Date: |
Mon, 29 Mar 2021 12:24:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
On Mär 28 2021, Khem Raj wrote:
> this makes the type promotions clear and explicit
> It was already typecasted to long but was accidentally dropped in [1]
Note that long is 32-bit on riscv32, so the title is misleading (there
was no cast to 64-bit type before). The cast really was a no-op, as it
didn't change the resulting type. The issue is that the types of
sym_addr, target_section_addr and offset are Elf_Addr (aka Elf32_Addr),
which is an unsigned type (image_target->vaddr_offset is signed, but not
wider than Elf32_Addr, so it doesn't change the overall type). Thus
when the result of the expression is extended to grub_int64_t it is
always a positive value instead of the desired sign-extended one.
> which stated to cause failures on riscv32 as reported in [2]
Most likely the missing addend masked the error.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."