Path: ...!news.misty.com!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S Newsgroups: comp.lang.c Subject: Re: C23 thoughts and opinions Date: Sat, 1 Jun 2024 21:11:31 +0300 Organization: A noiseless patient Spider Lines: 48 Message-ID: <20240601211131.00001e16@yahoo.com> References: <87y18047jk.fsf@nosuchdomain.example.com> <87msoe1xxo.fsf@nosuchdomain.example.com> <87ikz11osy.fsf@nosuchdomain.example.com> <20240530170836.00005fa0@yahoo.com> <20240530180345.00003d9f@yahoo.com> <20240531161937.000063af@yahoo.com> <20240531162811.00006719@yahoo.com> <20240531164835.00007128@yahoo.com> <20240531173437.00003bee@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Sat, 01 Jun 2024 20:11:37 +0200 (CEST) Injection-Info: dont-email.me; posting-host="9a5c35e12e7b0adefaf4f1c5da3c5308"; logging-data="3046401"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PfDLdL4diBTZJaM0A5/ZEJmtLhu/+M08=" Cancel-Lock: sha1:8YYQHQ5IdGEf8cnc4Leb887d7bQ= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32) Bytes: 3689 On Fri, 31 May 2024 19:03:10 +0100 bart 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.