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