Sujet : Re: C23 thoughts and opinions
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 02. Jun 2024, 00:39:39
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3gbfr$30v15$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Mozilla Thunderbird
On 01/06/2024 23:11, Michael S wrote:
On Fri, 31 May 2024 22:15:54 +0100
bart <bc@freeuk.com> wrote:
If I run this:
>
printf("%p\n", &_binary_hello_c_start);
printf("%p\n", &_binary_hello_c_end);
printf("%p\n", &_binary_hello_c_size);
>
I get:
>
00007ff6ef252010
00007ff6ef252056
00007ff5af240046
>
I can see that the first two can be subtracted to give the sizes of
the data, which is 70 or 0x46. 0x46 is the last byte of the address
of _size, so what's happening there? What's with the crap in bits
16-47?
>
It looks like ASLR. I don't see it because I test on Win7.
I understand those are high-loading addresses. I was asking what they were doing as part of the size.
Apparently, that size value is wrongly relocated by some versions of gcc-ld. Since allocations work on 64KB blocks, that explains why the bottom 16 bits are unaffected.
So such a size value could still be used for objects up 64KB-1, but it sounds dodgy.