Hi Ben, > To demonstrate what I meant, I spent a bit of time working on > modules/relocatable-prog-wrapper, coming up with this: > > Makefile.am: > if !RELOCATABLE_VIA_LD > noinst_PROGRAMS += reloc-wrapper > reloc_wrapper_CPPFLAGS = \ > -I$(builddir) -I$(srcdir) -I$(RELOCATABLE_CONFIG_H_DIR) \ > -DHAVE_CONFIG_H -DIN_RELOCWRAPPER -DNO_XMALLOC \ > -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"...\" \ > -DLIBPATHVAR=\"$(shlibpathvar)\" -DLIBDIRS=$(libdirs) \ > -DEXEEXT=\"$(EXEEXT)\" > reloc_wrapper_SOURCES = \ > relocwrapper.c progname.c progreloc.c areadlink.c readlink.c \ > canonicalize-lgpl.c malloca.c relocatable.c setenv.c strerror.c \ > c-ctype.c > endif > > before I realized that there was no way to fill in the ... in > the -DINSTALLDIR=\"...\" part, since it can vary from one binary > to another. So I see what you mean now.
And that's not all. You also need some magic which causes a program 'foo' to be installed as $(bindir)/foo.bin or $(libexecdir)/foo.bin, rather than $(bindir)/foo or $(libexecdir)/foo... > > What is the complete required symbol list (nm ...o | grep ' U ') of the set > > of modules compiled for the relocwrapper on your system? > > Here it is: > > U abort > U access > U canonicalize_file_name > U compute_curr_prefix > U __errno > U execv > U exit > U fprintf > U free > U freea > U fwrite > U getcwd > U getenv > U get_full_program_name > U __guard > U lstat > U malloc > U memcpy > U memmove > U mmalloca > U program_name > U readlink > U realloc > U relocate > U rpl_readlink > U rpl_strerror > U setenv > U set_program_name > U set_program_name_and_installdir > U set_relocation_prefix > U __sF > U sprintf > U __stack_smash_handler > U strchr > U strcmp > U strcpy > U strerror > U strncmp > U strrchr Thanks. Among these functions, only the following are replaced by gnulib: canonicalize_file_name fprintf free fwrite getcwd lstat malloc memcpy memmove readlink realloc setenv sprintf strerror Eliminating those which are replaced among this file set: relocwrapper.c progname.c progreloc.c areadlink.c readlink.c \ canonicalize-lgpl.c malloca.c relocatable.c setenv.c strerror.c \ c-ctype.c The following remain: fprintf free fwrite getcwd lstat malloc memcpy memmove realloc sprintf Eliminating those where the replacing module is obsolete: fprintf fwrite getcwd lstat malloc realloc sprintf Detailed analysis: - fprintf is only used in relocwrapper.c, with %s directives => no gnulib replacement needed. - fwrite is emitted by gcc, when we call fputs in progname.c. There is no risk that it might accidentally call rpl_fwrite. => nothing to do. - getcwd: used by canonicalize-lgpl.c. Here it could be useful to use the gnulib replacement. - lstat: used by canonicalize-lgpl.c. I don't understand why this doesn't give link errors on mingw?? - malloc: used by relocwrapper.c, progreloc.c, areadlink.c, canonicalize-lgpl.c, malloca.c, relocatable.c, setenv.c. No gnulib replacement needed, except in areadlink.c. - realloc: used by areadlink.c, canonicalize-lgpl.c, setenv.c. No gnulib replacement needed. - sprintf: used by progreloc.c, strerror.c. No gnulib replacement needed. This leads to a series of 4 patches: [1/4] setenv [2/4] misc. relocwrapper link errors [3/4] areadlink, relocwrapper link errors [4/4] getcwd, relocwrapper link errors Bruno