Skip to content
Snippets Groups Projects
Commit 15f9355a authored by Vivek Das Mohapatra's avatar Vivek Das Mohapatra
Browse files

Modify generated file dependencies to allow optional dependencies

We now reserve the shim/lib<FOO>.so.c.<WHATEVER> pattern for the
dependencies of the generated .so.c file.

The shim/lib<FOO>.so.<WHATEVER> pattern is now used for generated
intermediates.

This allows two useful things: We don't occasionally get a second
rebuild of the generated .so.c file due to timer resolution problems
and we can depend on extra .so.c.* files if they exist and ignore
them otherwise: we will need the latter as some libraries (libGL)
need bespoke dlopen/dlmopen wrapper logic and others can just live
with the default implementation.
parent 632437f2
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
......@@ -30,3 +30,5 @@ elf-dump
print-libstubs
TAGS
tags
shim/lib*.so.map
shim/lib*.so.symbols
......@@ -41,17 +41,18 @@ libcapsule_la_LDFLAGS = -lelf
libz_la_SOURCES = shim/libz.so.c
libz_la_LDFLAGS = -lcapsule -version-info 1:1:0 \
-Wl,--version-script=shim/libz.so.c.map
-Wl,--version-script=shim/libz.so.map
libGL_la_SOURCES = shim/libGL.so.c
libGL_la_LDFLAGS = -lcapsule -version-info 1:1:0
shims = z GL
shim_srcs = $(foreach l,$(shims),shim/lib$l.so.c)
shim_files = $(foreach y,map symbols,$(foreach x,$(shim_srcs),$x.$y))
shim_base = $(basename $(shim_srcs))
shim_files = $(foreach y,map symbols,$(foreach x,$(shim_base),$x.$y))
GENSTUB_V1 =
GENSTUB_V0 = @echo " GENSTUB " $@.excluded $@.shared $@;
GENSTUB_V0 = @echo " GENSTUB " $(subst $(word 1, $(basename $(filter shim/lib%,$^))),,$(filter shim/lib%,$^)) : $@;
GENSTUB = $(GENSTUB_V$(V))
CLEANFILES = $(shim_files) $(shim_srcs)
......@@ -59,7 +60,9 @@ BUILT_SOURCES = $(shim_srcs)
include disabled.mk
shim/lib%.so.c: generate-stublib.sh print-libstubs capsule-shim.h shim/lib%.so.c.excluded shim/lib%.so.c.shared
# explicitly depend on the generators and .excluded and .shared metafiles
# depend on the .dlopen file IFF it exists
shim/lib%.so.c: generate-stublib.sh print-libstubs capsule-shim.h shim/lib%.so.c.*
$(GENSTUB)$(top_srcdir)/$< $$(basename $@ .c) $@.excluded $@.shared $@
debug:
......
......@@ -28,8 +28,10 @@ proxied_dso=$1; shift;
proxy_excluded=$1; shift;
proxy_extra=$1; shift;
proxy_src=$1; shift;
echo -n > $proxy_src.symbols;
echo -n > $proxy_src.map;
symbol_file=${proxy_src%.c}.symbols;
map_file=${proxy_src%.c}.map;
echo -n > $symbol_file;
echo -n > $map_file;
exec >& $proxy_src;
......@@ -38,7 +40,7 @@ cat $top/capsule-shim.h;
for pt in $proxied_dso $(cat $proxy_extra);
do
$top/print-libstubs $pt;
done > $proxy_src.symbols;
done > $symbol_file;
while read symbol version dependency;
do
......@@ -52,7 +54,7 @@ do
echo "UNVERSIONED_STUB( $symbol );";
;;
esac;
done < $proxy_src.symbols;
done < $symbol_file;
cat - <<EOF
static Lmid_t symbol_ns;
......@@ -97,7 +99,7 @@ static void __attribute__ ((constructor)) _capsule_init (void)
{
EOF
while read sym x; do echo " { \"$sym\" },"; done < $proxy_src.symbols;
while read sym x; do echo " { \"$sym\" },"; done < $symbol_file;
cat - <<EOF
{ NULL }
......@@ -133,7 +135,7 @@ cat - <<EOF
}
EOF
exec >& $proxy_src.map;
exec >& $map_file;
for node in ${!NODE[@]};
do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment