|
1 # |
|
2 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38239 |
|
3 # This will be fixed in 5.4. |
|
4 # |
|
5 # Index: libgcc/ChangeLog |
|
6 # =================================================================== |
|
7 # --- a/libgcc/ChangeLog (revision 234364) |
|
8 # +++ b/libgcc/ChangeLog (revision 234365) |
|
9 # @@ -1,3 +1,13 @@ |
|
10 # +2016-03-21 Rainer Orth <[email protected]> |
|
11 # + |
|
12 # + Backport from mainline |
|
13 # + 2016-03-16 Rainer Orth <[email protected]> |
|
14 # + |
|
15 # + PR target/38239 |
|
16 # + * config/sol2/gmon.c [__i386__] (_mcount): Save and restore |
|
17 # + call-clobbered registers. |
|
18 # + (internal_mcount): Remove __i386__ handling. |
|
19 # + |
|
20 # 2016-02-10 Ian Lance Taylor <[email protected]> |
|
21 # |
|
22 # PR go/68562 |
|
23 Index: libgcc/config/sol2/gmon.c |
|
24 =================================================================== |
|
25 --- a/libgcc/config/sol2/gmon.c (revision 234364) |
|
26 +++ b/libgcc/config/sol2/gmon.c (revision 234365) |
|
27 @@ -44,11 +44,7 @@ |
|
28 |
|
29 extern void monstartup (char *, char *); |
|
30 extern void _mcleanup (void); |
|
31 -#ifdef __i386__ |
|
32 -static void internal_mcount (void) __attribute__ ((used)); |
|
33 -#else |
|
34 static void internal_mcount (char *, unsigned short *) __attribute__ ((used)); |
|
35 -#endif |
|
36 static void moncontrol (int); |
|
37 |
|
38 struct phdr { |
|
39 @@ -223,8 +219,19 @@ |
|
40 /* Solaris 2 libraries use _mcount. */ |
|
41 #if defined __i386__ |
|
42 asm(".globl _mcount\n" |
|
43 + " .type _mcount, @function\n" |
|
44 "_mcount:\n" |
|
45 - " jmp internal_mcount\n"); |
|
46 + /* Save and restore the call-clobbered registers. */ |
|
47 + " pushl %eax\n" |
|
48 + " pushl %ecx\n" |
|
49 + " pushl %edx\n" |
|
50 + " movl 12(%esp), %edx\n" |
|
51 + " movl 4(%ebp), %eax\n" |
|
52 + " call internal_mcount\n" |
|
53 + " popl %edx\n" |
|
54 + " popl %ecx\n" |
|
55 + " popl %eax\n" |
|
56 + " ret\n"); |
|
57 #elif defined __x86_64__ |
|
58 /* See GLIBC for additional information about this technique. */ |
|
59 asm(".globl _mcount\n" |
|
60 @@ -299,11 +306,7 @@ |
|
61 #endif |
|
62 |
|
63 static void |
|
64 -#ifdef __i386__ |
|
65 -internal_mcount (void) |
|
66 -#else |
|
67 internal_mcount (char *selfpc, unsigned short *frompcindex) |
|
68 -#endif |
|
69 { |
|
70 struct tostruct *top; |
|
71 struct tostruct *prevtop; |
|
72 @@ -310,21 +313,6 @@ |
|
73 long toindex; |
|
74 static char already_setup; |
|
75 |
|
76 -#ifdef __i386__ |
|
77 - char *selfpc; |
|
78 - unsigned short *frompcindex; |
|
79 - |
|
80 - /* Find the return address for mcount and the return address for mcount's |
|
81 - caller. */ |
|
82 - |
|
83 - /* selfpc = pc pushed by mcount call. |
|
84 - This identifies the function that was just entered. */ |
|
85 - selfpc = (void *) __builtin_return_address (0); |
|
86 - /* frompcindex = pc in preceding frame. |
|
87 - This identifies the caller of the function just entered. */ |
|
88 - frompcindex = (void *) __builtin_return_address (1); |
|
89 -#endif |
|
90 - |
|
91 /* Only necessary without the Solaris CRTs or a proper gcrt1.o, otherwise |
|
92 crtpg.o or gcrt1.o take care of that. |
|
93 |