[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: relocwrapper interaction with replacement functions

From: Ben Pfaff
Subject: Re: relocwrapper interaction with replacement functions
Date: Tue, 08 Jun 2010 22:46:49 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Bruno Haible <address@hidden> writes:

>> On OpenBSD 4.7, GNU PSPP from current "master" configured with
>> --enable-relocatable fails linking relocwrapper.c at "make
>> install" time:
>>     /tmp//ccy8gNb6.o(.text+0x64): In function `add_dotbin':
>>     gl/relocwrapper.c:105: undefined reference to `rpl_fprintf'
>>     /tmp//ccy8gNb6.o(.text+0x172): In function `activate_libdirs':
>>     gl/relocwrapper.c:165: undefined reference to `rpl_fprintf'
>>     /tmp//ccy8gNb6.o(.text+0x1f9): In function `main':
>>     gl/relocwrapper.c:189: undefined reference to `rpl_fprintf'
>>     /tmp//ccHe4GuE.o(.text+0xe9): In function `set_relocation_prefix':
>>     gl/relocatable.c:154: undefined reference to 
>> `libintl_set_relocation_prefix'
>>     /tmp//ccIOlqzo.o(.text+0x3c): In function `rpl_strerror':
>>     gl/strerror.c:339: undefined reference to `rpl_sprintf'
>>     collect2: ld returned 1 exit status
>> One solution for the problems with the rpl_* symbols would be to
>> build the relocwrapper program in the usual way as part of a
>> Makefile.am, and then link it against the Gnulib library, so that
>> relocwrapper could take advantage of the wrappers.
> But that would require extra Makefile.am rules that the developer has to
> write. The --enable-relocatable mechanism tries hard to get away with minimal
> changes to the Makefile.am:
> <http://www.gnu.org/software/gnulib/manual/html_node/Supporting-Relocation.html>

To demonstrate what I meant, I spent a bit of time working on
modules/relocatable-prog-wrapper, coming up with this:

    noinst_PROGRAMS += reloc-wrapper
    reloc_wrapper_CPPFLAGS = \
            -I$(builddir) -I$(srcdir) -I$(RELOCATABLE_CONFIG_H_DIR) \
            -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"...\" \
            -DLIBPATHVAR=\"$(shlibpathvar)\" -DLIBDIRS=$(libdirs) \
    reloc_wrapper_SOURCES = \
            relocwrapper.c progname.c progreloc.c areadlink.c readlink.c \
            canonicalize-lgpl.c malloca.c relocatable.c setenv.c strerror.c \

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.  Too bad.

> Therefore I would suggest to solve this problem by adding #undefs in
> specific places, such as
> /* Use the system functions, not the gnulib overrides in this file.  */
> #undef fprintf
> #undef sprintf
> 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

The above is *with* the following two --local-dir additions to
PSPP, plus disabling DEPENDS_ON_LIBINTL.  Those changes allow the
relocwrapper to build fine on OpenBSD.  In other words, only
fprintf and sprintf appear to be real problems on this system.

diff --git a/gl/local/lib/relocwrapper.c.diff b/gl/local/lib/relocwrapper.c.diff
new file mode 100644
index 0000000..d7676eb
--- /dev/null
+++ b/gl/local/lib/relocwrapper.c.diff
@@ -0,0 +1,15 @@
+diff -up /home/blp/pspp/master/gl/relocwrapper.c\~ 
+--- /home/blp/pspp/master/gl/relocwrapper.c~   2010-05-17 21:56:43.000000000 
++++ /home/blp/pspp/master/gl/relocwrapper.c    2010-06-07 22:39:44.000000000 
+@@ -55,6 +55,9 @@
+ #include "relocatable.h"
+ #include "c-ctype.h"
++/* Temporary workaround for bug in relocatable-prog module. */
++#undef fprintf
+ /* Return a copy of the filename, with an extra ".bin" at the end.
+    More generally, it replaces "${EXEEXT}" at the end with ".bin${EXEEXT}".  
+ static char *
+Diff finished.  Mon Jun  7 22:39:49 2010
diff --git a/gl/local/lib/strerror.c.diff b/gl/local/lib/strerror.c.diff
new file mode 100644
index 0000000..a20ecdc
--- /dev/null
+++ b/gl/local/lib/strerror.c.diff
@@ -0,0 +1,15 @@
+diff -up /home/blp/pspp/master/gl/strerror.c\~ 
+--- /home/blp/pspp/master/gl/strerror.c~       2010-05-17 21:56:43.000000000 
++++ /home/blp/pspp/master/gl/strerror.c        2010-06-07 22:43:32.000000000 
+@@ -37,6 +37,9 @@
+ #  define strerror(n) NULL
+ # endif
++/* Temporary workaround for bug in relocatable-prog module. */
++#undef sprintf
+ char *
+ rpl_strerror (int n)
+ {
+Diff finished.  Mon Jun  7 22:44:04 2010

"doe not call up Any that you can not put downe."
--H. P. Lovecraft

reply via email to

[Prev in Thread] Current Thread [Next in Thread]