23220901 gcc failing with 32-bit gprof
authorNorm Jacobs <Norm.Jacobs@Oracle.COM>
Tue, 03 May 2016 10:29:50 -0700
changeset 5928 f0b68e20e980
parent 5927 0b2f72b7196c
child 5929 6fd0c12e1d32
23220901 gcc failing with 32-bit gprof
components/gcc49/patches/029-r234366.patch
components/gcc53/patches/009-r234365.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gcc49/patches/029-r234366.patch	Tue May 03 10:29:50 2016 -0700
@@ -0,0 +1,93 @@
+#
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38239 
+# This will be fixed in 4.9.4
+#
+# Index: libgcc/ChangeLog
+# ===================================================================
+# --- libgcc/ChangeLog	(revision 234365)
+# +++ libgcc/ChangeLog	(revision 234366)
+# @@ -1,3 +1,13 @@
+# +2016-03-21  Rainer Orth  <[email protected]>
+# +
+# +	Backport from mainline
+# +	2016-03-16  Rainer Orth  <[email protected]>
+# +
+# +	PR target/38239
+# +	* config/gmon-sol2.c [__i386__] (_mcount): Save and restore
+# +	call-clobbered registers.
+# +	(internal_mcount): Remove __i386__ handling.
+# +
+#  2015-12-09  John David Anglin  <[email protected]>
+#  
+#  	* config/pa/fptr.c (__canonicalize_funcptr_for_compare): Remove code
+Index: libgcc/config/gmon-sol2.c
+===================================================================
+--- libgcc/config/gmon-sol2.c	(revision 234365)
++++ libgcc/config/gmon-sol2.c	(revision 234366)
[email protected]@ -43,11 +43,7 @@
+ 
+ extern void monstartup (char *, char *);
+ extern void _mcleanup (void);
+-#ifdef __i386__
+-static void internal_mcount (void) __attribute__ ((used));
+-#else
+ static void internal_mcount (char *, unsigned short *) __attribute__ ((used));
+-#endif
+ static void moncontrol (int);
+ 
+ struct phdr {
[email protected]@ -222,8 +218,19 @@
+ /* Solaris 2 libraries use _mcount.  */
+ #if defined __i386__
+ asm(".globl _mcount\n"
++    "	.type	_mcount, @function\n"
+     "_mcount:\n"
+-    "	jmp	internal_mcount\n");
++    /* Save and restore the call-clobbered registers.  */
++    "	pushl	%eax\n"
++    "	pushl	%ecx\n"
++    "	pushl	%edx\n"
++    "	movl	12(%esp), %edx\n"
++    "	movl	4(%ebp), %eax\n"
++    "	call	internal_mcount\n"
++    "	popl	%edx\n"
++    "	popl	%ecx\n"
++    "	popl	%eax\n"
++    "	ret\n");
+ #elif defined __x86_64__
+ /* See GLIBC for additional information about this technique.  */
+ asm(".globl _mcount\n" 
[email protected]@ -298,11 +305,7 @@
+ #endif
+ 
+ static void
+-#ifdef __i386__
+-internal_mcount (void)
+-#else
+ internal_mcount (char *selfpc, unsigned short *frompcindex)
+-#endif
+ {
+   struct tostruct *top;
+   struct tostruct *prevtop;
[email protected]@ -309,21 +312,6 @@
+   long toindex;
+   static char already_setup;
+ 
+-#ifdef __i386__
+-  char *selfpc;
+-  unsigned short *frompcindex;
+-
+-  /* Find the return address for mcount and the return address for mcount's
+-     caller.  */
+-
+-  /* selfpc = pc pushed by mcount call.
+-     This identifies the function that was just entered.  */
+-  selfpc = (void *) __builtin_return_address (0);
+-  /* frompcindex = pc in preceding frame.
+-     This identifies the caller of the function just entered.  */
+-  frompcindex = (void *) __builtin_return_address (1);
+-#endif
+-
+   if(!already_setup) {
+     extern char etext[];
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gcc53/patches/009-r234365.patch	Tue May 03 10:29:50 2016 -0700
@@ -0,0 +1,93 @@
+#
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38239 
+# This will be fixed in 5.4.
+# 
+# Index: libgcc/ChangeLog
+# ===================================================================
+# --- a/libgcc/ChangeLog	(revision 234364)
+# +++ b/libgcc/ChangeLog	(revision 234365)
+# @@ -1,3 +1,13 @@
+# +2016-03-21  Rainer Orth  <[email protected]>
+# +
+# +	Backport from mainline
+# +	2016-03-16  Rainer Orth  <[email protected]>
+# +
+# +	PR target/38239
+# +	* config/sol2/gmon.c [__i386__] (_mcount): Save and restore
+# +	call-clobbered registers.
+# +	(internal_mcount): Remove __i386__ handling.
+# +
+#  2016-02-10  Ian Lance Taylor  <[email protected]>
+#  
+#  	PR go/68562
+Index: libgcc/config/sol2/gmon.c
+===================================================================
+--- a/libgcc/config/sol2/gmon.c	(revision 234364)
++++ b/libgcc/config/sol2/gmon.c	(revision 234365)
[email protected]@ -44,11 +44,7 @@
+ 
+ extern void monstartup (char *, char *);
+ extern void _mcleanup (void);
+-#ifdef __i386__
+-static void internal_mcount (void) __attribute__ ((used));
+-#else
+ static void internal_mcount (char *, unsigned short *) __attribute__ ((used));
+-#endif
+ static void moncontrol (int);
+ 
+ struct phdr {
[email protected]@ -223,8 +219,19 @@
+ /* Solaris 2 libraries use _mcount.  */
+ #if defined __i386__
+ asm(".globl _mcount\n"
++    "	.type	_mcount, @function\n"
+     "_mcount:\n"
+-    "	jmp	internal_mcount\n");
++    /* Save and restore the call-clobbered registers.  */
++    "	pushl	%eax\n"
++    "	pushl	%ecx\n"
++    "	pushl	%edx\n"
++    "	movl	12(%esp), %edx\n"
++    "	movl	4(%ebp), %eax\n"
++    "	call	internal_mcount\n"
++    "	popl	%edx\n"
++    "	popl	%ecx\n"
++    "	popl	%eax\n"
++    "	ret\n");
+ #elif defined __x86_64__
+ /* See GLIBC for additional information about this technique.  */
+ asm(".globl _mcount\n" 
[email protected]@ -299,11 +306,7 @@
+ #endif
+ 
+ static void
+-#ifdef __i386__
+-internal_mcount (void)
+-#else
+ internal_mcount (char *selfpc, unsigned short *frompcindex)
+-#endif
+ {
+   struct tostruct *top;
+   struct tostruct *prevtop;
[email protected]@ -310,21 +313,6 @@
+   long toindex;
+   static char already_setup;
+ 
+-#ifdef __i386__
+-  char *selfpc;
+-  unsigned short *frompcindex;
+-
+-  /* Find the return address for mcount and the return address for mcount's
+-     caller.  */
+-
+-  /* selfpc = pc pushed by mcount call.
+-     This identifies the function that was just entered.  */
+-  selfpc = (void *) __builtin_return_address (0);
+-  /* frompcindex = pc in preceding frame.
+-     This identifies the caller of the function just entered.  */
+-  frompcindex = (void *) __builtin_return_address (1);
+-#endif
+-
+ /* Only necessary without the Solaris CRTs or a proper gcrt1.o, otherwise
+    crtpg.o or gcrt1.o take care of that.
+