| Solaris |
|
|
There are 3 basic CTF related tools. ctfmerge, ctfconvert and ctfstabs. Source is found under usr/src/tools/ctf. The PowerPC community initial build environment had empty ctf binaries that just allowed the make of uts to complete. Note that ctfmerge, ctfstabs and ctfconvert are located in /opt/onbld/bin/ppc on your build machine. We are now at the point of building the tools successfully but things as you can guess are just not that easy.
The ctf tools are shell scripts at the moment which either run the actual ctf tool or exits doing essentially nothing. CTF_TEST is an environmental variable that needs to be set if you want to use the actual bins. CTF_TEST=1, export CTF_TEST in a bash shell.
Brian has had to revert to the 2.6 way of building genassym.c and assym.h, basically the defines are called out in gennassym.c not built from the CTF files. From this genassym.c that is hand assembled, we use the GCC cross compiler to generate a \*.s file for the correct PPC aligned objects (data offsets). Then we take the \*.s file and use grep to fix up the slight differences and the revised \*.s file is linked using the x86 linker. Take a look at the Makefile in /uts/chrp/genassym.
If you want to add structure offsets edit uts/chrp/ml/structs.c, do not edit the structs.h file. If you want to add general defines put them in uts/chrp/ml/genassym.c, it's fairly straighforward. Now here is where we are for the development aspect. Note there are 2 ctf scripts. The default is to use to
/opt/onbld/bin/ppc/ctfstabs.1
/opt/onbld/bin/ppc/ctfconvert.1
/opt/onbld/bin/ppc/ctfconvert
/opt/onbld/bin/ppc/ctfstabs
/opt/onbld/bin/ppc/ctfmerge.1
/opt/onbld/bin/ppc/ctfmerge
/opt/onbld/bin/ppc/ctfconvert.ksh
The ksh script has been created to replace original PowerPC community (aka polaris) /opt/onbld/bin/ppc/ctfconvert. It is used to allow development to test CTF utils w/o conflicting with the build environment on a host system. When you build CTF from it's sources ctfconvert is renamed ctfconvert.1 and copied into /opt/onbld/bin/ppc/ we set an external environmental variable CTF_TEST=1 to run actual bin and then test it
if [ "$CTF_TEST" = 1 ]
then
/opt/onbld/bin/ppc/ctfconvert.1 $*
exit 0
else
echo "ctfconvert is a non-operational dummy script!" 1>&2
exit 0
fi
We are currently stuck with the fact that ctfstabs / libctf has been written with only a native host and target in mind. However we need a cross development environment for the long term. Why you may ask... because the true embedded development requires them. Take a look at Linux on PPC, cross development is the only way. All of the work we do here on a cross development system is not throw away either.
So the cross development of libctf is somewhat stalled on the libc availability and the fact that the elf file processing is was coded without leveraging general elf routines to deal with the endian and byte swapping issue. It appears we will have to recode using the std elf library calls in libelf. We have shelved this for the moment to focus on other items, but this will soon come to the forefront once again.
John Levon's Blog entry gives a nice operational overview of how the ctf utils interact with genoffsets and genassym to produce the output on a native machine.
CTF (Compact C Type Format) encapsulates a reduced form of debugging information similar to DWARF and the venerable stabs. It describes types (structures, unions, typedefs etc.) and function prototypes, and is carefully designed to take a minimum of space in the ELF binaries. The kernel binaries that Sun ship have this data embedded as an ELF section (.SUNW_ctf) so that tools like mdb and dtrace can understand types. Of course, it would have been possible to use existing formats such as DWARF, but they typically have a large space overhead and are more difficult to process.
The CTF data is built from the existing stabs/DWARF data generated by the compiler's -g option, and replaces this existing debugging information in the output binary (ctfconvert performs this job).
/*
Another overview is the following
usr/src/tools/ctf/cvt/ctfmerge.c
Terms of Use
|
Privacy
|
Trademarks
|
Copyright Policy
|
Site Guidelines
|
Site Map
|
Help
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Use.
© 2012, Oracle Corporation and/or its affiliates.