This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add __builtin_stack_top


On Tue, Aug 4, 2015 at 1:45 PM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> On Tue, Aug 04, 2015 at 01:00:32PM -0700, H.J. Lu wrote:
>> There is another issue with x86, maybe other targets.  You
>> can't get the real stack top when stack is realigned and
>> -maccumulate-outgoing-args isn't used since ix86_expand_prologue
>> will create and return another stack frame for
>> __builtin_frame_address and __builtin_return_address.
>> It will be wrong for __builtin_stack_top, which should
>> return the real stack address.
>
> That's why I asked:
>
>> >> > You might have a reason why you want the entry stack address instead of the
>> >> > frame address, but you didn't really explain I think?  Or I missed it.
>
> What would a C program do with this, that it cannot do with the frame
> address, that would be useful and cannot be much better done in straight
> assembler?  Do you actually want to expose the argument pointer, maybe?
>

Yes, we want to use the argument pointer as shown in testcases
included in my patch.


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]