Lines Matching +full:sub +full:- +full:module
1 #!/usr/bin/gawk -f
2 # SPDX-License-Identifier: GPL-2.0
10 # Return the module name(s) (if any) associated with the given object.
27 mod = substr(s, RSTART + 16, RLENGTH - 16);
30 mod = substr(s, RSTART + 13, RLENGTH - 13);
42 # A single module (common case) also reflects objects that are not part
43 # of a module. Some of those objects have names that are also a module
44 # name (e.g. core). We check the associated module file name, and if
45 # they do not match, the object is not part of a module.
52 gsub(/-/, "_", mod);
54 # At this point, mod is a single (valid) module name, or a list of
55 # module names (that do not need validation).
64 # strip off the first 6 hex digits before performing the hex-to-dec conversion,
68 sub(/^0x/, "", val);
78 print "Syntax: verify_builtin_ranges.awk <ranges-file> <system-map>\n" \
79 " <builtin-file> <vmlinux-map> <vmlinux-o-map>\n" \
86 # (1) Load the built-in module address range data.
94 # (2) Annotate System.map symbols with module names.
105 sect_base = addr - sect_off;
107 …printf "[%s] BASE (%s) %016x - %016x = %016x\n", sect_name, sect_symb, addr, sect_off, sect_base >…
115 sub(/-/, " ");
117 sub(/-/, " ");
121 sub(/^ +/, "");
133 idx = addr"-"name;
146 # (3) Build a lookup map of built-in module names.
149 # kernel/crypto/lzo-rle.ko
150 # and we record the object name "crypto/lzo-rle".
153 sub(/kernel\//, ""); # strip off "kernel/" prefix
154 sub(/\.ko$/, ""); # strip off .ko suffix
184 ARGIND >= 4 && map_is_lld && NF == 5 && /[0-9] [^ ]+$/ {
195 sub(/:\(/, " ");
196 sub(/ vmlinux\.a\(/, " ");
202 ARGIND >= 4 && map_is_lld && NF == 5 && $5 ~ /^[A-Za-z_][A-Za-z0-9_]*$/ {
208 ARGIND >= 4 && map_is_lld && /^[0-9a-f]{16} / {
220 # Next section - previous one is done.
233 # Sections with a 0-address can be ignored as well (in vmlinux.map).
259 # If the object is vmlinux.o, we need to consult vmlinux.o.map for per-object
286 # Get module information for the current object.
298 # Evaluate the module information obtained from vmlinux.map (or vmlinux.o.map)
300 # - For all symbols in a given object:
301 # - If the symbol is annotated with the same module name(s) that the object
303 # - Otherwise:
304 # - If the symbol is known to have duplicates of which at least one is
305 # in a built-in module, disregard it.
306 # - If the symbol us not annotated with any module name(s) AND the
307 # object belongs to built-in modules, count it as missing.
308 # - Otherwise, count it as a mismatch.
317 # Handle the rare but annoying case where a 0-size symbol is placed at
318 # the byte *after* the module range. Based on vmlinux.map it will be
320 # module address range. Unfortunately, its address could be at the
321 # start of another built-in module, so the only safe thing to do is to
332 idx = addr"-"$2;
363 printf " Module matches: %6d (%d%% of matches)\n", mod_matches, 100 * mod_matches / matches;