forked from openwrt/openwrt
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iproute2: tc: reduce size of dynamic symbol table
In the case of SHARED_LIBS=y, don't use -export-dynamic to place *all* symbols into the dynamic symbol table. Instead, use --dynamic-list to export a smaller set of symbols similar to that defined in static-syms.h in the case of SHARED_LIBS=n, avoiding an 11 KB tc package size increase. The symbol set is based on that required by the only plugin, m_xt.so. Also increment PKG_RELEASE. Signed-off-by: Tony Ambardar <itugrok@yahoo.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE fixup]
- Loading branch information
1 parent
0b57a21
commit b614954
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- a/tc/Makefile | ||
+++ b/tc/Makefile | ||
@@ -107,7 +107,7 @@ LDLIBS += -L. -lm | ||
|
||
ifeq ($(SHARED_LIBS),y) | ||
LDLIBS += -ldl | ||
-LDFLAGS += -Wl,-export-dynamic | ||
+LDFLAGS += -Wl,--dynamic-list=dynsyms.list | ||
endif | ||
|
||
TCLIB := tc_core.o | ||
@@ -137,7 +137,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc | ||
all: tc $(TCSO) | ||
|
||
tc: $(TCOBJ) $(LIBNETLINK) libtc.a | ||
- $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ | ||
+ $(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@ | ||
|
||
libtc.a: $(TCLIB) | ||
$(QUIET_AR)$(AR) rcs $@ $^ | ||
@@ -159,6 +159,7 @@ install: all | ||
clean: | ||
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \ | ||
rm -f emp_ematch.yacc.* | ||
+ rm -f dynsyms.list | ||
|
||
q_atm.so: q_atm.c | ||
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm | ||
@@ -198,4 +199,15 @@ static-syms.h: $(wildcard *.c) | ||
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ | ||
done > $@ | ||
|
||
+else | ||
+ | ||
+tc: dynsyms.list | ||
+dynsyms.list: $(wildcard *.c) | ||
+ files="$(filter-out $(patsubst %.so,%.c,$(TCSO)), $^)" ; \ | ||
+ echo "{" > $@ ; \ | ||
+ for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ | ||
+ sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:\1;:;p}' $$files ; \ | ||
+ done >> $@ ; \ | ||
+ echo "show_stats; print_tm; parse_rtattr; get_u32; matches; addattr_l; addattr_nest; addattr_nest_end; };" >> $@ | ||
+ | ||
endif |