* [gentoo-commits] proj/sandbox:master commit in: scripts/, libsandbox/
@ 2021-10-23 22:19 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2021-10-23 22:19 UTC (permalink / raw
To: gentoo-commits
commit: 3f38f41fc1ea418fb9aa57e24ae29b4319066ae6
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 23 08:54:55 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Oct 23 22:18:03 2021 +0000
URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=3f38f41f
libsandbox: move symbols.h.in parsing to scripts
In preparation for extending the symbol format, move parsing out of
the makefile (which is a basic sed expression) to the awk scripts.
This also has a nice side benefit of removing one automake warning.
It is slightly more code, but the scripts will be diverging shortly,
so it's unavoidable.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
libsandbox/local.mk | 3 +--
| 10 +++++++---
scripts/gen_symbol_version_map.awk | 9 +++++----
| 13 ++++++++++++-
4 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/libsandbox/local.mk b/libsandbox/local.mk
index 1a9c5f9..a386505 100644
--- a/libsandbox/local.mk
+++ b/libsandbox/local.mk
@@ -48,12 +48,11 @@ TRACE_FILES = $(wildcard $(top_srcdir)/%D%/trace/*.[ch] $(top_srcdir)/%D%/trace/
SCRIPT_DIR = $(top_srcdir)/scripts
SYMBOLS_FILE = $(top_srcdir)/%D%/symbols.h.in
-SYMBOLS_LIST = $(shell $(SED) -n '/^[^\#]/p' $(SYMBOLS_FILE))
SYMBOLS_WRAPPERS = $(wildcard $(top_srcdir)/%D%/wrapper-funcs/*.[ch])
GEN_VERSION_MAP_SCRIPT = $(SCRIPT_DIR)/gen_symbol_version_map.awk
GEN_HEADER_SCRIPT = $(SCRIPT_DIR)/gen_symbol_header.awk
GEN_TRACE_SCRIPT = $(SCRIPT_DIR)/gen_trace_header.awk
-SB_AWK = LC_ALL=C $(AWK) -v SYMBOLS_LIST="$(SYMBOLS_LIST)" -v srcdir="$(top_srcdir)/%D%" -f
+SB_AWK = LC_ALL=C $(AWK) -v SYMBOLS_FILE="$(SYMBOLS_FILE)" -v srcdir="$(top_srcdir)/%D%" -f
%D%/libsandbox.map: $(SYMBOLS_FILE) $(GEN_VERSION_MAP_SCRIPT)
@$(MKDIR_P) %D%
--git a/scripts/gen_symbol_header.awk b/scripts/gen_symbol_header.awk
index 2d26c5a..48d2f9d 100644
--- a/scripts/gen_symbol_header.awk
+++ b/scripts/gen_symbol_header.awk
@@ -1,9 +1,13 @@
+# Read the symbols list and create regexs to use for processing readelf output.
BEGIN {
- COUNT = split(" " SYMBOLS_LIST, SYMBOLS);
+ COUNT = 0;
sym_regex = "";
- for (x in SYMBOLS) {
- symbol = SYMBOLS[x];
+ while ((getline symbol < SYMBOLS_FILE) > 0) {
+ if (symbol ~ /^ *#/ || symbol ~ /^$/)
+ continue;
+
+ SYMBOLS[++COUNT] = symbol;
if (sym_regex)
sym_regex = sym_regex "|";
sym_regex = sym_regex symbol;
diff --git a/scripts/gen_symbol_version_map.awk b/scripts/gen_symbol_version_map.awk
index c92e2f9..cd0aa84 100644
--- a/scripts/gen_symbol_version_map.awk
+++ b/scripts/gen_symbol_version_map.awk
@@ -1,9 +1,10 @@
+# Read the symbols list and create regexs to use for processing readelf output.
BEGIN {
- split(" " SYMBOLS_LIST, SYMBOLS);
-
sym_regex = "";
- for (x in SYMBOLS) {
- symbol = SYMBOLS[x];
+ while ((getline symbol < SYMBOLS_FILE) > 0) {
+ if (symbol ~ /^ *#/ || symbol ~ /^$/)
+ continue;
+
if (sym_regex)
sym_regex = sym_regex "|";
sym_regex = sym_regex symbol;
--git a/scripts/gen_trace_header.awk b/scripts/gen_trace_header.awk
index 846294c..e9d84a6 100644
--- a/scripts/gen_trace_header.awk
+++ b/scripts/gen_trace_header.awk
@@ -1,5 +1,16 @@
+# Read the symbols list and create regexs to use for processing readelf output.
+function read_symbols() {
+ COUNT = 0;
+ while ((getline symbol < SYMBOLS_FILE) > 0) {
+ if (symbol ~ /^ *#/ || symbol ~ /^$/)
+ continue;
+
+ SYMBOLS[++COUNT] = symbol;
+ }
+}
+
BEGIN {
- COUNT = split(" " SYMBOLS_LIST, SYMBOLS);
+ read_symbols();
if (MODE == "gen") {
for (x in SYMBOLS) {
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-23 22:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-23 22:19 [gentoo-commits] proj/sandbox:master commit in: scripts/, libsandbox/ Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox