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] Do not build libsanitizer also for powerpc*-*-linux*


On Mon, Jun 2, 2014 at 8:56 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Jun 02, 2014 at 10:22:11AM +0400, Yury Gribov wrote:
>> Looks like now function does not return anything for ARM case? I'd
>> say we should replace this pc = ... with return like all other
>> cases, the code is just asking for trouble.
>
> But it should be
>   return (pc & ~(uptr)1) - 1;

Why the  -1 ? No ARM or Thumb instruction is 1 byte long. Instructions
are 4 bytes long if in ARM state and could be 2 or 4 bytes if Thumb
state.

regards
Ramana




> right?
>
>> --- libsanitizer/sanitizer_common/sanitizer_stacktrace.cc     (revision 209878)
>> +++ libsanitizer/sanitizer_common/sanitizer_stacktrace.cc     (revision 209879)
>> @@ -18,11 +18,13 @@
>>   namespace __sanitizer {
>>
>>   uptr StackTrace::GetPreviousInstructionPc(uptr pc) {
>> -#ifdef __arm__
>> +#if defined(__arm__)
>>     // Cancel Thumb bit.
>>     pc = pc & (~1);
>> -#endif
>> -#if defined(__sparc__)
>> +#elif defined(__powerpc__) || defined(__powerpc64__)
>> +  // PCs are always 4 byte aligned.
>> +  return pc - 4;
>> +#elif defined(__sparc__)
>>     return pc - 8;
>>   #else
>>     return pc - 1;
>
>         Jakub


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