Sujet : Re: C23 thoughts and opinions
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 01. Jun 2024, 19:11:31
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240601211131.00001e16@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
User-Agent : Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
On Fri, 31 May 2024 19:03:10 +0100
bart <
bc@freeuk.com> wrote:
OK, thanks. But I forget to ask what results you got from running the
program. Because if I try your code, using hello.c and hello.exe as
test binary/source data, I get this output:
_binary_test_bi_start 00007ff6497620e0
140695771160800 _binary_test_bi_end
00007ff649762ae0 140695771163360 _binary_test_bi_size
00007ff509750a00 140690402380288 _binary_bin_to_list_c_start
00007ff649762ae0 140695771163360 _binary_bin_to_list_c_end
00007ff649762b26 140695771163430
_binary_bin_to_list_c_size 00007ff509750046
140690402377798
The sizes should have been 2560 and 70 respectively; those values are
bit bigger than that.
That's strange. I got expected results:
_binary_test_bi_start 000000013FDD30C0 5366427840
_binary_test_bi_end 000000013FDD67AC 5366441900
_binary_test_bi_size 00000000000036EC 14060
_binary_bin_to_list_c_start 000000013FDD67AC 5366441900
_binary_bin_to_list_c_end 000000013FDD711F 5366444319
_binary_bin_to_list_c_size 0000000000000973 2419
However I see that you also have start and end addresses, which
sounds a much better way of determining the size. (In that case, what
are those *size symbols for?).
>
I'd guess, *_size is here for the benefit of less smart compilers that
can not figure out that *_end - *_start is a connst expression
and can not compile code like:
static ptrdiff_t bar = _binary_test_bi_end - _binary_test_bi_start;
But that is just a guess. For better answer you can ask authors of
objcopy.