ctfconvert should be able to unconditionally attempt conversion
On OmniOS and OpenIndiana, the
bash shell is linked with
-z redlocsym, a flag which eliminates local symbols from the symbol table.
This reduces the size of the
.symtab section pretty significantly (see 1 below) but causes
ctfconvert to refuse to process the file.
% /opt/onbld/bin/i386/ctfconvert -o /dev/null tmp/src/bash ctfconvert: CTF conversion failed: No C source to convert from
This is because
ctfconvert scans the string table looking for
DTT_file entries where the name ends in
.c and, if it does not find any, it concludes that the file was not built from any C sources.
ctfconvert does have an
-i option which should allow conversion but it currently just exits with a success status when no
.c file entries are found in the string table.
With -z redlocsym:
bloody:omnios.bloody:ctf% greadelf -p 26 /bin/bash | fgrep .c
bloody:omnios.bloody:ctf% greadelf -p 26 tmp/pkg/usr/bin/bash | fgrep .c [ 13a] common-crt.c [ 147] crtp.c [ 155] values-Xa.c [ 161] values-xpg6.c [ 16f] crtstuff.c [ 210] shell.c [ 39a] timeval.c [ 3b1] y.tab.c [ 6db] parse_comsub.constprop.0 [ 71a] parse_arith_cmd.constprop.0 [ 886] general.c [ 985] make_cmd.c ... elided ...
bloody:omnios.bloody:ctf% elfdump -c -N .symtab /bin/bash Section Header: sh_name: .symtab sh_addr: 0 sh_flags: 0 sh_size: 0xb808 sh_type: [ SHT_SYMTAB ] sh_offset: 0xd2d40 sh_entsize: 0x18 (1963 entries) sh_link: 26 sh_info: 34 sh_addralign: 0x8
bloody:omnios.bloody:ctf% elfdump -c -N .symtab tmp/pkg/usr/bin/bash Section Header: sh_name: .symtab sh_addr: 0 sh_flags: 0 sh_size: 0x11850 sh_type: [ SHT_SYMTAB ] sh_offset: 0xdc900 sh_entsize: 0x18 (2990 entries) sh_link: 26 sh_info: 1059 sh_addralign: 0x8
Updated by Andy Fiddaman about 1 year ago
Using the new
-f option successfully converts the
bash binary linked with reduced local symbols:
build:illumos:ig_ctf% /opt/onbld/bin/i386/ctfconvert -o /dev/null ~/ctf/bash ctfconvert: CTF conversion failed: No C source to convert from build:illumos:ig_ctf% ctfconvert -f -o p ~/ctf/bash build:illumos:ig_ctf% ctfdump -S p ctfdump: failed to dump labels: File does not contain any labels - CTF Statistics ---------------------------------------------------------------- total number of data objects = 511 total number of functions = 1114 total number of function arguments = 1540 maximum argument list length = 7 average argument list length = 1.38 total number of types = 637 total number of integers = 9 total number of floats = 1 total number of pointers = 182 total number of arrays = 67 total number of func types = 33 total number of structs = 126 total number of unions = 13 total number of enums = 7 total number of forward tags = 3 total number of typedefs = 174 total number of volatile types = 3 total number of const types = 19 total number of restrict types = 0 total number of unknowns (holes) = 0 total number of struct members = 538 maximum number of struct members = 19 total size of all structs = 12532 maximum size of a struct = 8192 average number of struct members = 4.27 average size of a struct = 99.46 total number of union members = 50 maximum number of union members = 14 total size of all unions = 384 maximum size of a union = 14 average number of union members = 3.85 average size of a union = 29.54 total number of enum members = 66 maximum number of enum members = 20 average number of enum members = 9.43 total number of strings = 1193 bytes of string data = 9092 maximum string length = 28 average string length = 7.62
I've also done a full
wsdiff between gate and this branch and the only differences to CTF data were in the files touched here.
Updated by Electric Monk about 1 year ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
commit 73197b540cc5f0434c409b68ca9e1a514a6ce91b Author: Andy Fiddaman <email@example.com> Date: 2020-12-17T21:18:28.000Z 13336 ctfconvert should be able to unconditionally attempt conversion Reviewed by: Robert Mustacchi <firstname.lastname@example.org> Approved by: Rich Lowe <email@example.com>