This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: automatic dependencies for gcc

Hello All,

Tom Tromey wrote:
"Basile" == Basile STARYNKEVITCH <> writes:

Basile> MELT is able to generate C code and to tldl_dlopenext (almost like Basile> dlopen-ing a dynamic library) the binary dynamically loadable stuff (a Basile> *.so ELF shared object on Linux & Solaris...) obtained from the Basile> generated code. Notice that this code generation and dynamic loading Basile> may happen within cc1 (for some peculiar long-lasting passes and Basile> compile flags).


Are you plugging passes into a cross compiler?

Yes, MELT is basically a [possibly generated] plugin stuff. The passes are at the GIMPLE level, so it could be a cross compiler.

It seems to me that if you are only working with native compilers, then it would be easy to just build these objects with the installed gcc, and that would let you simplify the build stuff a bit.

Basile> run-basilys.d: run-basilys.h \

Cute trick :-)

Basile> Maybe using depcomp could help, but I don't know how.

For depcomp, you must first discover "dependency mode" of the compiler
you plan to use.  There's some configure code to do this.  Then you
run it as a wrapper around the compiler, with some variable settings
to tell it what to do.

If you're doing this stuff in the context of gcc/Makefile, you can
just use the infrastructure there.  It will already know properties of
the compiler.

If you're doing this at gcc-runtime, well... simplest would be to make
the user pick a compiler, preferably gcc; then just always use that
one and code its properties into whatever Makefile you use at runtime.

The gcc/ of the MELT branch generates a script melt_compile_script=$(libexecsubdir)/melt-cc-script
(the $(libexecsubdir)/melt-cc-script path is its installed place)
and this script compiles the generated code with the appropriate flags (mostly -fPIC -shared and -I....meltincludedir....

This script may be invoked by cc1 when a C file has been generated. This script is supposed to produce a dynamically loadable stuff (e.g. *.so shared object on ELF/Linux) which is then loaded by ltld_dlopenext. All this (the *.c generation, the script invocation to compile it into a *.so, the dlopen-ing of this *.so) happens in the same cc1 process.

But, I'm not sure I fully understand what you're trying to do.
I tried to explain it here, and with a little bit more details on the Wiki. Please tell me what is not clear enough.

A big thanks for your comments.

PS: I don't know if this discussion belongs better to the gcc@ list or to the gcc-patches@ list!
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]