diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-23 17:06:06 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-23 17:06:06 +0000 |
commit | 98d76e794234eb77acdde1a17448aabccbc4404e (patch) | |
tree | 46c7f2c3b247e5ae9625c3ef190c36391146751d | |
parent | 5ad3e2d1a9bdcb2dc137b74fc633ae568e68221e (diff) | |
download | gcc-98d76e794234eb77acdde1a17448aabccbc4404e.tar.gz |
2009-06-23 Basile Starynkevitch <basile@starynkevitch.net>
[simplified the program flags, using a source path and a module
path. Removed LTDL]
* common.opt: all *basilys* variables renamed as *melt*
* basilys.h (debugeprintf_raw, debugeprintvalue, debugebacktrace)
(debugvalue_at, debugmsgval_at, debugbacktrace_at):
flag_basilys_debug renamed as flag_melt_debug.
(basilys_tempdir_path) removed, renamed as (melt_tempdir_path).
* basilys.c: including <dlfcn.h>. renamed all *basilys* variables
as *melt*.
(load_basilys_modules_and_do_command, basilysgc_load_modulelist)
(load_checked_dynamic_module_index): simpler loading using path
and GCCMELT_SOURCE_PATH & GCCMELT_MODULE_PATH environment
variables.
* toplev.c: removed LTDL.
(toplev_main) merged initialize_plugins calls from trunk.
* configure: regenerated.
* configure.ac: removed LTDL stuff.
* run-basilys.h: dont require LTDL.
* Makefile.in: replaced flags using our paths.
* doc/melt.texi: updated.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@148858 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog.MELT | 22 | ||||
-rw-r--r-- | gcc/Makefile.in | 40 | ||||
-rw-r--r-- | gcc/basilys.c | 399 | ||||
-rw-r--r-- | gcc/basilys.h | 16 | ||||
-rw-r--r-- | gcc/common.opt | 62 | ||||
-rw-r--r-- | gcc/config.in | 6 | ||||
-rwxr-xr-x | gcc/configure | 185 | ||||
-rw-r--r-- | gcc/configure.ac | 76 | ||||
-rw-r--r-- | gcc/doc/melt.texi | 17 | ||||
-rw-r--r-- | gcc/run-basilys.h | 6 | ||||
-rw-r--r-- | gcc/toplev.c | 22 |
11 files changed, 349 insertions, 502 deletions
diff --git a/gcc/ChangeLog.MELT b/gcc/ChangeLog.MELT index 0ed165b2300..d29282fa8ca 100644 --- a/gcc/ChangeLog.MELT +++ b/gcc/ChangeLog.MELT @@ -1,4 +1,26 @@ 2009-06-23 Basile Starynkevitch <basile@starynkevitch.net> + [simplified the program flags, using a source path and a module + path. Removed LTDL] + * common.opt: all *basilys* variables renamed as *melt* + * basilys.h (debugeprintf_raw, debugeprintvalue, debugebacktrace) + (debugvalue_at, debugmsgval_at, debugbacktrace_at): + flag_basilys_debug renamed as flag_melt_debug. + (basilys_tempdir_path) removed, renamed as (melt_tempdir_path). + * basilys.c: including <dlfcn.h>. renamed all *basilys* variables + as *melt*. + (load_basilys_modules_and_do_command, basilysgc_load_modulelist) + (load_checked_dynamic_module_index): simpler loading using path + and GCCMELT_SOURCE_PATH & GCCMELT_MODULE_PATH environment + variables. + * toplev.c: removed LTDL. + (toplev_main) merged initialize_plugins calls from trunk. + * configure: regenerated. + * configure.ac: removed LTDL stuff. + * run-basilys.h: dont require LTDL. + * Makefile.in: replaced flags using our paths. + * doc/melt.texi: updated. + +2009-06-23 Basile Starynkevitch <basile@starynkevitch.net> * diagnostic.h (dump_gimple_seq): removed. Reverted to trunk. * gimple-pretty-print.c (dump_gimple_seq): reverted to static, as inside the trunk. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 61d22b58086..c8f70a95457 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -292,10 +292,6 @@ GMPINC = @GMPINC@ #PPLLIBS = @ppllibs@ #PPLINC = @pplinc@ -# How to find LTDL (LibTool DynLoader) -LTDLLIBS = @ltdllibs@ -LTDLINC = @ltdlinc@ -LTDL_LDFLAGS= @ltdl_ldflags@ # How to file GDBM GDBMLIBS = @gdbmlibs@ @@ -968,7 +964,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) # How to link with both our special library facilities # and the system's installed libraries. LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) -BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(LTDLLIBS) $(GDBMLIBS) $(PLUGINLIBS) +BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(GDBMLIBS) $(PLUGINLIBS) # Any system libraries needed just for GNAT. SYSLIBS = @GNAT_LIBEXC@ @@ -998,7 +994,7 @@ BUILD_ERRORS = build/errors.o INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ -I$(srcdir)/../include @INCINTL@ \ $(CPPINC) $(GMPINC) $(DECNUMINC) \ - $(PPLINC) $(CLOOGINC) $(LTDLINC) + $(PPLINC) $(CLOOGINC) .c.o: $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION) @@ -2529,8 +2525,7 @@ $(BASILYSMELT_OBJ): $(BASILYS_C) \ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ -DMELT_PRIVATE_INCLUDE_DIR=\"$(melt_private_include_dir)\" \ -DMELT_SOURCE_DIR=\"$(melt_source_dir)\" \ - -DMELT_GENERATED_DIR=\"$(melt_generated_dir)\" \ - -DMELT_DYNLIB_DIR=\"$(melt_dynlib_dir)\" \ + -DMELT_MODULE_DIR=\"$(melt_module_dir)\" \ -DMELT_COMPILE_SCRIPT=\"$(melt_compile_script)\" \ -DMELT_DEFAULT_MODLIS=\"$(melt_default_modules_list)\" \ -c $(BASILYS_C) $(OUTPUT_OPTION) @@ -4776,14 +4771,12 @@ MELTINDENT= indent -gnu -l90 melt_private_include_dir=$(libexecsubdir)/melt-private-include/ -## this is the installation directory of melt sources (*.melt files, MELT dialect) +## this is the installation directory of melt sources (*.melt files, +## MELT dialect and the corresponding *.c files) melt_source_dir=$(libexecsubdir)/melt-source/ -## this is the installation directory of melt generated code (*.c files, generated C code) -melt_generated_dir=$(libexecsubdir)/melt-generated/ - -## this is the installation directory of melt dynamic libraries (ie *.so or *.dylib or *.la) -melt_dynlib_dir=$(libexecsubdir)/melt-dynlib/ +## this is the installation directory of melt dynamic modules (*.so) +melt_module_dir=$(libexecsubdir)/melt-module/ ## this is the installed path of the script compiling MELT generated C file melt_compile_script=$(libexecsubdir)/melt-cc-script @@ -4880,23 +4873,20 @@ melt.encap: run-basilys.d install-melt-headers: melt.encap $(INSTALL_MELT_HEADERS_DIR) install-melt-cc-script MELTBASILYSCCINIT1= time ./cc1$(exeext) -Wno-shadow -fmelt=translateinit \ - -fmelt-dynlibdir=. \ + -fmelt-module-path=. -fmelt-source-path=. \ -fmelt-compile-script=$(objdir)/built-melt-cc-script \ - -fmelt-gensrcdir=. \ -fmelt-tempdir=. # -frandom-seed=$$RANDOM MELTBASILYSCCFILE1= time ./cc1$(exeext) -Wno-shadow -fmelt=translatefile \ - -fmelt-dynlibdir=. \ + -fmelt-module-path=. -fmelt-source-path=. \ -fmelt-compile-script=$(objdir)/built-melt-cc-script \ - -fmelt-gensrcdir=. \ -fmelt-tempdir=. # -frandom-seed=$$RANDOM MELTBASILYSCCSHOW1= time ./cc1$(exeext) -fmelt=showmdata \ - -fmelt-dynlibdir=. \ + -fmelt-module-path=. -fmelt-source-path=. \ -fmelt-compile-script=$(objdir)/built-melt-cc-script \ - -fmelt-gensrcdir=. \ -fmelt-tempdir=. # -frandom-seed=$$RANDOM @@ -5185,12 +5175,12 @@ $(melt_default_modules_list).modlis: $(WARMELT_BASE3SO) $(ANAMELT_BASESO) #### installing melt generated shared object plugins (at MELT 3rd #### stage) and the default melt module list install-melt-dynlib: installdirs $(melt_default_modules_list).modlis $(WARMELT_BASE3SO) $(ANAMELT_BASESO) - $(mkinstalldirs) $(melt_dynlib_dir) - rm -f $(melt_dynlib_dir)/$(melt_default_modules_list).modlis - $(INSTALL_DATA) $(melt_default_modules_list).modlis $(melt_dynlib_dir)/$(melt_default_modules_list).modlis + $(mkinstalldirs) $(melt_module_dir) + rm -f $(melt_module_dir)/$(melt_default_modules_list).modlis + $(INSTALL_DATA) $(melt_default_modules_list).modlis $(melt_module_dir)/$(melt_default_modules_list).modlis for dynfile in $(WARMELT_BASE3SO) $(ANAMELT_BASESO); do \ - rm -f $(melt_dynlib_dir)/$$dynfile; \ - $(INSTALL_PROGRAM) -m 755 $$dynfile $(melt_dynlib_dir)/$$dynfile; \ + rm -f $(melt_module_dir)/$$dynfile; \ + $(INSTALL_PROGRAM) -m 755 $$dynfile $(melt_module_dir)/$$dynfile; \ done diff --git a/gcc/basilys.c b/gcc/basilys.c index 1efc3ac0072..95b5d191e1f 100644 --- a/gcc/basilys.c +++ b/gcc/basilys.c @@ -61,17 +61,15 @@ extern const unsigned char executable_checksum[16]; #include <dirent.h> +#include <dlfcn.h> + + #if HAVE_PARMAPOLY #include <ppl_c.h> #else #error required parma polyedral library PPL #endif /*HAVE_PARMAPOLY */ -#if HAVE_LIBTOOLDYNL -#include <ltdl.h> -#else -#error required libtool dynamic loader library LTDL -#endif /*HAVE_LIBTOOLDYNL */ /* basilysgc_sort_multiple needs setjmp */ #include <setjmp.h> @@ -93,12 +91,8 @@ extern const unsigned char executable_checksum[16]; #error MELT_SOURCE_DIR is not defined thru compile flags #endif -#ifndef MELT_GENERATED_DIR -#error MELT_GENERATED_DIR is not defined thru compile flags -#endif - -#ifndef MELT_DYNLIB_DIR -#error MELT_DYNLIB_DIR is not defined thru compile flags +#ifndef MELT_MODULE_DIR +#error MELT_MODULE_DIR is not defined thru compile flags #endif #ifndef MELT_COMPILE_SCRIPT @@ -117,8 +111,7 @@ extern const unsigned char executable_checksum[16]; /* *INDENT-OFF* */ static const char melt_private_include_dir[] = MELT_PRIVATE_INCLUDE_DIR; static const char melt_source_dir[] = MELT_SOURCE_DIR; -static const char melt_generated_dir[] = MELT_GENERATED_DIR; -static const char melt_dynlib_dir[] = MELT_DYNLIB_DIR; +static const char melt_module_dir[] = MELT_MODULE_DIR; static const char melt_compile_script[] = MELT_COMPILE_SCRIPT; basilys_ptr_t basilys_globarr[BGLOB__LASTGLOB]; @@ -172,7 +165,7 @@ struct GTY(()) basilocalsptr_st { static GTY(()) struct basilocalsptr_st* blocaltab; -static lt_dlhandle proghandle; +static void* proghandle; /* *INDENT-ON* */ @@ -1645,7 +1638,7 @@ unsafe_index_mapobject (struct entryobjectsbasilys_st *tab, && curat->obj_class == attr->obj_class) { samehashcnt++; - if (flag_basilys_debug + if (flag_melt_debug || (samehashcnt < 16 || samehashcnt % 16 == 0)) { basilys_checkmsg ("similar gotten & found attr", curat == attr); @@ -1690,7 +1683,7 @@ unsafe_index_mapobject (struct entryobjectsbasilys_st *tab, && curat->obj_class == attr->obj_class) { samehashcnt++; - if (flag_basilys_debug + if (flag_melt_debug || (samehashcnt < 16 || samehashcnt % 16 == 0)) { basilys_checkmsg ("similar gotten & found attr", curat == attr); @@ -4620,7 +4613,7 @@ basilysgc_new_string_tempname_suffixed (basilysobject_ptr_t dot = strrchr(basestr, '.'); if (dot) *dot=0; - tempnampath = basilys_tempdir_path(basestr, suffix); + tempnampath = melt_tempdir_path (basestr, suffix); dbgprintf ("new_string_tempbasename basestr='%s' tempnampath='%s'", basestr, tempnampath); free(CONST_CAST(char*,basestr)); basestr = 0; @@ -4837,24 +4830,24 @@ static char tempdir_basilys[1024]; static bool made_tempdir_basilys; /* returns malloc-ed path inside a temporary directory, with a given basename */ char * -basilys_tempdir_path (const char *srcnam, const char* suffix) +melt_tempdir_path (const char *srcnam, const char* suffix) { int loopcnt = 0; const char *basnam = 0; extern char *choose_tmpdir (void); /* from libiberty/choose-temp.c */ basnam = lbasename (CONST_CAST (char*,srcnam)); - debugeprintf ("basilys_tempdir_path srcnam %s basnam %s suffix %s", srcnam, basnam, suffix); + debugeprintf ("melt_tempdir_path srcnam %s basnam %s suffix %s", srcnam, basnam, suffix); gcc_assert (basnam && (ISALNUM (basnam[0]) || basnam[0] == '_')); - if (basilys_tempdir_string && basilys_tempdir_string[0]) + if (melt_tempdir_string && melt_tempdir_string[0]) { - if (access (basilys_tempdir_string, F_OK)) + if (access (melt_tempdir_string, F_OK)) { - if (mkdir (basilys_tempdir_string, 0700)) + if (mkdir (melt_tempdir_string, 0700)) fatal_error ("failed to mkdir basilys_tempdir %s - %m", - basilys_tempdir_string); + melt_tempdir_string); made_tempdir_basilys = true; } - return concat (basilys_tempdir_string, "/", basnam, suffix, NULL); + return concat (melt_tempdir_string, "/", basnam, suffix, NULL); } if (!tempdir_basilys[0]) { @@ -4923,8 +4916,8 @@ compile_to_dyl (const char *srcfile, const char *dlfile) getcwd(pwdbuf, sizeof(pwdbuf)-1); memset (&ptime, 0, sizeof (ptime)); /* compute the ourmeltcompilscript */ - debugeprintf ("compile_to_dyl basilys_compile_script_string %s", basilys_compile_script_string); - ourmeltcompilescript = CONST_CAST (char *, basilys_compile_script_string); + debugeprintf ("compile_to_dyl melt_compile_script_string %s", melt_compile_script_string); + ourmeltcompilescript = CONST_CAST (char *, melt_compile_script_string); if (!ourmeltcompilescript || !ourmeltcompilescript[0]) ourmeltcompilescript = melt_compile_script; debugeprintf ("compile_to_dyl melt ourmeltcompilescript=%s pwd %s", @@ -4993,15 +4986,18 @@ load_checked_dynamic_module_index (const char *dypath, char *md5src) int i = 0, c = 0; char hbuf[4]; debugeprintf ("load_check_dynamic_module_index dypath=%s md5src=%s", dypath, md5src); - dlh = (void *) lt_dlopenext (dypath); + dlh = (void *) dlopen (dypath, RTLD_NOW); debugeprintf ("load_check_dynamic_module_index dlh=%p dypath=%s", dlh, dypath); - if (!dlh) - return 0; + if (!dlh) + { + debugeprintf("load_check_dynamic_module_index dlerror %s", dlerror()); + return 0; + }; /* we always check that a basilys_md5 exists within the dynamically loaded stuff; otherwise it was not generated from MELT/basilys */ - dynmd5 = (char *) lt_dlsym ((lt_dlhandle) dlh, "melt_md5"); + dynmd5 = (char *) dlsym ((void *) dlh, "melt_md5"); if (!dynmd5) - dynmd5 = (char *) lt_dlsym ((lt_dlhandle) dlh, "basilys_md5"); + dynmd5 = (char *) dlsym ((void *) dlh, "basilys_md5"); debugeprintf ("dynmd5=%s", dynmd5); if (!dynmd5) { @@ -5009,10 +5005,10 @@ load_checked_dynamic_module_index (const char *dypath, char *md5src) goto bad; } dyncomptimstamp = - (char *) lt_dlsym ((lt_dlhandle) dlh, "melt_compiled_timestamp"); + (char *) dlsym ((void *) dlh, "melt_compiled_timestamp"); if (!dyncomptimstamp) dyncomptimstamp = - (char *) lt_dlsym ((lt_dlhandle) dlh, "basilys_compiled_timestamp"); + (char *) dlsym ((void *) dlh, "basilys_compiled_timestamp"); debugeprintf ("dyncomptimstamp=%s", dyncomptimstamp); if (!dyncomptimstamp) { @@ -5021,34 +5017,34 @@ load_checked_dynamic_module_index (const char *dypath, char *md5src) }; /* check the checksum of the generating compiler with current */ dynchecksum = - (char *) lt_dlsym ((lt_dlhandle) dlh, "genchecksum_melt"); + (char *) dlsym ((void *) dlh, "genchecksum_melt"); if (dynchecksum && memcmp(dynchecksum, executable_checksum, 16)) warning(0, "loaded MELT plugin %s with a checksum mismatch!", dypath); PTR_UNION_AS_VOID_PTR(startrout_uf) = - lt_dlsym ((lt_dlhandle) dlh, "start_module_melt"); + dlsym ((void *) dlh, "start_module_melt"); if (!PTR_UNION_AS_VOID_PTR(startrout_uf)) PTR_UNION_AS_VOID_PTR(startrout_uf) - = lt_dlsym ((lt_dlhandle) dlh, "start_module_basilys"); + = dlsym ((void *) dlh, "start_module_basilys"); if (!PTR_UNION_AS_VOID_PTR(startrout_uf)) { warning (0, "missing start_module routine in MELT module %s", dypath); goto bad; }; PTR_UNION_AS_VOID_PTR(markrout_uf) = - lt_dlsym ((lt_dlhandle) dlh, "mark_module_melt"); + dlsym ((void *) dlh, "mark_module_melt"); if (!PTR_UNION_AS_VOID_PTR(markrout_uf)) PTR_UNION_AS_VOID_PTR(markrout_uf) = - lt_dlsym ((lt_dlhandle) dlh, "mark_module_basilys"); + dlsym ((void *) dlh, "mark_module_basilys"); if (!PTR_UNION_AS_VOID_PTR(markrout_uf)) { warning (0, "missing mark_module routine in MELT module %s", dypath); goto bad; }; PTR_UNION_AS_VOID_PTR(iniframe_up) - = lt_dlsym ((lt_dlhandle) dlh, "initial_frame_melt"); + = dlsym ((void *) dlh, "initial_frame_melt"); if (!PTR_UNION_AS_VOID_PTR(iniframe_up) ) PTR_UNION_AS_VOID_PTR(iniframe_up) = - lt_dlsym ((lt_dlhandle) dlh, "initial_frame_basilys"); + dlsym ((void *) dlh, "initial_frame_basilys"); if (!PTR_UNION_AS_VOID_PTR(iniframe_up)) { warning (0, "missing initial_frame routine in MELT module %s", dypath); @@ -5092,8 +5088,8 @@ load_checked_dynamic_module_index (const char *dypath, char *md5src) return ix; bad: debugeprintf ("load_checked_dynamic_module_index failed dlerror:%s", - lt_dlerror ()); - lt_dlclose ((lt_dlhandle) dlh); + dlerror ()); + dlclose ((void *) dlh); return 0; } @@ -5104,14 +5100,59 @@ basilys_dlsym_all (const char *nam) basilys_module_info_t *mi = 0; for (ix = 0; VEC_iterate (basilys_module_info_t, modinfvec, ix, mi); ix++) { - void *p = (void *) lt_dlsym ((lt_dlhandle) mi->dlh, nam); + void *p = (void *) dlsym ((void *) mi->dlh, nam); if (p) return p; }; - return (void *) lt_dlsym (proghandle, nam); + return (void *) dlsym (proghandle, nam); } + +/* lookup inside a colon-separated PATH for a file of given base and + suffix; return the malloc-ed full file path if found */ +static char* +lookup_path(const char*path, const char* base, const char* suffix) +{ + const char* pc = NULL; + const char* col = NULL; + char* dir = NULL; + char* filnam = NULL; + size_t dirnamlen = 0; + debugeprintf ("start lookup_path path=%s base=%s suffix=%s", path, base, suffix); + if (!path || !base) + return NULL; + pc = path; + do { + col = strchr(pc, ':'); + if (!col) + col = pc + strlen(pc); + dirnamlen = col - pc; + dir = xstrndup(pc, dirnamlen); + if (dir && *dir) + { + filnam = concat(dir, "/", base, suffix, NULL); + free (dir); + dir = NULL; + } + else + filnam = concat("./", base, suffix, NULL); + if (!access (filnam, R_OK)) + { + debugeprintf("lookup_path found filnam %s", filnam); + return filnam; + } + free (filnam); + filnam = NULL; + if (*col == ':') + pc=col+1; + else + break; + } while (pc && *pc); + debugeprintf("lookup_path not found base %s suffix %s", base, suffix); + return NULL; +} + /* compile (as a dynamically loadable module) some (usually generated) C code (or a dynamically loaded stuff) and dynamically load it; the C code should contain a function named start_module_basilys; that @@ -5130,6 +5171,7 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) char *md5src = NULL; char *tmpath = NULL; char *dupmodulnam = NULL; + char *envpath = NULL; basilys_module_info_t *moduptr = 0; basilys_ptr_t (*startroutp) (basilys_ptr_t); /* start routine */ int modulnamlen = 0; @@ -5173,7 +5215,7 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) } /***** first find the source path if possible ******/ /* look first in the temporary directory */ - tmpath = basilys_tempdir_path (dupmodulnam, ".c"); + tmpath = melt_tempdir_path (dupmodulnam, ".c"); debugeprintf ("basilysgc_load_melt_module trying in tempdir %s", tmpath); if (tmpath && !access (tmpath, R_OK)) { @@ -5183,29 +5225,32 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) } free(tmpath); tmpath = NULL; - /* look in the generated source dir */ - if (basilys_gensrcdir_string && basilys_gensrcdir_string[0]) - tmpath = concat (basilys_gensrcdir_string, "/", dupmodulnam, ".c", NULL); - debugeprintf ("basilysgc_load_melt_module trying in gensrcdir %s", tmpath); - if (tmpath && !access (tmpath, R_OK)) - { - debugeprintf ("basilysgc_load_melt_module found source in gensrcdir %s", tmpath); + /* look in the source path if given */ + if (melt_srcpath_string && melt_srcpath_string[0]) { + debugeprintf("basilysgc_load_melt_module trying in MELT srcpath %s", melt_srcpath_string); + tmpath = lookup_path (melt_srcpath_string, dupmodulnam, ".c"); + debugeprintf("basilysgc_load_melt_module got in MELT srcpath %s", tmpath); + if (tmpath) { srcpath = tmpath; goto foundsrcpath; } - free (tmpath); - tmpath = NULL; - /* look into the melt generated dir */ - tmpath = concat (melt_generated_dir, "/", dupmodulnam, ".c", NULL); - debugeprintf ("basilysgc_load_melt_module trying in meltgenerateddir %s", tmpath); - if (tmpath && !access (tmpath, R_OK)) - { - debugeprintf ("basilysgc_load_melt_module found source in meltgendir %s", tmpath); - srcpath = tmpath; - goto foundsrcpath; + } + else + envpath = getenv("GCCMELT_SOURCE_PATH"); + /* look into the GCCMELT_SOURCE_PATH environment variable if no + source path was given */ + if (envpath && *envpath) + { + debugeprintf("basilysgc_load_melt_module trying in GCCMELT_SOURCE_PATH %s", + envpath); + tmpath = lookup_path (envpath, dupmodulnam, ".c"); + debugeprintf("basilysgc_load_melt_module got in GCCMELT_SOURCE_PATH %s", tmpath); + if (tmpath) { + srcpath = tmpath; + goto foundsrcpath; + } } - free (tmpath); - tmpath = NULL; + /* perhaps use make_relative_prefix for the melt source directory ... */ /* look into the melt source dir */ tmpath = concat (melt_source_dir, "/", dupmodulnam, ".c", NULL); debugeprintf ("basilysgc_load_melt_module trying in meltsrcdir %s", tmpath); @@ -5219,19 +5264,20 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) tmpath = NULL; /* we didn't found the source */ debugeprintf ("basilysgc_load_melt_module cannot find source for mudule %s", dupmodulnam); - warning (0, "Didn't find MELT module %s 's C source code; perhaps need -fmelt-gensrcdir=...", dupmodulnam); + warning (0, "Didn't find MELT module %s 's C source code; perhaps need -fmelt-srcpath=...", dupmodulnam); inform (UNKNOWN_LOCATION, "MELT temporary source path tried %s for C source code", - basilys_tempdir_path (dupmodulnam, ".c")); + melt_tempdir_path (dupmodulnam, ".c")); { - /* explain only once the directories we searched the C source code in */ + /* explain only once the path we searched the C source code in */ static int nbexplain; if (nbexplain <= 0) { - if (basilys_gensrcdir_string && basilys_gensrcdir_string[0]) - inform (UNKNOWN_LOCATION, "MELT generated source given directory is %s", - basilys_gensrcdir_string); - inform (UNKNOWN_LOCATION, "MELT builtin generated source directory is %s", - melt_generated_dir); + if (melt_srcpath_string && melt_srcpath_string[0]) + inform (UNKNOWN_LOCATION, "MELT given source path is %s", + melt_srcpath_string); + if (envpath && envpath[0]) + inform (UNKNOWN_LOCATION, "MELT environment GCCMELT_SOURCE_PATH is %s", + envpath); inform (UNKNOWN_LOCATION, "MELT builtin source directory is %s", melt_source_dir); }; @@ -5267,15 +5313,17 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) dupmodulnam); } /** - we have to scan several dynlib directories to find the module; + We have to scan several dynlib directories to find the module; when we find a module, we dynamically load it to check that it - has the right md5 sum (i.e. that its basilys_md5 is correct); if - no dynlib is found, we have to compile the generated C source. + has the right md5 sum (i.e. that its melt_md5 is correct); if no + dynlib is found, we have to compile the generated C source. We + should really scan the module path incrementally, i.e. testing + the foo.so file in every element of the path. We don't do that yet. **/ /* if a dynlib directory is given, check it */ - if (basilys_dynlibdir_string && basilys_dynlibdir_string[0]) + if (melt_dynmodpath_string && melt_dynmodpath_string[0]) { - tmpath = concat (basilys_dynlibdir_string, "/", dupmodulnam, NULL); + tmpath = lookup_path (melt_dynmodpath_string, dupmodulnam, ".so"); BASILYS_LOCATION_HERE ("basilysgc_load_melt_module before load_checked_dylib pathed"); dlix = load_checked_dynamic_module_index (tmpath, md5src); @@ -5289,8 +5337,8 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) free (tmpath); tmpath = NULL; } - /* check in the builtin melt dynamic lib directory */ - tmpath = concat (melt_dynlib_dir, "/", dupmodulnam, NULL); + /* check in the builtin melt module directory */ + tmpath = concat (melt_module_dir, "/", dupmodulnam, NULL); BASILYS_LOCATION_HERE ("basilysgc_load_melt_module before load_checked_dylib builtin"); dlix = load_checked_dynamic_module_index (tmpath, md5src); @@ -5304,7 +5352,7 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) free (tmpath); tmpath = NULL; /* check in the temporary directory */ - tmpath = basilys_tempdir_path (dupmodulnam, NULL); + tmpath = melt_tempdir_path (dupmodulnam, ".so"); debugeprintf ("basilysgc_load_melt_module trying %s", tmpath); BASILYS_LOCATION_HERE ("basilysgc_load_melt_module before load_checked_dylib tmpath"); @@ -5322,7 +5370,7 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) /* if we really have the source, we can afford to check in the current directory */ if (md5src) { - tmpath = concat ("./", dupmodulnam, NULL); + tmpath = concat ("./", dupmodulnam, ".so", NULL); debugeprintf ("basilysgc_load_melt_module tmpath %s", tmpath); BASILYS_LOCATION_HERE ("basilysgc_load_melt_module before load_checked_dylib src"); @@ -5340,7 +5388,7 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) /* if we have the srcpath but did'nt found the stuff, try to compile it using the temporary directory */ if (srcpath) { - tmpath = basilys_tempdir_path (dupmodulnam, NULL); + tmpath = melt_tempdir_path (dupmodulnam, NULL); debugeprintf ("basilysgc_load_melt_module before compiling tmpath %s", tmpath); compile_to_dyl (srcpath, tmpath); debugeprintf ("basilysgc_compile srcpath=%s compiled to tmpath=%s", @@ -5360,10 +5408,10 @@ basilysgc_load_melt_module (basilys_ptr_t modata_p, const char *modulnam) /* catch all situation, failed to find the dynamic stuff */ /* give info to user */ error("failed to find dynamic stuff for MELT module %s (%s)", - dupmodulnam, lt_dlerror ()); + dupmodulnam, dlerror ()); inform (UNKNOWN_LOCATION, "not found dynamic stuff using tempdir %s", - basilys_tempdir_path (dupmodulnam, NULL)); + melt_tempdir_path (dupmodulnam, NULL)); if (srcpath) inform (UNKNOWN_LOCATION, "not found dynamic stuff using srcpath %s", @@ -5452,6 +5500,7 @@ basilys_ptr_t basilysgc_load_modulelist (basilys_ptr_t modata_p, const char *modlistbase) { char *modlistpath = 0; + char* envpath = 0; FILE *filmod = 0; /* @@@ ugly, we should have a getline function */ char linbuf[1024]; @@ -5466,44 +5515,56 @@ basilysgc_load_modulelist (basilys_ptr_t modata_p, const char *modlistbase) goto loadit; free (modlistpath); modlistpath = 0; - /* check for module list in melt_source_dir */ + /* check for module list in given melt source path */ + if (melt_srcpath_string && melt_srcpath_string[0]) + { + modlistpath = lookup_path(melt_srcpath_string, modlistbase, MODLIS_SUFFIX); + if (modlistpath) + goto loadit; + } + else + envpath = getenv("GCCMELT_SOURCE_PATH"); + /* check for module list in $GCCMELT_SOURCE_PATH */ + if (envpath && envpath[0]) + { + modlistpath = lookup_path(envpath, modlistbase, MODLIS_SUFFIX); + if (modlistpath) + goto loadit; + } + envpath = NULL; + /* check for module list in builtin melt_source_dir */ modlistpath = concat (melt_source_dir, "/", modlistbase, MODLIS_SUFFIX, NULL); if (!access (modlistpath, R_OK)) goto loadit; free (modlistpath); modlistpath = 0; - /* check for module list in dynamic library dir */ - if (basilys_dynlibdir_string && basilys_dynlibdir_string[0]) + /* check for module list in module path */ + if (melt_dynmodpath_string && melt_dynmodpath_string[0]) { - modlistpath = concat (basilys_dynlibdir_string, - "/", modlistbase, MODLIS_SUFFIX, NULL); - if (!access (modlistpath, R_OK)) + modlistpath = lookup_path (melt_dynmodpath_string, modlistbase, MODLIS_SUFFIX); + if (modlistpath) goto loadit; } - free (modlistpath); - modlistpath = 0; - /* check for module list in melt_dynlib_dir */ - modlistpath = concat (melt_dynlib_dir, + else + envpath = getenv("GCCMELT_MODULE_PATH"); + /* check for module list in $GCCMELT_MODULE_PATH */ + if (envpath && envpath[0]) + { + modlistpath = lookup_path(envpath, modlistbase, MODLIS_SUFFIX); + if (modlistpath) + goto loadit; + } + envpath = NULL; + /* check for module list in melt_module_dir */ + modlistpath = concat (melt_module_dir, "/", modlistbase, MODLIS_SUFFIX, NULL); if (!access (modlistpath, R_OK)) goto loadit; free (modlistpath); modlistpath = 0; - /* check for module list in gensrcdir */ - if (basilys_gensrcdir_string && basilys_gensrcdir_string[0]) - { - /* check for modfile in the gensrcdir */ - modlistpath = - concat (basilys_gensrcdir_string, "/", modlistbase, MODLIS_SUFFIX, - NULL); - if (!access (modlistpath, R_OK)) - goto loadit; - } - free (modlistpath); - modlistpath = 0; /* check in the temporary directory */ - modlistpath = basilys_tempdir_path (modlistbase, MODLIS_SUFFIX); + modlistpath = melt_tempdir_path (modlistbase, MODLIS_SUFFIX); if (!access (modlistpath, R_OK)) goto loadit; free (modlistpath); @@ -7228,13 +7289,13 @@ do_initial_command (basilys_ptr_t modata_p) #define resv curfram__.varptr[7] modatav = modata_p; debugeprintf ("do_initial_command mode_string %s modatav %p", - basilys_mode_string, (void *) modatav); + melt_mode_string, (void *) modatav); if (basilys_magic_discr ((BASILYSG (INITIAL_SYSTEM_DATA))) != OBMAG_OBJECT || BASILYSGOB (INITIAL_SYSTEM_DATA)->obj_len < FSYSDAT_CMD_FUNDICT + 1 || !BASILYSGOB (INITIAL_SYSTEM_DATA)->obj_vartab - || !basilys_mode_string || !basilys_mode_string[0]) + || !melt_mode_string || !melt_mode_string[0]) goto end; dictv = BASILYSGOB (INITIAL_SYSTEM_DATA)->obj_vartab[FSYSDAT_CMD_FUNDICT]; debugeprintf ("do_initial_command dictv=%p", dictv); @@ -7243,43 +7304,43 @@ do_initial_command (basilys_ptr_t modata_p) goto end; closv = basilys_get_mapstrings ((struct basilysmapstrings_st *) dictv, - basilys_mode_string); + melt_mode_string); debugeprintf ("do_initial_command closv=%p", closv); if (basilys_magic_discr ((basilys_ptr_t) closv) != OBMAG_CLOSURE) { - error ("no closure for basilys command %s", basilys_mode_string); + error ("no closure for basilys command %s", melt_mode_string); goto end; }; debugeprintf ("do_initial_command argument_string %s", - basilys_argument_string); + melt_argument_string); debugeprintf ("do_initial_command arglist_string %s", - basilys_arglist_string); + melt_arglist_string); debugeprintf ("do_initial_command secondargument_string %s", - basilys_secondargument_string); - if (basilys_argument_string && basilys_argument_string[0] - && basilys_arglist_string && basilys_arglist_string[0]) + melt_secondargument_string); + if (melt_argument_string && melt_argument_string[0] + && melt_arglist_string && melt_arglist_string[0]) { error ("cannot have both -fmelt-arg=%s & -fmelt-arglist=%s given as program arguments", - basilys_argument_string, basilys_arglist_string); + melt_argument_string, melt_arglist_string); goto end; } { union basilysparam_un pararg[3]; memset (pararg, 0, sizeof (pararg)); - if (basilys_argument_string && basilys_argument_string[0]) + if (melt_argument_string && melt_argument_string[0]) { cstrv = basilysgc_new_string (BASILYSGOB (DISCR_STRING), - basilys_argument_string); + melt_argument_string); pararg[0].bp_aptr = (basilys_ptr_t *) & cstrv; } - else if (basilys_arglist_string && basilys_arglist_string[0]) + else if (melt_arglist_string && melt_arglist_string[0]) { char *comma = 0; char *pc = 0; arglv = basilysgc_new_list (BASILYSGOB (DISCR_LIST)); - for (pc = CONST_CAST(char *, basilys_arglist_string); pc; + for (pc = CONST_CAST(char *, melt_arglist_string); pc; pc = comma ? (comma + 1) : 0) { comma = strchr (pc, ','); @@ -7293,17 +7354,17 @@ do_initial_command (basilys_ptr_t modata_p) } pararg[0].bp_aptr = (basilys_ptr_t *) & arglv; }; - if (basilys_secondargument_string && basilys_secondargument_string[0]) + if (melt_secondargument_string && melt_secondargument_string[0]) { csecstrv = basilysgc_new_string (BASILYSGOB (DISCR_STRING), - basilys_secondargument_string); + melt_secondargument_string); pararg[1].bp_aptr = (basilys_ptr_t *) & csecstrv; } else { debugeprintf ("do_initial_command no second argument %p", - basilys_secondargument_string); + melt_secondargument_string); csecstrv = NULL; pararg[1].bp_aptr = (basilys_ptr_t *) 0; } @@ -7320,7 +7381,7 @@ do_initial_command (basilys_ptr_t modata_p) exit_after_options = (resv == NULL); } end: - debugeprintf ("do_initial_command end %s", basilys_argument_string); + debugeprintf ("do_initial_command end %s", melt_argument_string); BASILYS_EXITFRAME (); #undef dictv #undef closv @@ -7348,15 +7409,15 @@ load_basilys_modules_and_do_command (void) BASILYS_ENTERFRAME (2, NULL); #define modatv curfram__.varptr[0] debugeprintf ("load_initial_basilys_modules start init=%s command=%s", - basilys_init_string, basilys_mode_string); + melt_init_string, melt_mode_string); /* if there is no -fmelt-init use the default list of modules */ - if (!basilys_init_string || !basilys_init_string[0]) + if (!melt_init_string || !melt_init_string[0]) { - basilys_init_string = "@" MELT_DEFAULT_MODLIS; - debugeprintf("basilys_init_string set to default %s", basilys_init_string); + melt_init_string = "@" MELT_DEFAULT_MODLIS; + debugeprintf("melt_init_string set to default %s", melt_init_string); } - dupmodpath = xstrdup (basilys_init_string); - if (flag_basilys_debug) + dupmodpath = xstrdup (melt_init_string); + if (flag_melt_debug) { fflush (stderr); #define modatv curfram__.varptr[0] @@ -7364,7 +7425,7 @@ load_basilys_modules_and_do_command (void) fflush (stderr); } #if ENABLE_CHECKING - if (flag_basilys_debug) + if (flag_melt_debug) { char *tracenam = getenv ("BASILYSTRACE"); if (tracenam) @@ -7428,25 +7489,25 @@ load_basilys_modules_and_do_command (void) * then we do the command if needed **/ /* the command exit is builtin */ - if (basilys_mode_string && !strcmp (basilys_mode_string, "exit")) + if (melt_mode_string && !strcmp (melt_mode_string, "exit")) exit_after_options = true; /* other commands */ else if (basilys_magic_discr ((BASILYSG (INITIAL_SYSTEM_DATA))) == OBMAG_OBJECT && BASILYSGOB (INITIAL_SYSTEM_DATA)->obj_len >= - FSYSDAT_CMD_FUNDICT && basilys_mode_string - && basilys_mode_string[0]) + FSYSDAT_CMD_FUNDICT && melt_mode_string + && melt_mode_string[0]) { debugeprintf ("load_basilys_modules_and_do_command sets exit_after_options for command %s", - basilys_mode_string); + melt_mode_string); BASILYS_LOCATION_HERE ("load_initial_basilys_modules before do_initial_command"); do_initial_command ((basilys_ptr_t) modatv); debugeprintf ("load_basilys_modules_and_do_command after do_initial_command command_string %s", - basilys_mode_string); - if (dump_file == stderr && flag_basilys_debug) + melt_mode_string); + if (dump_file == stderr && flag_melt_debug) { debugeprintf ("load_basilys_modules_and_do_command dump_file cleared was %p", @@ -7455,9 +7516,9 @@ load_basilys_modules_and_do_command (void) dump_file = 0; } } - else if (basilys_mode_string) + else if (melt_mode_string) fatal_error ("basilys with command string %s without command dispatcher", - basilys_mode_string); + melt_mode_string); debugeprintf ("load_basilys_modules_and_do_command ended with %ld GarbColl, %ld fullGc", basilys_nb_garbcoll, basilys_nb_full_garbcoll); @@ -7472,7 +7533,7 @@ load_basilys_modules_and_do_command (void) free (dupmodpath); debugeprintf ("load_basilys_modules_and_do_command done modules %s command %s", - basilys_init_string, basilys_mode_string); + melt_init_string, melt_mode_string); BASILYS_EXITFRAME (); #undef modatv } @@ -7535,12 +7596,12 @@ basilys_initialize (void) /* don't use the index 0 so push a null */ VEC_safe_push (basilys_module_info_t, heap, modinfvec, (basilys_module_info_t *) 0); - proghandle = lt_dlopen (NULL); + proghandle = dlopen (NULL, RTLD_NOW); if (!proghandle) fatal_error ("basilys failed to get whole program handle - %s", - lt_dlerror ()); - if (count_basilys_debugskip_string != (char *) 0) - basilys_debugskipcount = atol (count_basilys_debugskip_string); + dlerror ()); + if (count_melt_debugskip_string != (char *) 0) + basilys_debugskipcount = atol (count_melt_debugskip_string); seed = 0; randomseed = get_random_seed (false); gcc_assert (randomseed != (char *) 0); @@ -7585,15 +7646,13 @@ basilys_initialize (void) debugeprintf ("basilys_initialize melt_private_include_dir=%s", melt_private_include_dir); debugeprintf ("basilys_initialize melt_source_dir=%s", melt_source_dir); - debugeprintf ("basilys_initialize melt_generated_dir=%s", - melt_generated_dir); - debugeprintf ("basilys_initialize melt_dynlib_dir=%s", melt_dynlib_dir); - debugeprintf ("basilys_initialize basilys_init_string=%s", basilys_init_string); + debugeprintf ("basilys_initialize melt_module_dir=%s", melt_module_dir); + debugeprintf ("basilys_initialize melt_init_string=%s", melt_init_string); if (ppl_set_error_handler(basilys_ppl_error_handler)) fatal_error ("failed to set PPL handler"); load_basilys_modules_and_do_command (); debugeprintf ("basilys_initialize ended init=%s command=%s", - basilys_init_string, basilys_mode_string); + melt_init_string, melt_mode_string); } @@ -7627,7 +7686,7 @@ basilys_dynobjstruct_fieldoffset_at (const char *fldnam, const char *fil, ptr = basilys_dlsym_all (nam); if (!ptr) fatal_error ("basilys failed to find field offset %s - %s (%s:%d)", nam, - lt_dlerror (), fil, lin); + dlerror (), fil, lin); free (nam); return (int *) ptr; } @@ -7643,7 +7702,7 @@ basilys_dynobjstruct_classlength_at (const char *clanam, const char *fil, ptr = basilys_dlsym_all (nam); if (!ptr) fatal_error ("basilys failed to find class length %s - %s (%s:%d)", nam, - lt_dlerror (), fil, lin); + dlerror (), fil, lin); free (nam); return (int *) ptr; } @@ -8222,30 +8281,30 @@ basilys_dbgshortbacktrace (const char *msg, int maxdepth) static void fatal_gdbm (char *msg) { - fatal_error ("fatal basilys GDBM (%s) error : %s", basilys_gdbmstate_string, + fatal_error ("fatal basilys GDBM (%s) error : %s", melt_gdbmstate_string, msg); } static inline GDBM_FILE -get_basilys_gdbm (void) +get_melt_gdbm (void) { if (gdbm_basilys) return gdbm_basilys; - if (!basilys_gdbmstate_string || !basilys_gdbmstate_string[0]) + if (!melt_gdbmstate_string || !melt_gdbmstate_string[0]) return NULL; gdbm_basilys = - gdbm_open (CONST_CAST(char*, basilys_gdbmstate_string), 8192, GDBM_WRCREAT, 0600, + gdbm_open (CONST_CAST(char*, melt_gdbmstate_string), 8192, GDBM_WRCREAT, 0600, fatal_gdbm); if (!gdbm_basilys) fatal_error ("failed to lazily open basilys GDBM (%s) - %m", - basilys_gdbmstate_string); + melt_gdbmstate_string); return gdbm_basilys; } bool basilys_has_gdbmstate (void) { - return get_basilys_gdbm () != NULL; + return get_melt_gdbm () != NULL; } basilys_ptr_t @@ -8253,7 +8312,7 @@ basilysgc_fetch_gdbmstate_constr (const char *key) { datum keydata = { 0, 0 }; datum valdata = { 0, 0 }; - GDBM_FILE dbf = get_basilys_gdbm (); + GDBM_FILE dbf = get_melt_gdbm (); BASILYS_ENTERFRAME (1, NULL); #define restrv curfram__.varptr[0] if (!dbf || !key || !key[0]) @@ -8280,7 +8339,7 @@ basilysgc_fetch_gdbmstate (basilys_ptr_t key_p) datum keydata = { 0, 0 }; datum valdata = { 0, 0 }; int keymagic = 0; - GDBM_FILE dbf = get_basilys_gdbm (); + GDBM_FILE dbf = get_melt_gdbm (); BASILYS_ENTERFRAME (3, NULL); #define restrv curfram__.varptr[0] #define keyv curfram__.varptr[1] @@ -8341,7 +8400,7 @@ basilysgc_put_gdbmstate_constr (const char *key, basilys_ptr_t data_p) datum keydata = { 0, 0 }; datum valdata = { 0, 0 }; int datamagic = 0; - GDBM_FILE dbf = get_basilys_gdbm (); + GDBM_FILE dbf = get_melt_gdbm (); BASILYS_ENTERFRAME (2, NULL); #define datav curfram__.varptr[0] #define dstrv curfram__.varptr[1] @@ -8399,7 +8458,7 @@ basilysgc_put_gdbmstate (basilys_ptr_t key_p, basilys_ptr_t data_p) datum valdata = { 0, 0 }; int keymagic = 0; int datamagic = 0; - GDBM_FILE dbf = get_basilys_gdbm (); + GDBM_FILE dbf = get_melt_gdbm (); BASILYS_ENTERFRAME (4, NULL); #define keyv curfram__.varptr[0] #define kstrv curfram__.varptr[1] @@ -9536,7 +9595,7 @@ basilysgc_gimple_gate(void) #define passdictv curfram__.varptr[1] #define closv curfram__.varptr[2] #define resv curfram__.varptr[3] - if (!basilys_mode_string || !basilys_mode_string[0]) + if (!melt_mode_string || !melt_mode_string[0]) goto end; passdictv = basilys_object_nth_field ((basilys_ptr_t) @@ -9578,7 +9637,7 @@ basilysgc_gimple_execute(void) #define passdictv curfram__.varptr[1] #define closv curfram__.varptr[2] #define resvalv curfram__.varptr[3] - if (!basilys_mode_string || !basilys_mode_string[0]) + if (!melt_mode_string || !melt_mode_string[0]) goto end; passdictv = basilys_object_nth_field ((basilys_ptr_t) @@ -9605,7 +9664,7 @@ basilysgc_gimple_execute(void) debugeprintf ("gimple_execute passname %s dbgcounter %ld cfun %p ", current_pass->name, basilys_dbgcounter, (void *) cfun); - if (cfun && flag_basilys_debug) + if (cfun && flag_melt_debug) debug_tree (cfun->decl); debugeprintf ("gimple_execute passname %s before apply", current_pass->name); @@ -9639,7 +9698,7 @@ basilysgc_rtl_gate(void) #define passdictv curfram__.varptr[1] #define closv curfram__.varptr[2] #define resv curfram__.varptr[3] - if (!basilys_mode_string || !basilys_mode_string[0]) + if (!melt_mode_string || !melt_mode_string[0]) goto end; passdictv = basilys_object_nth_field ((basilys_ptr_t) @@ -9683,7 +9742,7 @@ basilysgc_rtl_execute(void) #define passdictv curfram__.varptr[1] #define closv curfram__.varptr[2] #define namev curfram__.varptr[3] - if (!basilys_mode_string || !basilys_mode_string[0]) + if (!melt_mode_string || !melt_mode_string[0]) goto end; passdictv = basilys_object_nth_field ((basilys_ptr_t) @@ -9743,7 +9802,7 @@ basilysgc_simple_ipa_gate(void) #define passdictv curfram__.varptr[1] #define closv curfram__.varptr[2] #define resv curfram__.varptr[3] - if (!basilys_mode_string || !basilys_mode_string[0]) + if (!melt_mode_string || !melt_mode_string[0]) goto end; passdictv = basilys_object_nth_field ((basilys_ptr_t) @@ -9787,7 +9846,7 @@ basilysgc_simple_ipa_execute(void) #define passdictv curfram__.varptr[1] #define closv curfram__.varptr[2] #define namev curfram__.varptr[3] - if (!basilys_mode_string || !basilys_mode_string[0]) + if (!melt_mode_string || !melt_mode_string[0]) goto end; passdictv = basilys_object_nth_field ((basilys_ptr_t) @@ -9860,7 +9919,7 @@ basilysgc_register_pass (basilys_ptr_t pass_p, #define compv curfram__.varptr[2] #define namev curfram__.varptr[3] passv = pass_p; - if (!basilys_mode_string || !basilys_mode_string[0]) + if (!melt_mode_string || !melt_mode_string[0]) goto end; if (!refpassname || !refpassname[0]) goto end; diff --git a/gcc/basilys.h b/gcc/basilys.h index f7797e2cc92..191b563cf63 100644 --- a/gcc/basilys.h +++ b/gcc/basilys.h @@ -77,18 +77,18 @@ extern void fatal_error (const char *, ...); extern long basilys_dbgcounter; extern long basilys_debugskipcount; -#define debugeprintf_raw(Fmt,...) do{if (flag_basilys_debug) \ +#define debugeprintf_raw(Fmt,...) do{if (flag_melt_debug) \ {fprintf(stderr, Fmt, ##__VA_ARGS__); fflush(stderr);}}while(0) #define debugeprintf(Fmt,...) debugeprintf_raw("!@%s:%d:\n@! " Fmt "\n", \ basename(__FILE__), __LINE__, ##__VA_ARGS__) #define debugeprintfnonl(Fmt,...) debugeprintf_raw("!@%s:%d:\n@! " Fmt, \ basename(__FILE__), __LINE__, ##__VA_ARGS__) -#define debugeprintvalue(Msg,Val) do{if (flag_basilys_debug){ \ +#define debugeprintvalue(Msg,Val) do{if (flag_melt_debug){ \ void* __val = (Val); \ fprintf(stderr,"!@%s:%d:\n@! %s @%p= ", \ basename(__FILE__), __LINE__, (Msg), __val); \ basilys_dbgeprint(__val); }} while(0) -#define debugebacktrace(Msg,Depth) do{if (flag_basilys_debug){ \ +#define debugebacktrace(Msg,Depth) do{if (flag_melt_debug){ \ void* __val = (Val); \ fprintf(stderr,"!@%s:%d: %s **backtrace** ", \ basename(__FILE__), __LINE__, (Msg)); \ @@ -2647,7 +2647,7 @@ void basilys_finalize (void); void* basilys_dlsym_all(const char*nam); /* returns malloc-ed path inside a temporary directory, with a given basename & suffix */ -char* basilys_tempdir_path(const char* basnam, const char* suffix); +char* melt_tempdir_path(const char* basnam, const char* suffix); /*** Load a MELT module by its name, which is only made of letters, @@ -3282,7 +3282,7 @@ debugeputs_at (const char *fil, int lin, const char *msg) static inline void debugvalue_at (const char *fil, int lin, const char *msg, void *val) { - if (flag_basilys_debug) + if (flag_melt_debug) { fprintf (stderr, "!@%s:%d:\n@! %s @%p/%d= ", basename (fil), lin, (msg), val, basilys_magic_discr ((basilys_ptr_t)val)); @@ -3297,7 +3297,7 @@ void basilysgc_debugmsgval(void* val, const char*msg, long count); static inline void debugmsgval_at (const char*fil, int lin, const char* msg, void*val, long count) { - if (flag_basilys_debug) + if (flag_melt_debug) { fprintf (stderr, "!@%s:%d:\n", basename (fil), lin); @@ -3311,7 +3311,7 @@ debugmsgval_at (const char*fil, int lin, const char* msg, void*val, long count) static inline void debugbacktrace_at (const char *fil, int lin, const char *msg, int depth) { - if (flag_basilys_debug) + if (flag_melt_debug) { fprintf (stderr, "\n!@%s:%d: %s ** BACKTRACE** ", basename (fil), lin, msg); @@ -3397,5 +3397,7 @@ void basilysgc_put_gdbmstate_constr (const char *key, basilys_ptr_t data_p); nothing */ void basilysgc_put_gdbmstate (basilys_ptr_t key_p, basilys_ptr_t data_p); + + #endif /*BASILYS_INCLUDED_ */ /* eof basilys.h */ diff --git a/gcc/common.opt b/gcc/common.opt index 76f5de0229b..f5ed4493a5f 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -329,71 +329,71 @@ fauto-inc-dec Common Report Var(flag_auto_inc_dec) Init(1) Generate auto-inc/dec instructions -;;;;;; basilys/MELT stuff +;;;;;; MELT stuff ; global GCC analysis by Basile (source file gcc/basilys.c) fmelt= -Common Report Var(basilys_mode_string) Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) +Common Report Var(melt_mode_string) Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) Basile's mode with command or analysis to run. Uses -fmelt=help for more. -; argument string for basilys +; argument string for melt fmelt-arg= -Common Report Var(basilys_argument_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) -Initial argument for basilys analysis +Common Report Var(melt_argument_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) +Initial argument for melt analysis -; argument list string for basilys +; argument list string for melt fmelt-arglist= -Common Report Var(basilys_arglist_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) -Initial comma separated argument list for basilys analysis +Common Report Var(melt_arglist_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && NABLE_BASILYSMELT) +Initial comma separated argument list for melt analysis -; compile script used to compile C files generated by basilys +; compile script used to compile C files generated by melt fmelt-compile-script= -Common Report Var(basilys_compile_script_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL & ENABLE_BASILYSMELT) -compile script invoked by basilys on generated C files +Common Report Var(melt_compile_script_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) +compile script invoked by melt on generated C files ; debug flag for above analysis fmelt-debug -Common Report Var(flag_basilys_debug) Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) +Common Report Var(flag_melt_debug) Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) Gives lots of debugging stuff for -fmelt analysis ; debug skip for above analysis fmelt-debugskip= -Common Report Var(count_basilys_debugskip_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) +Common Report Var(count_melt_debugskip_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) Counter of debug prints to skip for -fmelt-debug -; dynlib plugin directory for basilys -fmelt-dynlibdir= -Common Report Var(basilys_dynlibdir_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) -Dynlib plugin directory for basilys +; dynamic module path for MELT +fmelt-module-path= +Common Report Var(melt_dynmodpath_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) +Dynamic module colon-separated path for MELT [or $GCCMELT_MODULE_PATH] ; shared GDBM indexed file to keep state fmelt-gdbmstate= -Common Report Var(basilys_gdbmstate_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) +Common Report Var(melt_gdbmstate_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) Shared GDBM state indexed file. Should be explicitly given. -; generated source directory for basilys -fmelt-gensrcdir= -Common Report Var(basilys_gensrcdir_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) -Generated source directory for basilys +; source path for melt -either *.melt or *.c files +fmelt-source-path= +Common Report Var(melt_srcpath_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) +Source colon-separated path for MELT [or $GCCMELT_SOURCE_PATH] ; initial C or dynamic lib modules for above analysis fmelt-init= -Common Report Var(basilys_init_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) -Initial semi-colon separated list of modules for -fmelt analysis (dynamic C mode) +Common Report Var(melt_init_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) +Initial colon separated list of modules for -fmelt analysis (dynamic C mode) -; second argument string for basilys +; second argument string for melt fmelt-secondarg= -Common Report Var(basilys_secondargument_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) -Second argument for basilys analysis +Common Report Var(melt_secondargument_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) +Second argument for melt analysis -; temporary directory for basilys +; temporary directory for melt fmelt-tempdir= -Common Report Var(basilys_tempdir_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && HAVE_LIBTOOLDYNL && ENABLE_BASILYSMELT) -Temporary directory for basilys (is not cleaned if specified) +Common Report Var(melt_tempdir_string) RejectNegative Joined Condition(HAVE_PARMAPOLY && ENABLE_BASILYSMELT) +Temporary directory for melt (is not cleaned if specified) -;;;;;;;;;; end of basilys/MELT stuff +;;;;;;;;;; end of Basile's MELT stuff ; -fcheck-bounds causes gcc to generate array bounds checks. ; For C, C++ and ObjC: defaults off. diff --git a/gcc/config.in b/gcc/config.in index 4fb678b646e..621dddebecd 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1109,12 +1109,6 @@ #endif -/* Define if Libtool dynamic linker is in use. */ -#ifndef USED_FOR_TARGET -#undef HAVE_LIBTOOLDYNL -#endif - - /* Define to 1 if you have the <limits.h> header file. */ #ifndef USED_FOR_TARGET #undef HAVE_LIMITS_H diff --git a/gcc/configure b/gcc/configure index fe5104e02b3..16e7661a0f9 100755 --- a/gcc/configure +++ b/gcc/configure @@ -458,7 +458,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP ppllibs pplinc ltdllibs ltdlinc ltdl_ldflags gdbmlibs gdbminc gdbm_ldflags BASILYSMELT_OBJECT loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file TM_ENDIAN_CONFIG TM_MULTILIB_CONFIG TM_MULTILIB_EXCEPTIONS_CONFIG extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines use_gcc_stdint c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC pluginlibs enable_plugin LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP ppllibs pplinc gdbmlibs gdbminc gdbm_ldflags BASILYSMELT_OBJECT loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file TM_ENDIAN_CONFIG TM_MULTILIB_CONFIG TM_MULTILIB_EXCEPTIONS_CONFIG extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines use_gcc_stdint c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC pluginlibs enable_plugin LIBOBJS LTLIBOBJS' ac_subst_files='language_hooks' ac_pwd=`pwd` @@ -1032,7 +1032,7 @@ Optional Features: passes; This enable complex (sciptable) passes using the Middle End Lisp Translator feature (which dynamically translates the MELT lisp dialect into C plug-in like code); This requires PPL (Parma Polyhedra -Library), GDBM and LTDL (LibTool Dynamic Loader) support. +Library) and GDBM support. --enable-werror-always enable -Werror despite compiler version --enable-checking=LIST enable expensive run-time checks. With LIST, @@ -1113,12 +1113,7 @@ Optional Packages: plus --with-ppl-lib=PATH/lib --with-ppl-include=PATH Specify directory for installed PPL include files --with-ppl-lib=PATH Specify the directory for the installed PPL library - --with-ltdl=PATH Specify prefix directory for installed LibTool Dynamic Loader library - Equivalent to --with-ltdl-include=PATH/include - plus --with-ltdl-lib=PATH/lib - --with-ltdl-include=PATH Specify directory for installed LTDL include files - --with-ltdl-lib=PATH Specify the directory for the installed LTDL library - --with-gdbm=PATH Specify prefix directory for installed LibTool Dynamic Loader library + --with-gdbm=PATH Specify prefix directory for installed GDBM library Equivalent to --with-gdbm-include=PATH/include plus --with-gdbm-lib=PATH/lib --with-gdbm-include=PATH Specify directory for installed GDBM include files @@ -7238,142 +7233,6 @@ fi ################ -# Check for LTDL (Libtool dynamic loader) -ltdllibs="-lltdl" -ltdlinc= -have_ltdl=yes - - -# Check whether --with-ltdl or --without-ltdl was given. -if test "${with_ltdl+set}" = set; then - withval="$with_ltdl" - -fi; - - -# Check whether --with-ltdl_include or --without-ltdl_include was given. -if test "${with_ltdl_include+set}" = set; then - withval="$with_ltdl_include" - -fi; - -# Check whether --with-ltdl_lib or --without-ltdl_lib was given. -if test "${with_ltdl_lib+set}" = set; then - withval="$with_ltdl_lib" - -fi; - - -if test "x$with_ltdl" != x; then - ltdllibs="-L$with_ltdl/lib -lltdl" - ltdlinc="-I$with_ltdl/include" -fi - -if test "x$ltdl_include" != x; then - ltdlinc="-I$ltdl_include $ltdlinc" -fi - -if test "x$ltdl_lib" != x; then - ltdllibs="-L$ltdl_lib -lltdl $ltdllibs" -fi - -ltdl_ldflags="" - -saved_CFLAGS="$CFLAGS" -saved_LIBS="$LIBS" -saved_LDFLAGS="$LD_FLAGS" -CFLAGS="$CFLAGS $ltdlinc" -LIBS="$LIBS $ltdllibs" -LDFLAGS="$LDFLAGS -rdynamic" -echo "$as_me:$LINENO: checking for LibTool Dynamic Loader" >&5 -echo $ECHO_N "checking for LibTool Dynamic Loader... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ltdl.h> -int -main () -{ - - lt_dlhandle h; - lt_dlinit (); - h = lt_dlopen ((const char *)0); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; have_ltdl=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; have_ltdl=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -if test "x$have_ltdl" != xyes; then - { echo "$as_me:$LINENO: WARNING: Some passes of GCC require LibTool Dynamic Loader. -Try the --with-ltdl option to specify the installed LTDL location. -Copies of this library source code can be found at its respective -hosting site as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/. -See also http://gcc.gnu.org/install/prerequisites.html for additional info." >&5 -echo "$as_me: WARNING: Some passes of GCC require LibTool Dynamic Loader. -Try the --with-ltdl option to specify the installed LTDL location. -Copies of this library source code can be found at its respective -hosting site as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/. -See also http://gcc.gnu.org/install/prerequisites.html for additional info." >&2;} -else - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBTOOLDYNL 1 -_ACEOF - - ltdl_ldflags="-rdynamic" -fi - -CFLAGS="$saved_CFLAGS" -LIBS="$saved_LIBS" -LDFLAGS="$saved_LDFLAGS" - -# Flags needed for LTDL - - - - - -# for debugging only -echo '%!%' after LTDL LIBS= $LIBS CFLAGS= $CFLAGS - -################ # Check for GDBM (GNU DBM - sort of database (actually inderxed file) gdbmlibs="-lgdbm" gdbminc= @@ -7608,13 +7467,6 @@ echo "$as_me: WARNING: Your system lacks the Parma Polyhedra Library (PPL) requi Hence Basilys/MELT is disabled." >&2;}; enabled_basilysmelt=no; fi - if test "$have_ltdl" != "yes" ; then - { echo "$as_me:$LINENO: WARNING: Your system lacks the LibTool Dynamic Loader library (LTDL) required for basilys/MELT. -Hence Basilys/MELT is disabled." >&5 -echo "$as_me: WARNING: Your system lacks the LibTool Dynamic Loader library (LTDL) required for basilys/MELT. -Hence Basilys/MELT is disabled." >&2;}; - enabled_basilysmelt=no; - fi fi if test "$enabled_basilysmelt" = "yes" ; then @@ -14990,13 +14842,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:14993: $ac_compile\"" >&5) + (eval echo "\"\$as_me:14845: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:14996: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:14848: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:14999: output\"" >&5) + (eval echo "\"\$as_me:14851: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -16153,7 +16005,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 16156 "configure"' > conftest.$ac_ext + echo '#line 16008 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -17452,11 +17304,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17455: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17307: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17459: \$? = $ac_status" >&5 + echo "$as_me:17311: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17791,11 +17643,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17794: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17646: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17798: \$? = $ac_status" >&5 + echo "$as_me:17650: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17896,11 +17748,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17899: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17751: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17903: \$? = $ac_status" >&5 + echo "$as_me:17755: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17951,11 +17803,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17954: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17806: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17958: \$? = $ac_status" >&5 + echo "$as_me:17810: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20763,7 +20615,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20766 "configure" +#line 20618 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -20859,7 +20711,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20862 "configure" +#line 20714 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -26399,9 +26251,6 @@ s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@ppllibs@,$ppllibs,;t t s,@pplinc@,$pplinc,;t t -s,@ltdllibs@,$ltdllibs,;t t -s,@ltdlinc@,$ltdlinc,;t t -s,@ltdl_ldflags@,$ltdl_ldflags,;t t s,@gdbmlibs@,$gdbmlibs,;t t s,@gdbminc@,$gdbminc,;t t s,@gdbm_ldflags@,$gdbm_ldflags,;t t diff --git a/gcc/configure.ac b/gcc/configure.ac index 562e82f0155..85ef246cb0d 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -385,79 +385,12 @@ AC_SUBST(pplinc) ################ -# Check for LTDL (Libtool dynamic loader) -ltdllibs="-lltdl" -ltdlinc= -have_ltdl=yes - -AC_ARG_WITH(ltdl, [ --with-ltdl=PATH Specify prefix directory for installed LibTool Dynamic Loader library - Equivalent to --with-ltdl-include=PATH/include - plus --with-ltdl-lib=PATH/lib]) - -AC_ARG_WITH(ltdl_include, [ --with-ltdl-include=PATH Specify directory for installed LTDL include files]) -AC_ARG_WITH(ltdl_lib, [ --with-ltdl-lib=PATH Specify the directory for the installed LTDL library]) - - -if test "x$with_ltdl" != x; then - ltdllibs="-L$with_ltdl/lib -lltdl" - ltdlinc="-I$with_ltdl/include" -fi - -if test "x$ltdl_include" != x; then - ltdlinc="-I$ltdl_include $ltdlinc" -fi - -if test "x$ltdl_lib" != x; then - ltdllibs="-L$ltdl_lib -lltdl $ltdllibs" -fi - -ltdl_ldflags="" - -saved_CFLAGS="$CFLAGS" -saved_LIBS="$LIBS" -saved_LDFLAGS="$LD_FLAGS" -CFLAGS="$CFLAGS $ltdlinc" -LIBS="$LIBS $ltdllibs" -LDFLAGS="$LDFLAGS -rdynamic" -AC_MSG_CHECKING([for LibTool Dynamic Loader]) -AC_TRY_LINK([#include <ltdl.h>],[ - lt_dlhandle h; - lt_dlinit (); - h = lt_dlopen ((const char *)0); -], [AC_MSG_RESULT([yes]); have_ltdl=yes], [AC_MSG_RESULT([no]); have_ltdl=no]) - -if test "x$have_ltdl" != xyes; then - AC_MSG_WARN([Some passes of GCC require LibTool Dynamic Loader. -Try the --with-ltdl option to specify the installed LTDL location. -Copies of this library source code can be found at its respective -hosting site as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/. -See also http://gcc.gnu.org/install/prerequisites.html for additional info.]) -else - AC_DEFINE(HAVE_LIBTOOLDYNL, 1, - [Define if Libtool dynamic linker is in use.]) - ltdl_ldflags="-rdynamic" -fi - -CFLAGS="$saved_CFLAGS" -LIBS="$saved_LIBS" -LDFLAGS="$saved_LDFLAGS" - -# Flags needed for LTDL -AC_SUBST(ltdllibs) -AC_SUBST(ltdlinc) -AC_SUBST(ltdl_ldflags) - - -# for debugging only -echo '%!%' after LTDL LIBS= $LIBS CFLAGS= $CFLAGS - -################ # Check for GDBM (GNU DBM - sort of database (actually inderxed file) gdbmlibs="-lgdbm" gdbminc= have_gdbm=yes -AC_ARG_WITH(gdbm, [ --with-gdbm=PATH Specify prefix directory for installed LibTool Dynamic Loader library +AC_ARG_WITH(gdbm, [ --with-gdbm=PATH Specify prefix directory for installed GDBM library Equivalent to --with-gdbm-include=PATH/include plus --with-gdbm-lib=PATH/lib]) @@ -553,7 +486,7 @@ AC_ARG_ENABLE(basilysmelt, [ --enable-basilysmelt Enable Basilys/MELT passes; This enable complex (sciptable) passes using the Middle End Lisp Translator feature (which dynamically translates the MELT lisp dialect into C plug-in like code); This requires PPL (Parma Polyhedra -Library), GDBM and LTDL (LibTool Dynamic Loader) support.], +Library) and GDBM support.], enabled_basilysmelt=$enableval, enabled_basilysmelt=no) if test "$enabled_basilysmelt" = "yes" ; then @@ -563,11 +496,6 @@ if test "$enabled_basilysmelt" = "yes" ; then Hence Basilys/MELT is disabled.]); enabled_basilysmelt=no; fi - if test "$have_ltdl" != "yes" ; then - AC_MSG_WARN([Your system lacks the LibTool Dynamic Loader library (LTDL) required for basilys/MELT. -Hence Basilys/MELT is disabled.]); - enabled_basilysmelt=no; - fi fi if test "$enabled_basilysmelt" = "yes" ; then diff --git a/gcc/doc/melt.texi b/gcc/doc/melt.texi index a975f5b42fc..1271fb10896 100644 --- a/gcc/doc/melt.texi +++ b/gcc/doc/melt.texi @@ -230,10 +230,19 @@ argument. When @code{-fmelt-debug} is given with @code{-fmelt-debugskip=1000} the first thousand debug messages are skipped, so are not printed. -@item -fmelt-gensrcdir= -@gccoptlist{-fmelt-gensrcdir=} -@opindex fmelt-gensrcdir= -This flag sets the directory containing MELT generated C files. +@item -fmelt-source-path= +@gccoptlist{-fmelt-source-path=} +@opindex fmelt-source-path= +This flag sets the path (colon separated list of directories) for +sources (i.e. @file{*.melt} and @file{*.c}). Otherwise use the +@code{GCCMELT_SOURCE_PATH} environment variable. + +@item -fmelt-module-path= +@gccoptlist{-fmelt-module-path=} +@opindex fmelt-module-path= +This flag sets the path (colon separated list of directories) for +MELT binary modules (i.e. @file{*.so}). Otherwise use the +@code{GCCMELT_MODULE_PATH} environment variable. @item -fmelt-gdbmstate= @gccoptlist{-fmelt-gdbmstate=} diff --git a/gcc/run-basilys.h b/gcc/run-basilys.h index 1f5c9561047..f21fae21287 100644 --- a/gcc/run-basilys.h +++ b/gcc/run-basilys.h @@ -69,11 +69,6 @@ Boston, MA 02110-1301, USA. */ #error required parma polyedral library PPL #endif /*HAVE_PARMAPOLY */ -#if HAVE_LIBTOOLDYNL -#include <ltdl.h> -#else -#error required libtool dynamic loader library LTDL -#endif /*HAVE_LIBTOOLDYNL */ #if ENABLE_BASILYSMELT #include "basilys.h" @@ -90,4 +85,5 @@ Boston, MA 02110-1301, USA. */ extern const char basilys_compiled_timestamp[]; extern const char basilys_md5[]; +#define flag_basilys_debug flag_melt_debug /* eof run-basilys.h */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 7a6c2656f2f..e83eaa169df 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -37,9 +37,6 @@ along with GCC; see the file COPYING3. If not see #include <ppl_c.h> #endif -#if HAVE_LIBTOOLDYNL -#include <ltdl.h> -#endif #ifdef HAVE_SYS_RESOURCE_H # include <sys/resource.h> @@ -1702,12 +1699,6 @@ general_init (const char *argv0) fatal_error ("failed to initialize Parma Polyedra Library"); #endif -#if HAVE_LIBTOOLDYNL - /* Initialize the Libtool Dynamic Loader */ - if (lt_dlinit() > 0) - fatal_error ("failed to initialize Libtool Dynamic Loader"); -#endif - /* Initialize register usage now so switches may override. */ init_reg_sets (); @@ -2368,7 +2359,6 @@ do_compile (void) if (!no_backend) backend_init (); - /* Language-dependent initialization. Returns true on success. */ if (lang_dependent_init (main_input_filename)) compile_file (); @@ -2406,12 +2396,20 @@ toplev_main (int argc, char **argv) init_local_tick (); + initialize_plugins (); + #if ENABLE_BASILYSMELT /* initialize basilys if needed */ - if (basilys_mode_string && basilys_mode_string[0]) + if (melt_mode_string && melt_mode_string[0]) basilys_initialize(); #endif + if (version_flag) + print_version (stderr, ""); + + if (help_flag) + print_plugins_help (stderr, ""); + /* Exit early if we can (e.g. -help). */ if (!exit_after_options) do_compile (); @@ -2419,7 +2417,7 @@ toplev_main (int argc, char **argv) #if ENABLE_BASILYSMELT /* finalize basilys if needed */ - if (basilys_mode_string && basilys_mode_string[0]) + if (melt_mode_string && melt_mode_string[0]) basilys_finalize(); #endif |