add bb_info_msg was Re: Applets send errors to syslog during normal, successful operation

Michael Conrad mconrad at intellitree.com
Wed Mar 7 03:49:58 UTC 2018


On 3/5/2018 5:11 PM, Deweloper wrote:
>> Hi,
>> I see your point, forget about this bb_info_msg stuff.
>> The same result can still be achieved by using:
>>
>> syslog_level = LOG_INFO
>> bb_error_msg(...)
>> syslog_level = LOG_ERR
>>
>> if needed
> If I interpret bloatcheck results properly, the above costs extra
> 45 B of code per call @x86-64.

That sounded suspicious, so I checked.  Might be worthwhile 
investigating what gcc was up to, because assigning a small constant to 
a global should be 7 bytes each on x86-64

However, pushing a small constant onto the stack should be 2 bytes, 
though ironically loading that small constant into a register for 
pass-by-register calling convention is 5.

So, with enough calls it would be worth it to create a new function, 
with a savings of about 9 bytes per use over the global variable trick 
vs. the cost of adding the new function.

(and wow, there's a nutty size optimization ... you could push a 1-byte 
constant onto the stack and pop it off into the register of your choice 
with two fewer bytes than the instruction to assign the constant 
directly to the register.)

-Mike

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20180306/e912a4a9/attachment.html>


More information about the busybox mailing list