This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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] Fix the glibc profiling issue on arm-unknown-linux-gnueabi.


Hi Joseph,

>>  /* If compiled for profiling, call `mcount' at the start of each function.  */
>>  #ifdef PROF
>> +#if __GNUC_PREREQ(4,4)
>
> I think the condition should also include defined(__ARM_EABI__), since
> this is specific to EABI, though old-ABI is no longer maintained.
>

I think the move from old-ABI to EABI, for ARM was done in GCC 4.4 release.
As you have rightly pointed out that the old-ABI is no longer maintained,
hence I considered to check for GCC 4.4 which doesn't generate old APCS
frames. This GCC version also requires glibc 2.8 for __gnu_mcount_nc
implementation. So this patch checks for GCC version which conforms to
EABI and requires glibc 2.8 or later so as to support the GCC with the
implementation.

Considering your point and the change being the old-ABI-> EABI, I modified
the patch to
{{{
--- a/glibc-ports-2.11/sysdeps/arm/sysdep.h     2011-01-28
12:09:15.000000000 +0530
+++ b/glibc-ports-2.11/sysdeps/arm/sysdep.h     2011-01-28
12:13:46.000000000 +0530
@@ -89,10 +89,16 @@

 /* If compiled for profiling, call `mcount' at the start of each function.  */
 #ifdef PROF
+#if defined(__ARM_EABI__)
+#define CALL_MCOUNT                    \
+       str     lr,[sp, #-4]!   ;       \
+       bl      PLTJMP(mcount)  ;
+#else
 #define CALL_MCOUNT                    \
        str     lr,[sp, #-4]!   ;       \
        bl      PLTJMP(mcount)  ;       \
        ldr     lr, [sp], #4    ;
+#endif
 #else
 #define CALL_MCOUNT            /* Do nothing.  */
 #endif
@@ -102,8 +108,12 @@
    on this system, the asm identifier `syscall_error' intrudes on the
    C name space.  Make sure we use an innocuous name.  */
 #define        syscall_error   __syscall_error
+#if defined(__ARM_EABI__)
+#define mcount         __gnu_mcount_nc
+#else
 #define mcount         _mcount
 #endif
+#endif

 #if defined(__ARM_EABI__)
 /* Tag_ABI_align8_preserved: This code preserves 8-byte
}}}

This generates the same result as the previous patch. But i could not check
if this patch works with GCC version lesser than 4.4.

>
> This patch does not appear to be against the current git sources, which
> contain CFI information for the call.  Note that you need to be careful
> about CFI information for a call to __gnu_mcount_nc (which acts like a pop
> instruction); see GCC bug 42380 for more discussion of that issue.
>

During my investigation I have applied the patches submitted by
Thomas Schwinge
 - Add CFI statements to ARM's assembly code.
 - Move ARM EABI mcount into a separate .S file.

These patches have not helped to fix the profiling of the
glibc library functions.

>>On investigation it was found that some glibc functions such as read, write,
>>open, uname still had the hook "_mcount" for function profiling.

Currently we are trying to fix the issue for the following source
glibc, glibc-ports: 2.11.2

Once this patch is ok, then I will re-submit it for the latest sources from
the git repo.

> --
> Joseph S. Myers

Regards,
Manjunath S Matti
Sony India Software Centre.


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