3 @@ -111,7 +111,7 @@ LDLIBS += -L. -lm
5 ifeq ($(SHARED_LIBS),y)
7 -LDFLAGS += -Wl,-export-dynamic
8 +LDFLAGS += -Wl,--dynamic-list=dynsyms.list
12 @@ -140,7 +140,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
15 tc: $(TCOBJ) $(LIBNETLINK) libtc.a
16 - $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
17 + $(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@
20 $(QUIET_AR)$(AR) rcs $@ $^
21 @@ -162,6 +162,7 @@ install: all
23 rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \
24 rm -f emp_ematch.tab.*
28 $(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
29 @@ -201,4 +202,15 @@ static-syms.h: $(wildcard *.c)
30 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
36 +dynsyms.list: $(wildcard *.c)
37 + files="$(filter-out $(patsubst %.so,%.c,$(TCSO)), $^)" ; \
39 + for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
40 + sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:\1;:;p}' $$files ; \
42 + echo "show_stats; print_tm; parse_rtattr; get_u32; matches; addattr_l; addattr_nest; addattr_nest_end; };" >> $@