Hey Laurent,
> So, since bb_msg_memory_exhausted is constant, the printf part of
> bb_error_msg_and_die(bb_msg_memory_exhausted);
> is correctly optimized into
> fputs(bb_msg_memory_exhausted, stdout);
> whereas
> bb_error_msg_and_die("%s", bb_msg_memory_exhausted);
> uses the full printf() call - which behaves correctly, but is
> suboptimal.
I'm sorry, but I don't see a printf() call in the
bb_error_msg_and_die-function in the objdump of verror_msg.c.
Here the relevant part of the disassembly:
Disassembly of section .text.bb_error_msg_and_die:
0000000000000000 <bb_error_msg_and_die>:
0: 48 81 ec e8 00 00 00 sub $0xe8,%rsp
7: 48 89 74 24 38 mov %rsi,0x38(%rsp)
c: 48 89 54 24 40 mov %rdx,0x40(%rsp)
11: 48 89 4c 24 48 mov %rcx,0x48(%rsp)
16: 4c 89 44 24 50 mov %r8,0x50(%rsp)
1b: 4c 89 4c 24 58 mov %r9,0x58(%rsp)
20: 84 c0 test %al,%al
22: 74 3a je 5e <bb_error_msg_and_die+0x5e>
24: 0f 29 44 24 60 movaps %xmm0,0x60(%rsp)
29: 0f 29 4c 24 70 movaps %xmm1,0x70(%rsp)
2e: 0f 29 94 24 80 00 00 movaps %xmm2,0x80(%rsp)
35: 00
36: 0f 29 9c 24 90 00 00 movaps %xmm3,0x90(%rsp)
3d: 00
3e: 0f 29 a4 24 a0 00 00 movaps %xmm4,0xa0(%rsp)
45: 00
46: 0f 29 ac 24 b0 00 00 movaps %xmm5,0xb0(%rsp)
4d: 00
4e: 0f 29 b4 24 c0 00 00 movaps %xmm6,0xc0(%rsp)
55: 00
56: 0f 29 bc 24 d0 00 00 movaps %xmm7,0xd0(%rsp)
5d: 00
5e: 48 89 7c 24 08 mov %rdi,0x8(%rsp)
63: c7 44 24 18 08 00 00 movl $0x8,0x18(%rsp)
6a: 00
6b: c7 44 24 1c 30 00 00 movl $0x30,0x1c(%rsp)
72: 00
73: 48 8d 84 24 f0 00 00 lea 0xf0(%rsp),%rax
7a: 00
7b: 48 89 44 24 20 mov %rax,0x20(%rsp)
80: 48 8d 44 24 30 lea 0x30(%rsp),%rax
85: 48 89 44 24 28 mov %rax,0x28(%rsp)
8a: 48 8d 4c 24 18 lea 0x18(%rsp),%rcx
8f: 48 8b 44 24 08 mov 0x8(%rsp),%rax
94: ba 00 00 00 00 mov $0x0,%edx
99: 48 89 ce mov %rcx,%rsi
9c: 48 89 c7 mov %rax,%rdi
9f: e8 00 00 00 00 callq a4 <bb_error_msg_and_die+0xa4>
a0: R_X86_64_PC32 bb_verror_msg-0x4
a4: e8 00 00 00 00 callq a9 <bb_error_msg_and_die+0xa9>
a5: R_X86_64_PC32 xfunc_die-0x4
There is no puts() call and no printf() call. So where should it be
optimized? Maybe I overlooked it.
I'm okay with the printf() calls in other parts of the code and I
could reproduce the optimization where a printf() call is actually in
the code.
Greets,
Manuel
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox