This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 21 Nov 2013 19:29:51 +0100
- Subject: Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4YPE3kdoyZ6M8gwEk=iWiWOsJ8A4orp9qXQtE373+aH=g at mail dot gmail dot com> <20131119204344 dot GU21297 at msticlxl57 dot ims dot intel dot com> <CAFULd4Zd2ege7n2G6MCJDFV9UsNw2O7EcpZ1KoNpmb=sOVhXxg at mail dot gmail dot com> <20131120123259 dot GA53216 at msticlxl57 dot ims dot intel dot com> <CAFULd4ZpeFBnjScbwxdDQb9pQFwbgcQvt6FVKTX2RCnbrzcKNA at mail dot gmail dot com> <CAMbmDYbCoBfA5BVd3znR4k841daAxpqD7h1DjLMZejLjJghgZA at mail dot gmail dot com> <CAFULd4b-Fe4iiuaE9VKbRGRhj6Uf2vJhdJR1EjDvyw+LAViFyQ at mail dot gmail dot com> <CAMbmDYbEXRfZpkxki--zqjLRFtFqGwbxuwF1wPQO_WHyB-pZRQ at mail dot gmail dot com> <CAMbmDYb1TKywyOebhky++yv6nyHLFvuatDpy+vs3oQs8MnjzKw at mail dot gmail dot com>
On Wed, Nov 20, 2013 at 5:33 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>>> CM_MEDIUM has unlimited data size.
>>>
>>> i386-opts.h: CM_MEDIUM, /* Assumes code fits in the low 31
>>> bits; data unlimited. */
>>>
>>> The x86_64_zext_immediate_operand allows _address_ to be loaded by
>>> movl. The @SIZE reloc returns object size, which is unlimited and has
>>> no connection to its address. For CM_MEDIUM,
>>> x86_64_zext_immediate_operand allows:
>>>
>>> return (ix86_cmodel == CM_SMALL
>>> || (ix86_cmodel == CM_MEDIUM
>>> && !SYMBOL_REF_FAR_ADDR_P (op)));
>>
>> Yes, but large symbols never have SYMBOL_FLAG_FAR_ADDR set.
>
> Sorry, I mean all large symbols have this flag set.
This flag marks the fact that object size is bigger than
-mlarge-data-threshold and goes into large section. It is true that
UInt option argument currently overflows at 4G, and consequently all
sizes larger than 4G go to large sections, but IMO, we should not rely
on this. The specification says unlimited data size, so we have to be
prepared for this.
The reason I am against checking "Z" constraint is that "@SIZE"
relocation returns _size_ of the object (which is only remotely
connected to its address), while "Z" checks the address of the object.
So, it looks to me that this check would be conceptually wrong.
The right place to "fix" movabs is in a linker relaxation pass that
can check the real size and change movabs to movl if the size fits
32bits.
As a side note, perhaps generic option subsystem should reject
overflows as e.g. -mlarge-data-threshold=5368709120 when 32bit UInt is
used for option argument. The effects of overflow are surprising.
Uros.
- References:
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation
- Re: [PATCH, i386, MPX, 2/X] Pointers Checker [21/25] Size relocation