diff options
author | gonzo <gonzo@FreeBSD.org> | 2012-03-24 01:47:33 +0000 |
---|---|---|
committer | gonzo <gonzo@FreeBSD.org> | 2012-03-24 01:47:33 +0000 |
commit | 58eb4eb2a1f6de2f39cfa02526945469e41fd4bc (patch) | |
tree | bba18b626b83a0cdc8aec22e05e2f67513f64bcd /cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h | |
parent | f53c9505e0055cd6039308597b82ec8005568266 (diff) | |
download | FreeBSD-src-58eb4eb2a1f6de2f39cfa02526945469e41fd4bc.zip FreeBSD-src-58eb4eb2a1f6de2f39cfa02526945469e41fd4bc.tar.gz |
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.
Diffstat (limited to 'cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h')
-rw-r--r-- | cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h b/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h index 52bbf44..93a540d 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h @@ -391,6 +391,7 @@ void merge_into_master(tdata_t *, tdata_t *, tdata_t *, int); #define CTF_USE_DYNSYM 0x2 /* use .dynsym not .symtab */ #define CTF_COMPRESS 0x4 /* compress CTF output */ #define CTF_KEEP_STABS 0x8 /* keep .stabs sections */ +#define CTF_SWAP_BYTES 0x10 /* target byte order is different from host */ void write_ctf(tdata_t *, const char *, const char *, int); |