readlink -f still segfaults

Rob Landley rob at landley.net
Sun May 7 14:08:14 PDT 2006


On Sunday 07 May 2006 1:58 am, Rich Felker wrote:
> > > > Hmmm...  Sounds like we're getting into platform.c territory.  The
> > > > bb_strlen() thing really should be in libbb/platform.c rather than
> > > > xfuncs.c because substituting our own strlen() function to force
> > > > uninlining is a workaround for a broken compiler that can't be told
> > > > _NOT_ to inline something that's used over 500 times in the code.
> > >
> > > Can't be told not to? Did you ever rtfm -fno-builtin? :)
> >
> > Did you miss the part where I said I tested it back under gcc 3.2, and it
> > didn't work?
>
> Apparently so. What happens?

It was essentially ignored.  An #ifdef in the header file was still 
substituting the builtin even when I told gcc to stop it, but it looks like 
that got fixed when I upgraded Ubuntu from unnecessary adjective hedgehog to 
unnecessary adjective badger.  If -fno-builtin-strlen actually works in gcc 
4.x, I propose removing bb_strlen() entirely.  Let's see...  Yup.

I just checked in svn 15023 cleaning it out.  The results are actually 
somewhat confusing, though.  The net result is slightly smaller, but it's a 
"gained here, lost here" sort of thing.  

I've attached the output of make bloatcheck on the before and after versions.  
The top ten that grew (sendCgi through cmdedit_read_input) may actually 
benefit enough from the old optimization that selectively putting it back 
could be worth the complexity.  But I'd want to understand _why_, first.  
(What are sendCgi and parse_conf _doing_ that confuses the optimizer so?)

I wrote the #3 function that grows due to this change(parse_mount_options), 
and the chunk that's impacted is this:

            // Add it to strflags, to pass on to kernel
            i = *unrecognized ? strlen(*unrecognized) : 0;
            *unrecognized = xrealloc(*unrecognized, i+strlen(options)+2);

That grew 16 bytes.  I have _no_idea_ why.  The optimizer is doing something 
different.  I dunno what.  Rummage...

I just added a scripts/showasm to try to see what the difference is, and it 
works but I see I have to make it do _math_ to adjust the symbol offsets so I 
can diff the result easily.  Which means a noticeably more complicated 
script.  Sigh.  It'd be nice of objdump worked, but I don't patch FSF code 
because you have to sign away your copyrights in order to get the patch 
accepted.  On paper.  Via us mail.  Ain't happening...

Rob

