From 1b24b72ead5764b862f63aa5264d8acdf65e9a94 Mon Sep 17 00:00:00 2001 From: jdp Date: Thu, 8 Oct 1998 21:33:02 +0000 Subject: Make profiling work. --- lang/gcc295/files/patch-ad | 31 ++++++++++++++++++++++---- lang/gcc295/files/patch-af | 51 +++++++++++++++++++++++++++++++++++++++++++ lang/gcc295/files/patch-ai | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 lang/gcc295/files/patch-af create mode 100644 lang/gcc295/files/patch-ai (limited to 'lang/gcc295') diff --git a/lang/gcc295/files/patch-ad b/lang/gcc295/files/patch-ad index f29a24efded5..fa80120519f2 100644 --- a/lang/gcc295/files/patch-ad +++ b/lang/gcc295/files/patch-ad @@ -1,6 +1,29 @@ --- gcc/config/i386/freebsd.h.orig Tue Jun 30 15:52:18 1998 -+++ gcc/config/i386/freebsd.h Sun Jul 19 14:35:14 1998 -@@ -129,6 +129,7 @@ ++++ gcc/config/i386/freebsd.h Wed Oct 7 17:06:41 1998 +@@ -99,19 +99,18 @@ + + /* Profiling routines, partially copied from i386/osfrose.h. */ + +-/* Redefine this to use %eax instead of %edx. */ ++/* Tell final.c that we don't need a label passed to mcount. */ ++#define NO_PROFILE_DATA ++ + #undef FUNCTION_PROFILER + #define FUNCTION_PROFILER(FILE, LABELNO) \ + { \ + if (flag_pic) \ + { \ +- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \ +- LPREFIX, (LABELNO)); \ + fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ + } \ + else \ + { \ +- fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \ + fprintf (FILE, "\tcall mcount\n"); \ + } \ + } +@@ -129,6 +128,7 @@ #define TYPE_ASM_OP ".type" #define SIZE_ASM_OP ".size" @@ -8,7 +31,7 @@ /* The following macro defines the format used to output the second operand of the .type assembler directive. Different svr4 assemblers -@@ -138,6 +139,12 @@ +@@ -138,6 +138,12 @@ #define TYPE_OPERAND_FMT "@%s" @@ -21,7 +44,7 @@ /* Write the extra assembler code needed to declare a function's result. Most svr4 assemblers don't require any special declaration of the result value, but there are exceptions. */ -@@ -239,6 +246,8 @@ +@@ -239,6 +245,8 @@ #define STARTFILE_SPEC \ "%{shared:c++rt0.o%s} \ %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}" diff --git a/lang/gcc295/files/patch-af b/lang/gcc295/files/patch-af new file mode 100644 index 000000000000..ccd446725773 --- /dev/null +++ b/lang/gcc295/files/patch-af @@ -0,0 +1,51 @@ +--- gcc/config/i386/freebsd-elf.h.orig Mon Jul 13 15:38:36 1998 ++++ gcc/config/i386/freebsd-elf.h Wed Oct 7 22:18:02 1998 +@@ -108,22 +108,19 @@ + : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ + : (-1)) + +-/* Output assembler code to FILE to increment profiler label # LABELNO +- for profiling a function entry. */ ++/* Tell final.c that we don't need a label passed to mcount. */ ++#define NO_PROFILE_DATA + + #undef FUNCTION_PROFILER + #define FUNCTION_PROFILER(FILE, LABELNO) \ + { \ + if (flag_pic) \ + { \ +- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ +- LPREFIX, (LABELNO)); \ +- fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ ++ fprintf (FILE, "\tcall *.mcount@GOT(%%ebx)\n"); \ + } \ + else \ + { \ +- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \ +- fprintf (FILE, "\tcall mcount\n"); \ ++ fprintf (FILE, "\tcall .mcount\n"); \ + } \ + } + +@@ -146,20 +143,8 @@ + #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" + + #undef LIB_SPEC +-#if 1 +-/* We no longer link with libc_p.a or libg.a by default. If you +- * want to profile or debug the C library, please add +- * -lc_p or -ggdb to LDFLAGS at the link time, respectively. +- */ + #define LIB_SPEC \ +- "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \ +- %{!ggdb:-lc} %{ggdb:-lg}}" +-#else +-#define LIB_SPEC \ +- "%{!shared: \ +- %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ +- %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}" +-#endif ++ "%{!shared: %{p:-lc_p} %{pg:-lc_p} %{!p:%{!pg:-lc}}}" + + /* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support + for the special GCC options -static and -shared, which allow us to diff --git a/lang/gcc295/files/patch-ai b/lang/gcc295/files/patch-ai new file mode 100644 index 000000000000..4395574d635a --- /dev/null +++ b/lang/gcc295/files/patch-ai @@ -0,0 +1,54 @@ +--- gcc/final.c.orig Sat Sep 5 22:52:01 1998 ++++ gcc/final.c Wed Oct 7 17:06:58 1998 +@@ -383,6 +383,8 @@ + /* zero word */ + assemble_integer (const0_rtx, long_bytes, 1); + ++ fprintf(asm_out_file,".stabs \"bbset\", 25, 0, 0, LPBX0\n"); ++ + /* address of filename */ + ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 1); + assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes, 1); +@@ -1635,6 +1637,9 @@ + leaf_renumber_regs (first); + #endif + ++ if (profile_block_flag) ++ add_bb (file); ++ + /* The Sun386i and perhaps other machines don't work right + if the profiling code comes after the prologue. */ + #ifdef PROFILE_BEFORE_PROLOGUE +@@ -1696,7 +1701,9 @@ + profile_function (file) + FILE *file; + { ++#ifndef NO_PROFILE_DATA + int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE); ++#endif /* not NO_PROFILE_DATA */ + #if defined(ASM_OUTPUT_REG_PUSH) + #if defined(STRUCT_VALUE_INCOMING_REGNUM) || defined(STRUCT_VALUE_REGNUM) + int sval = current_function_returns_struct; +@@ -1706,10 +1713,12 @@ + #endif + #endif /* ASM_OUTPUT_REG_PUSH */ + ++#ifndef NO_PROFILE_DATA + data_section (); + ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT)); + ASM_OUTPUT_INTERNAL_LABEL (file, "LP", profile_label_no); + assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, 1); ++#endif /* not NO_PROFILE_DATA */ + + function_section (current_function_decl); + +@@ -1800,6 +1809,9 @@ + code to restore the stack frame and return to the caller. */ + FUNCTION_EPILOGUE (file, get_frame_size ()); + #endif ++ ++ if (profile_block_flag) ++ add_bb (file); + + #ifdef SDB_DEBUGGING_INFO + if (write_symbols == SDB_DEBUG) -- cgit