aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2005-03-02 09:01:36 +0000
committerMartin Schlemmer <azarah@gentoo.org>2005-03-02 09:01:36 +0000
commit477d4cb3b2f4d28304f0778d84aaef545bae58e2 (patch)
treee1a78612bcdc93d0f778487e6c35abc702e12620 /Makefile.am
parentkilled off _init and _fini in favor of (diff)
downloadsandbox-477d4cb3b2f4d28304f0778d84aaef545bae58e2.tar.gz
sandbox-477d4cb3b2f4d28304f0778d84aaef545bae58e2.tar.bz2
sandbox-477d4cb3b2f4d28304f0778d84aaef545bae58e2.zip
Fix inverse test logic in canonicalize.c, use a strncpy. Fix gcc warning in
getcwd.c. Add symbols.in and logic to Makefile.am to generate symbol versions for glibc and other libc's that use this. Update libsandbox.c to use these symbol versions if available. Fix exec wrapper to re-export LD_PRELOAD if the process unset it. Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am49
1 files changed, 42 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am
index c3c9736..c351917 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,15 +1,50 @@
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
-dist_pkgdata_DATA = sandbox.bashrc
EXTRA_DIST = sandbox.bashrc canonicalize.c libctest.c
-AM_CFLAGS = -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DLIBC_VERSION=\"$(LIBC_VERSION)\"
+CLEANFILES = symbols.h
+
+AM_CPPFLAGS = -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT \
+ -DLIBC_VERSION=\"$(LIBC_VERSION)\" \
+ -DLIBSANDBOX_PATH=\"$(libdir)\" \
+ -DSANDBOX_BASHRC_PATH=\"$(pkgdatadir)\"
+
+dist_pkgdata_DATA = sandbox.bashrc
lib_LTLIBRARIES = libsandbox.la
+nodist_EXTRA_libsandbox_la_SOURCES = symbols.h
libsandbox_la_SOURCES = libsandbox.c sandbox_futils.c localdecls.h
-libsandbox_la_LDFLAGS = -Wc,-nostdlib -lc -ldl
-libsandbox_la_CFLAGS = -Wc,-nostdlib -D_REENTRANT -D_GNU_SOURCE \
- -DSANDBOX_BASHRC_PATH=\"$(pkgdatadir)\" \
- -DLIBSANDBOX_PATH=\"$(libdir)\"
+libsandbox_la_LDFLAGS = -Wc,-nostdlib -Wc,-nodefaultlibs -lc -ldl
+# We need -fexceptions here, else we do not catch exceptions
+# (nptl/tst-cancelx4.c in glibc among others fails for wrapped functions).
+libsandbox_la_CFLAGS = -fexceptions
bin_PROGRAMS = sandbox
sandbox_SOURCES = sandbox.c sandbox.h sandbox_futils.c getcwd.c
-sandbox_CFLAGS = -DSANDBOX_BASHRC_PATH=\"$(pkgdatadir)\" -DLIBSANDBOX_PATH=\"$(libdir)\" -DOUTSIDE_LIBSANDBOX
+sandbox_CFLAGS = -DOUTSIDE_LIBSANDBOX
+
+libsandbox.c: symbols.h
+
+# Basically generates symbols.h from the function names in symbols.in.
+# Not sure if we can count on the latest version the only symbol
+# countaining '@@' ...
+symbols.h: symbols.in
+ @echo "Generating $@"; \
+ if [ ! -e "$(libdir)/$(LIBC_VERSION)" ]; then\
+ echo -e "\n*** Cannot find $(libdir)/$(LIBC_VERSION)!\n"; \
+ exit 1; \
+ fi; \
+ echo "#ifndef __symbol_h" > $@; \
+ echo -e "#define __symbol_h\n" >> $@; \
+ for x in `cat $^`; do \
+ sym=`readelf -s "$(libdir)/$(LIBC_VERSION)" 2>/dev/null | \
+ awk '{ print $$8 }' | \
+ grep "^$${x}@@" | \
+ cut -d'@' -f3`; \
+ echo "#define symname_$${x} \"$${x}\"" >> $@; \
+ if [ -n "$${sym}" ]; then \
+ echo "#define symver_$${x} \"$${sym}\"" >> $@; \
+ else \
+ echo "#define symver_$${x} NULL" >> $@; \
+ fi; \
+ done; \
+ echo -e "\n#endif /* __symbol_h */" >> $@
+