[PATCH] llvm-cov: Support for big-endianness

Justin Bogner mail at justinbogner.com
Thu Dec 19 01:36:39 PST 2013


Yuchen Wu <yuchenericwu at hotmail.com> writes:
>> Yuchen Wu <yuchenericwu at hotmail.com> writes:
>>> llvm-cov has been modified to read gcov files produced from big-endian
>>> machines. In addition, the instrumentation had to be changed to
>>> produce endian-friendly data for reading.
>>
>> I don't get it. Why wouldn't you just make the file format have a
>> consistent byte order (ie, network byte order) if you want to share it
>> between machines? Is this awkward detection stuff what gcov does?
>
> Yes, gcov does manual byte-swapping. Are the ntohs, ntohl, etc. APIs
> portable across different platforms?

It seems odd that it'd do the byte swapping on the reader side, rather
than just writing something consistent. ntohs and friends have been
around since at least BSD 4.3 (around 1986) - they're available in
windows 95 and part of POSIX.1-2001. They should be okay.



More information about the llvm-commits mailing list