NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: gprof SEGV issue for GCC-4.5.X toolchain.



Dear Thomas,

Thanks for your valuable information.
I was not aware about the fact that NetBSD doesnt use EABI for ARM.

But currently I am trying to support NetBSD for ARM cortex
(ARMv7a/thumb2) using the latest gnu compiler i.e. GCC-4.5.
Since it supports all the versions of cortex and I have to use NetBSD
library on cortex board.
I have ported NetBSD library successfully by compiling it with GCC-4.5
but now I wanted to do
profiling. So, as per my investigation and suggested fix in NetBSD I
am able to perform profiling too.

My patch may be useful when NetBSD plans to use EABI for ARM.

Thank You,
Amol Pise


On Tue, Jun 28, 2011 at 12:23 AM, Matt Thomas <matt%3am-software.com@localhost> 
wrote:
>
> On Jun 27, 2011, at 2:56 AM, amol pise wrote:
>
>> Dear All,
>>
>> I have build the NetBSD-5.1 library by compiling it for ARMv7a (Cortex
>> architecture)
>> using the GNU GCC-4.5 toolchain.
>>
>> Now when I tried to build a sample scenario "hello.c" with profiling
>> options "-pg" for gprof analysis.
>> Now the new implementation uses "__gnu_mcount_nc".
>> So the solution to resolve this issue is to add this new profiling
>> hook "__gnu_mcount_nc" into NetBSD library.
>
> Well, first of all, NetBSD doesn't use EABI.  That ABI derives from bpabi.h 
> which isn't used by arm*-*-netbsdelf*.  So you've built the wrong compiler to 
> use with NetBSD.
>
> The profile ABI changed significantly for bpabi.  In fact, NetBSD has its own 
> version of the profil call:
>
> /* NetBSD does its profiling differently to the Acorn compiler. We
>   don't need a word following the mcount call; and to skip it
>   requires either an assembly stub or use of fomit-frame-pointer when
>   compiling the profiling functions.  Since we break Acorn CC
>   compatibility below a little more won't hurt.  */
>
> #undef  ARM_FUNCTION_PROFILER
> #define ARM_FUNCTION_PROFILER(STREAM,LABELNO)                               \
> {                                                                           \
>  fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
>  fprintf(STREAM, "\tbl\tmcount\n");                                        \
> }
>
>
>


Home | Main Index | Thread Index | Old Index