This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [x86-64 psABI] RFC: Extend x86-64 PLT entry to support MPX
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>, GCC Development <gcc at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>, "Girkar, Milind" <milind dot girkar at intel dot com>, "Kreitzer, David L" <david dot l dot kreitzer at intel dot com>
- Date: Mon, 7 Oct 2013 14:00:41 +0400
- Subject: Re: [x86-64 psABI] RFC: Extend x86-64 PLT entry to support MPX
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOp=1v38F_aV-pbv50YOGSEr_ju+byZP1L_G_h4bm5Ad3w at mail dot gmail dot com> <20130814154948 dot GR1814 at tucnak dot redhat dot com> <CAMe9rOp8V+V_iBWdu=wQRs-hWmTKvhEHqy_SnGzeMB0sPP2wzQ at mail dot gmail dot com> <CAMbmDYaU=vTGKne63Ji-Em2D8tyJaRUOix1B33vN4D-kTPqqaw at mail dot gmail dot com> <20131001122740 dot GB30970 at tucnak dot zalov dot cz> <CAMbmDYYvSA3cUo21+gp07E3AAFAAmUYJWZjDcWzyAVHVQpCrtQ at mail dot gmail dot com> <CAMbmDYaU1y8Wn1A+e-VY6V5-xFzF4c1-ueMt5WReEL3_EMcBOQ at mail dot gmail dot com> <20131007094727 dot GI30970 at tucnak dot zalov dot cz>
2013/10/7 Jakub Jelinek <jakub@redhat.com>:
> On Mon, Oct 07, 2013 at 01:31:29PM +0400, Ilya Enkovich wrote:
>> Seems assembler may not always detect MPX relocation. For simple calls
>> it may check for 'bnd' prefix, but for indirect call we need to
>> generate MPX relocation for 'mov' instruction storing address of the
>> called function. This instruction does not have any prefix and
>> therefore compiler has to specify relocation by itself.
>
> Ugh, not only mov I guess.
> You can easily have:
>
> int *fn1 (int *, int *);
> int *fn2 (int *, int *);
> typedef int (*fnt) (int *, int *);
> fnt fns[2] = { fn1, fn2 };
>
> So perhaps we need some directive that will say that all the relocations
> that could be used to refer to PLT slots need to be turned into
> corresponding MPX relocations? Or assembler switch.
Compiler can always make a decision knowing whether MPX code is
generated in current module or not. I think in this and all other
similar cases compiler should use something like @mpx or @mpxplt and
assembler would generate proper relocation then. For your example it
would look like:
fns:
.quad fn1@mpx
.quad fn2@mpx
And if we introduce new relocation in compiler then we also may use
them for mpx calls/jumps. Support in assembler would be quite simple
then, without a necessity to make a decision when to use MPX
relocation.
Ilya
>
> Jakub