[PATCH] readelf: use fseeko for elf files >= 2 GiB on x86_64-mingw32

Jan Beulich jbeulich@suse.com
Mon Nov 14 15:30:22 GMT 2022


On 14.11.2022 16:03, Brett Werling via Binutils wrote:
> Switch all fseek calls to fseeko and cast the given offset as an off_t
> accordingly. When building readelf for x86_64-mingw32, a long will only
> be 32 bits wide. If the elf file in question is >= 2 GiB, that is
> greater than the max long value, and therefore fseek will fail
> indicating that the offset is negative.
> 
> To work around this and support up to 4 GiB, we switch to using fseeko
> and cast the unsigned long offsets as off_t values because the size of
> off_t is 64 bits on x86_64-mingw32.

Is fseeko() uniformly available on all platforms binutils can be built
for? I'm afraid the answer is no, so at least you'd need to introduce
some configure logic for this plus some abstraction.

Jan



More information about the Binutils mailing list