This is the mail archive of the
mailing list for the GCC project.
Re: Builtin: stack pointer
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Renato Golin <renato dot golin at linaro dot org>
- Cc: Andreas Schwab <schwab at suse dot de>, gcc <gcc at gcc dot gnu dot org>, "Compiling the Linux Kernel with Clang/LLVM" <llvmlinux at lists dot linuxfoundation dot org>
- Date: Thu, 27 Mar 2014 03:47:32 -0700
- Subject: Re: Builtin: stack pointer
- Authentication-results: sourceware.org; auth=none
- References: <CAMSE1kc3FJOq+mh=AD-FQhrGW+aVpVkWFdhfHCM+c=ZgN6Kpug at mail dot gmail dot com> <mvm61n0j6h6 dot fsf at hawking dot suse dot de> <CAMSE1kdyg5VaVTiNJ0t=+5Epstb=vPf48f_YBzM5KrQtan8MYQ at mail dot gmail dot com> <CA+=Sn1kSVpsNvng-=y6ovm85g311xzVtgpvgAiEHuw-RnrZr3g at mail dot gmail dot com>
On Thu, Mar 27, 2014 at 3:44 AM, Andrew Pinski <email@example.com> wrote:
> On Thu, Mar 27, 2014 at 3:25 AM, Renato Golin <firstname.lastname@example.org> wrote:
>> On 27 March 2014 10:12, Andreas Schwab <email@example.com> wrote:
>>> Can't you use __builtin_frame_address (0) instead?
>> That would give me the frame pointer, not the stack pointer, and the
>> user would have to calculate manually the offset to get the actual
>> stack pointer, which would be target-specific, possibly making it even
>> worse. Is that what you meant?
> So if we audit what the kernel uses this method. There is stack
> tracing code which is highly target dependent.
> And then there is current_thread_info which is also highly target
> dependent code (though it can use __builtin_frame_address(0) there
> since it is doing an alignment of a huge value at that point).
> I don't see why there needs to be an builtin function for this case,
> adding one extra instruction inside an inline-asm for the moving from
> the stack point to a normal register should be good enough.
> Take arch/arm64/include/asm/thread_info.h for an example,
> __builtin_frame_address(0) should be good enough since the sp and fp
> should be on the same page (that is what THREAD_SIZE is about).
>> (so you need to split by arch with ifdefs),
> Except it is already in the kernel anyways; not even by ifdefs but by
> different files so the reasoning adding a new builtin is not useful.
Please don't add a close list to the CC of GCC lists it is annoying.
---------- Forwarded message ----------
Date: Thu, Mar 27, 2014 at 3:44 AM
Subject: Your message to LLVMLinux awaits moderator approval
Your mail to 'LLVMLinux' with the subject
Re: Builtin: stack pointer
Is being held until the list moderator can review it for approval.
The reason it is being held:
Post by non-member to a members-only list
Either the message will get posted to the list, or you will receive
notification of the moderator's decision. If you would like to cancel
this posting, please visit the following URL:
> Andrew Pinski