On Fri, 2015-10-09 at 17:40 -0700, Josh Stone wrote: > Some systems don't have loff_t, like FreeBSD where off_t always supports > large files. We need a standardized 64-bit signed type for the public > header, without depending on configuration... OK, just use int64_t.
I note that this is a deliberate difference between the elfutils libelf interface and other libelf implementations, which use off_t in the public interface and don't have LFS support on 32bit systems. We were lucky enough to use off64_t, then loff_t, from the start, so we always support LFS as far as possible. I do think that the type should kept signed to not accidentally change any assumptions of programs using the current loff_t elements. So int64_t is a good choice. I don't really like that changing it to int64_t makes it less clear we are talking about offsets here. But I don't have a good suggestion what to do different. Maybe introduce a typedef int64_t elf_off_t? Or maybe detect we don't have loff_t and define it ourselves somehow? But that is not easy to do with the preprocessor. Keeping the sys/types.h include seems correct since we need some other types for the Elf_Arhdr struct. Cheers, Mark