re PR target/43643 (gcc -m64 -pg corrupts %rdx / %rcx register)

gcc:
	PR target/43643
	* config/i386/gmon-sol2.c [__x86_64__]: Properly restore %rcx.

	gcc/testsuite:
	PR target/43643
	* gcc.dg/pr43643.c: New test.

	gcc:
	Backport from mainline:
	2010-03-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/38085
	* config/i386/i386.c (x86_function_profiler)
	[!NO_PROFILE_COUNTERS]: Fix typo.
	* config/i386/gmon-sol2.c (_mcleanup) [__x86_64__]: Use call
	instead of callq.

	libgcc:
	Backport from mainline:
	2010-03-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/38085
	* config/i386/t-sol2 ($(T)gmon.o): Use CFLAGS instead of
	MULTILIB_CFLAGS.
	($(T)gcrt1.o): Likewise.
	($(T)crt1.o): Likewise.
	($(T)crti.o): Likewise.
	($(T)crtn.o): Likewise.

From-SVN: r158133
This commit is contained in:
Rainer Orth 2010-04-08 15:09:17 +00:00 committed by Rainer Orth
parent aae1d7ccf9
commit f54e78e2a0
7 changed files with 67 additions and 9 deletions

View File

@ -1,3 +1,19 @@
2010-04-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/43643
* config/i386/gmon-sol2.c [__x86_64__]: Properly restore %rcx.
2010-04-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Backport from mainline:
2010-03-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/38085
* config/i386/i386.c (x86_function_profiler)
[!NO_PROFILE_COUNTERS]: Fix typo.
* config/i386/gmon-sol2.c (_mcleanup) [__x86_64__]: Use call
instead of callq.
2010-04-08 Richard Guenther <rguenther@suse.de>
PR middle-end/42956

View File

@ -268,14 +268,14 @@ asm(".globl _mcount\n"
FROMPCINDEX (via the frame pointer. */
"\tmovq\t0x38(%rsp),%rdi\n"
"\tmovq\t0x8(%rbp),%rsi\n"
"\tcallq\tinternal_mcount\n"
"\tcall\tinternal_mcount\n"
/* Restore the saved registers. */
"\tmovq\t0x30(%rsp),%r9\n"
"\tmovq\t0x28(%rsp),%r8\n"
"\tmovq\t0x20(%rsp),%rdi\n"
"\tmovq\t0x18(%rsp),%rsi\n"
"\tmovq\t0x10(%rsp),%rdx\n"
"\tmovq\t0x08(%rsp),%rdx\n"
"\tmovq\t0x08(%rsp),%rcx\n"
"\tmovq\t(%rsp),%rax\n"
"\taddq\t$0x38,%rsp\n"
"\tretq\n"

View File

@ -1,6 +1,6 @@
/* Subroutines used for code generation on IA-32.
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@ -26837,7 +26837,7 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED)
if (TARGET_64BIT)
{
#ifndef NO_PROFILE_COUNTERS
fprintf (file, "\tleaq\t%sP%d@(%%rip),%%r11\n", LPREFIX, labelno);
fprintf (file, "\tleaq\t%sP%d(%%rip),%%r11\n", LPREFIX, labelno);
#endif
if (DEFAULT_ABI == SYSV_ABI && flag_pic)

View File

@ -1,3 +1,8 @@
2010-04-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/43643
* gcc.dg/pr43643.c: New test.
2010-04-08 Richard Guenther <rguenther@suse.de>
PR middle-end/42956

View File

@ -0,0 +1,24 @@
/* Contributed by Jürgen Keil <jrgn.keil@googlemail.com> */
/* { dg-do run } */
/* { dg-require-profiling "-pg" } */
/* { dg-options "-O2 -pg" } */
extern char *strdup (const char *);
void
func(char *a, char *b, char *c)
{
strdup(a);
strdup(b);
strdup(c);
}
int
main(void)
{
func("a", "b", "c");
return 0;
}
/* { dg-final { cleanup-profile-file } } */

View File

@ -1,3 +1,16 @@
2010-04-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Backport from mainline:
2010-03-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/38085
* config/i386/t-sol2 ($(T)gmon.o): Use CFLAGS instead of
MULTILIB_CFLAGS.
($(T)gcrt1.o): Likewise.
($(T)crt1.o): Likewise.
($(T)crti.o): Likewise.
($(T)crtn.o): Likewise.
2010-01-21 Release Manager
* GCC 4.4.3 released.

View File

@ -1,6 +1,6 @@
# gmon build rule:
$(T)gmon.o: $(gcc_srcdir)/config/i386/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H)
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CFLAGS) \
-c $(gcc_srcdir)/config/i386/gmon-sol2.c -o $(T)gmon.o
# Assemble startup files.
@ -9,16 +9,16 @@ $(T)gmon.o: $(gcc_srcdir)/config/i386/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H)
# the comments with sed. This bug may only be in the Early Access releases.
$(T)gcrt1.o: $(gcc_srcdir)/config/i386/sol2-gc1.asm $(GCC_PASSES)
sed -e '/^!/d' <$(gcc_srcdir)/config/i386/sol2-gc1.asm >gcrt1.s
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)gcrt1.o gcrt1.s
$(GCC_FOR_TARGET) $(CFLAGS) -c -o $(T)gcrt1.o gcrt1.s
$(T)crt1.o: $(gcc_srcdir)/config/i386/sol2-c1.asm $(GCC_PASSES)
sed -e '/^!/d' <$(gcc_srcdir)/config/i386/sol2-c1.asm >crt1.s
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crt1.o crt1.s
$(GCC_FOR_TARGET) $(CFLAGS) -c -o $(T)crt1.o crt1.s
$(T)crti.o: $(gcc_srcdir)/config/i386/sol2-ci.asm $(GCC_PASSES)
sed -e '/^!/d' <$(gcc_srcdir)/config/i386/sol2-ci.asm >crti.s
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o crti.s
$(GCC_FOR_TARGET) $(CFLAGS) -c -o $(T)crti.o crti.s
$(T)crtn.o: $(gcc_srcdir)/config/i386/sol2-cn.asm $(GCC_PASSES)
sed -e '/^!/d' <$(gcc_srcdir)/config/i386/sol2-cn.asm >crtn.s
$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o crtn.s
$(GCC_FOR_TARGET) $(CFLAGS) -c -o $(T)crtn.o crtn.s
# We need to use -fPIC when we are using gcc to compile the routines in
# crtstuff.c. This is only really needed when we are going to use gcc/g++