During open64 testing we discovered that profile-directed optimizations
were not working with my configure/make changes. The problem is that
due to some bugs my configure/make changes don't work for open64
libraries that are built from C++ sources. The only such
library is the instrumentation library
(osprey/instrumentation/libinstr2) used to generate profile data for
profile directed optimizations.
This patch fixes the C++ build problems and allows us to correctly
generate profile data. The main problem with using the just built C++
compiler while building the open64 libraries was using the correct
header files. Unfortunately, the header path during the build includes
the GNU target name (i.e. x86_64-redhat-linux) so I had to ensure that
that string was available during compilation when setting the include
directories to search.
The patch includes:
configure.ac: pass the GCC_DIR directory name and the
GCC_CONFIGURE_TARG to makefiles.
configure: Regenerate from new configure.ac file.
osprey/Makefile.gsetup.in: Make BUILD_SRC, the top-level
source directory (parent of the GCC_DIR), GCC_DIR, and
GCC_CONFIGURE_TARG available.
osprey/driver/Makefile.gbase: Pass BUILD_SRC, GCC_DIR,
and GCC_CONFIGURE_TARG in to compilations via -D.
osprey/driver/phases.c: Use BUILD_SRC, GCC_DIR, and
GCC_CONFIGURE_TARG to set include search path when
building C++ programs using the -run-build option.
osprey/driver/opt_actions.c: Use xgcc to run C++
under -run-build instead of g++.
osprey/wgen/main.c: Do not make C++ check
dependent on cc1plus having a '42' suffix on the
executable name.
Attached are the actual code changes. Can one of the overseers approve
this patch for checkin?
Steve Ellcey
s...@cup.hp.com
Index: configure.ac
===================================================================
--- configure.ac (revision 3242)
+++ configure.ac (working copy)
@@ -105,6 +105,9 @@ BUILD_BOTH=
# ipfec_targ_info instead of targ_info.
TARG_INFO_NAME=targ_info
+# Specify the GCC src directory.
+GCC_DIR=osprey-gcc-4.2.0
+
# LIB_* and LIB2_* variables will default to the BUILD_* variables if not
# overridden in one of the case statements below so most platforms will
# not have to set these.
@@ -266,6 +269,8 @@ AC_SUBST([LIB2_BUILD_HOST])
AC_SUBST([BUILD_MULTILIB])
AC_SUBST([COMPILER_TARG_DIR])
AC_SUBST([TARG_INFO_NAME])
+AC_SUBST([GCC_CONFIGURE_TARG])
+AC_SUBST([GCC_DIR])
# List of configurable files to create in object directory.
AC_CONFIG_FILES([
@@ -361,6 +366,8 @@ AC_SUBST([LIBLIST])
# Configure cygnus and GCC subdirectories.
AC_CONFIG_SUBDIRS(osprey/cygnus)
+# We do not use $GCC_DIR because using AC_CONFIG_SUBDIRS with variables
+# breaks "configure --help=recursive". See autoconf documentation.
AC_CONFIG_SUBDIRS(osprey-gcc-4.2.0)
AC_OUTPUT
Index: osprey/Makefile.gsetup.in
===================================================================
--- osprey/Makefile.gsetup.in (revision 3242)
+++ osprey/Makefile.gsetup.in (working copy)
@@ -87,6 +87,9 @@ endif
ifndef BUILD_OBJ_DIR
BUILD_OBJ_DIR = @abs_top_builddir@
endif
+ifndef BUILD_SRC
+ BUILD_SRC = @abs_top_srcdir@
+endif
ifndef BUILD_TOT
BUILD_TOT = @abs_top_srcdir@/osprey
endif
@@ -135,6 +138,12 @@ endif
ifndef TOP_BUILDDIR
TOP_BUILDDIR = @abs_top_builddir@
endif
+ifndef GCC_CONFIGURE_TARG
+ GCC_CONFIGURE_TARG = @GCC_CONFIGURE_TARG@
+endif
+ifndef GCC_DIR
+ GCC_DIR = @GCC_DIR@
+endif
# For cross compilers, there are really 3 separate variables:
# the build host (machine you are building on),
Index: osprey/driver/Makefile.gbase
===================================================================
--- osprey/driver/Makefile.gbase (revision 3242)
+++ osprey/driver/Makefile.gbase (working copy)
@@ -74,6 +74,8 @@ LCDEFS += -DOPEN64_PRODNAME='"Compiler"'
LCDEFS += -DKEY
+LCDEFS += -DGCC_CONFIGURE_TARG=\"${GCC_CONFIGURE_TARG}\" -DGCC_DIR=\"${GCC_DIR}\" -DBUILD_SRC=\"${BUILD_SRC}\"
+
# Get the date of the build for perpetual licenses
psc_build_date := $(shell date '+"%F/%T"')
LCDEFS += -DOPEN64_BUILD_DATE='$(psc_build_date)'
Index: osprey/driver/phases.c
===================================================================
--- osprey/driver/phases.c (revision 3242)
+++ osprey/driver/phases.c (working copy)
@@ -761,6 +761,28 @@ add_file_args_first (string_list_t *args
char p[PATH_BUF_LEN];
sprintf(p, "-B%s", get_phase_dir(index));
add_string(args, p);
+ if (index == P_gcpp_plus) {
+#if defined(TARG_X8664)
+ if (abi == ABI_N32)
+ sprintf(p, "-I%s/../%s/32/libstdc++-v3/include/%s", get_phase_dir(index),GCC_CONFIGURE_TARG,GCC_CONFIGURE_TARG);
+ else
+ sprintf(p, "-I%s/../%s/libstdc++-v3/include/%s", get_phase_dir(index),GCC_CONFIGURE_TARG,GCC_CONFIGURE_TARG);
+#else
+ sprintf(p, "-I%s/../%s/libstdc++-v3/include/%s", get_phase_dir(index),GCC_CONFIGURE_TARG,GCC_CONFIGURE_TARG);
+#endif
+ add_string(args, p);
+#if defined(TARG_X8664) || defined(TARG_NVISA)
+ if (abi == ABI_N32)
+ sprintf(p, "-I%s/../%s/32/libstdc++-v3/include", get_phase_dir(index),GCC_CONFIGURE_TARG);
+ else
+ sprintf(p, "-I%s/../%s/libstdc++-v3/include", get_phase_dir(index),GCC_CONFIGURE_TARG);
+#else
+ sprintf(p, "-I%s/../%s/libstdc++-v3/include", get_phase_dir(index),GCC_CONFIGURE_TARG);
+#endif
+ add_string(args, p);
+ sprintf(p, "-I%s/%s/libstdc++-v3/libsupc++", BUILD_SRC, GCC_DIR);
+ add_string(args, p);
+ }
}
// -Dfoo before user options, since user might specify -Ufoo. Bug 6874.
if (option_was_seen(O_pthread))
Index: osprey/driver/opt_actions.c
===================================================================
--- osprey/driver/opt_actions.c (revision 3242)
+++ osprey/driver/opt_actions.c (working copy)
@@ -1185,8 +1185,8 @@ run_from_build (char *builddir)
override_phase(P_gcpp, "P_gcpp", new_path, "xgcc");
override_phase(P_gas, "P_gas", new_path, "xgcc");
override_phase(P_ld, "P_ld", new_path, "xgcc");
- override_phase(P_gcpp, "P_gcpp_plus", new_path, "g++");
- override_phase(P_ldplus, "P_ldplus", new_path, "g++");
+ override_phase(P_gcpp_plus, "P_gcpp_plus", new_path, "xgcc");
+ override_phase(P_ldplus, "P_ldplus", new_path, "xgcc");
override_phase(P_spin_cc1, "P_spin_cc1", new_path, "cc1");
override_phase(P_spin_cc1plus, "P_spin_cc1plus", new_path, "cc1plus");
new_path[builddir_len] = NULL;
Index: osprey/wgen/main.c
===================================================================
--- osprey/wgen/main.c (revision 3242)
+++ osprey/wgen/main.c (working copy)
@@ -171,11 +171,7 @@ Process_Cc1_Command_Line(gs_t arg_list)
argv = gs_s(gs_index(arg_list, 0));
char *command = Last_Pathname_Component(argv);
//printf("%s\n", command);
-#ifdef FE_GNU_4_2_0
- lang_cplus = !strcmp(command, "cc1plus42");
-#else
- lang_cplus = !strcmp(command, "cc1plus");
-#endif
+ lang_cplus = !strncmp(command, "cc1plus", strlen("cc1plus"));
// if not set by the command line, set default value by language
if (emit_exceptions == -1)
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel