freebsd-skq/cddl/contrib/opensolaris/tools/ctf
Oleksandr Tymoshenko a6425ab52d Maintain target's byte order for multi-byte fields in CTF structures.
CTF format is not cross-platform by design, e.g. it is not guaranteed
that data generated by ctfconvert/ctfmerge on one architecture will
be successfuly read on another. CTF structures are saved/restored
using naive approach. Roughly it looks like:
	write(fd, &ctf_struct, sizeof(ctf_struct))
	read(fd, &ctf_struct, sizeof(ctf_struct))

By sheer luck memory layout of all type-related CTF structures is the same
on amd64/i386/mips32/mips64. It's different on ARM though. sparc, ia64,
powerpc, and powerpc64 were not tested. So in order to get file compatible
with dtrace on ARM it should be compiled on ARM. Alternative solution would
be to have "signatures" for every platform and ctfmerge should convert host's
reperesentation of CTF structure to target's one using "signature" as template.

This patch checks byte order of ELF files used for generating CTF record
and makes sure that byte order of data written to resulting files is the same
as target's byte order.
2012-03-24 01:47:33 +00:00
..
common A lot of changes to make this code compile cleanly on FreeBSD. 2008-04-26 04:01:35 +00:00
cvt Maintain target's byte order for multi-byte fields in CTF structures. 2012-03-24 01:47:33 +00:00
dump Make this file compile cleanly. 2008-04-26 03:54:23 +00:00