P.S.  In case you were wondering why I have so many half-finished projects in 
my tree?  It's really easy to go down ratholes, it's a full time job just 
following up on this sort of thing.  Speaking of which, where did I leave off 
on friday...
-- 
Never bet against the cheap plastic solution.
-------------- next part --------------
add/remove: 0/1 grow/shrink: 85/48 up/down: 373/-405 (-32)
function                                     old     new   delta
sendCgi                                     1817    1859     +42
parse_conf                                  1316    1343     +27
parse_mount_options                          182     198     +16
evaluate                                    5722    5738     +16
add_cmd                                     1246    1261     +15
getoptscmd                                   702     716     +14
nexpr                                        634     647     +13
all_control_list                             111     124     +13
busy_loop                                   3275    3287     +12
cmdedit_read_input                          3840    3851     +11
fdisk_main                                  3642    3651      +9
sulogin_main                                 702     709      +7
showfiles                                   1472    1479      +7
passwd_main                                 2372    2379      +7
input_tab                                   3207    3214      +7
gzip_main                                    900     907      +7
bb_dump_dump                                2761    2768      +7
obscure                                      389     395      +6
wget_main                                   3246    3251      +5
message                                     1255    1260      +5
inetd_main                                  2202    2207      +5
include_conf                                 936     941      +5
hash_find                                    247     252      +5
builtin_read                                 377     382      +5
run_package_script                            97     101      +4
loop_through_files                           129     133      +4
data_extract_all_prefix                      108     112      +4
unpack_package                               597     600      +3
print_addrinfo                              1419    1422      +3
ifupdown_main                               2553    2556      +3
fakeidentd_main                             1549    1552      +3
execute                                     2359    2362      +3
builtin_export                               370     373      +3
basename_main                                104     107      +3
syslogd_main                                1297    1299      +2
sysctl_write_setting                         366     368      +2
sysctl_read_setting                          298     300      +2
setops                                        83      85      +2
set_tainted                                  154     156      +2
prs                                           28      30      +2
process_regex_on_line                        232     234      +2
printenv_main                                146     148      +2
patch_main                                  1160    1162      +2
logMessage                                   393     395      +2
length_main                                   48      50      +2
iproute_list_or_flush                       1632    1634      +2
getopt_main                                  747     749      +2
examine_file                                 115     117      +2
dwrite_str                                    26      28      +2
doset                                        300     302      +2
daytime_stream                                78      80      +2
daytime_dg                                   150     152      +2
cut_file                                     674     676      +2
correct_password                             158     160      +2
comm_main                                    570     572      +2
checkPerm                                    350     352      +2
awk_sub                                      657     659      +2
vconfig_main                                 290     291      +1
unlzma_main                                  216     217      +1
sysctl_display_all                           178     179      +1
string_insert                                 85      86      +1
sstrdup                                       34      35      +1
sed_main                                     702     703      +1
run                                         1520    1521      +1
replyError                                    69      70      +1
readit                                       396     397      +1
place_cursor                                 264     265      +1
normalize                                    224     225      +1
nfsmount                                    4222    4223      +1
ncv_strcmp                                   110     111      +1
nameval                                      196     197      +1
matches                                       55      56      +1
makedevs_main                               1313    1314      +1
make_string                                  135     136      +1
logger_main                                  495     496      +1
list_table                                  1928    1929      +1
less_main                                   2287    2288      +1
insmod_main                                 4258    4259      +1
inetd_setproctitle                           174     175      +1
httpd_main                                  1026    1027      +1
do_sethostname                               140     141      +1
bunzip2_main                                 235     236      +1
awk_split                                    466     467      +1
add_quote_for_spec_chars                      91      92      +1
add_ksymoops_symbols                         489     490      +1
version_compare_part                         391     390      -1
setlocalenv                                  177     176      -1
psbs                                          87      86      -1
process_files                               2070    2069      -1
print_status                                 278     277      -1
obj_string_patch                             140     139      -1
obj_load_order_prio                           97      96      -1
nameif_main                                  637     636      -1
ipaddr_modify                               1403    1402      -1
get_dir                                      227     226      -1
generate_output                              353     352      -1
find_dev                                     142     141      -1
fgets_str                                    146     145      -1
username_tab_completion                      209     207      -2
set_status                                   301     299      -2
make_device                                 1129    1127      -2
getty_main                                  2679    2677      -2
get_one_char                                 164     162      -2
fill_package_struct                          381     379      -2
cmdputs                                      397     395      -2
writeFileToTarball                          1473    1470      -3
show_status_line                             476     473      -3
read_int                                     656     653      -3
parsefname                                   233     230      -3
human_time                                    41      38      -3
cut_main                                     649     646      -3
config                                      1631    1628      -3
regex_process                                499     495      -4
redirect                                    1023    1019      -4
unzip_main                                  1741    1736      -5
snprint_ip_port                              236     231      -5
init_main                                   1127    1122      -5
dnsd_main                                   1873    1868      -5
string_checker                               120     114      -6
bselect                                     2463    2457      -6
arping_main                                 2081    2075      -6
sgi_check_bootfile                            98      91      -7
lsmod_main                                   455     448      -7
hash_remove                                  105      89     -16
extract_filename                              80      62     -18
bb_strlen                                     20       -     -20
awk_printf                                   470     450     -20
do_cmd                                      8939    8918     -21
diff_main                                   1023     998     -25
calcsize                                     156     128     -28
fuser_main                                  1643    1612     -31
eval6                                        681     650     -31
ParseField                                   543     507     -36
progressmeter                               1183    1132     -51


More information about the busybox mailing list