xref: /aosp_15_r20/external/iproute2/tc/make-static-syms.sh (revision de1e4e894b0c224df933550f0afdecc354b238c4)
1#!/bin/bash
2
3# This is the rule from the end of Makefile, with $* instead of $^ on the
4# first line, and $ instead of $$ on the other lines, but otherwise identical.
5# (Which is why the indentation is weird!)
6
7	files="$*" ; \
8	for s in `grep -B 3 '\<dlsym' $files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
9		sed -n '/'$s'[^ ]* =/{s:.* \([^ ]*'$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $files ; \
10	done
11