Lines Matching +full:3 +full:base +full:- +full:x

1 #!/usr/bin/gawk -f
2 # SPDX-License-Identifier: GPL-2.0
27 mod = substr(s, RSTART + 16, RLENGTH - 16);
30 mod = substr(s, RSTART + 13, RLENGTH - 13);
44 gsub(/-/, "_", mod);
55 # We use a modified absolute start address (soff + base) as index because we
64 idx = sprintf("%016x", (soff + sect_base[osect]) * 2 + 1);
65 entries[idx] = sprintf("%s %08x-%08x %s", sect, soff, eoff, mod);
69 # (1) Build a lookup map of built-in module names.
74 # kernel/crypto/lzo-rle.ko
75 # and we record the object name "crypto/lzo-rle".
89 # We collect the base address of the section in order to convert all addresses
96 # We collect the start address of any sub-section (section included in the top
99 # section is to be obtained from vmlinux.o.map. The offset of the sub-section
120 # ->
123 ARGIND == 2 && map_is_lld && NF == 5 && /[0-9] [^ ]+$/ {
124 $0 = $5 " 0x"$1 " 0x"$3 " load address 0x"$2;
130 # ->
133 ARGIND == 2 && map_is_lld && !anchor && NF == 7 && raw_addr == "0x"$1 && $6 == "=" && $7 == "." {
134 $0 = " 0x"$1 " " $5 " = .";
140 # ->
147 $0 = " "$6 " 0x"$1 " 0x"$3 " " $5;
156 # ->
159 ARGIND == 2 && map_is_lld && sect && !anchor && NF == 5 && $5 ~ /^[_A-Za-z][_A-Za-z0-9]*$/ {
160 $0 = " 0x"$1 " " $5;
165 ARGIND == 2 && map_is_lld && /^[0-9a-f]{16} / {
177 if ($1 !~ /^0x/ || $2 !~ /^0x/)
195 # Beginning a new section - done with the previous one (if any).
201 # Process a loadable section (we only care about .-sections).
203 # Record the section name and its base address.
204 # We also record the raw (non-stripped) address of the section because it can
219 # Sections with a 0-address can be ignored as well.
225 base = $2;
226 sub(addr_prefix, "0x", base);
227 base = strtonum(base);
230 sect_base[sect] = base;
231 sect_size[sect] = strtonum($3);
234 printf "[%s] BASE %016x\n", sect, base >"/dev/stderr";
250 ARGIND == 2 && !anchor && NF == 4 && raw_addr == $1 && $3 == "=" && $4 == "." {
251 anchor = sprintf("%s %08x-%08x = %s", sect, 0, 0, $2);
255 printf "[%s] ANCHOR %016x = %s (.)\n", sect, 0, $2 >"/dev/stderr";
263 ARGIND == 2 && !anchor && NF == 2 && $1 ~ /^0x/ && $2 !~ /^0x/ {
265 sub(addr_prefix, "0x", addr);
266 addr = strtonum(addr) - base;
267 anchor = sprintf("%s %08x-%08x = %s", sect, addr, addr, $2);
271 printf "[%s] ANCHOR %016x = %s\n", sect, addr, $2 >"/dev/stderr";
281 # If the section does not have a base yet, use the base of the encapsulating
286 sect_base[$1] = base;
289 printf "[%s] BASE %016x\n", $1, base >"/dev/stderr";
293 sub(addr_prefix, "0x", addr);
295 sect_addend[$1] = addr - sect_base[$1];
299 printf "[%s] ADDEND %016x - %016x = %016x\n", $1, addr, base, sect_addend[$1] >"/dev/stderr";
307 # (3) Collect offset ranges (relative to the section base address) for built-in
311 # the information we need (see section (3a)).
313 # vmlinux.o.map (see section (3b)).
315 # (3a) Determine offset range info using vmlinux.map.
318 # being processed is already known. If we do not have a base address for it,
325 # - If the current object belongs to the same module(s), update the range data
327 # - Otherwise, ensure that the end offset of the range is valid.
329 # If the current object does not belong to a built-in module, ignore it.
331 # If it does, we add a new built-in module offset range record.
333 ARGIND == 2 && !need_o_map && /^ [^ ]/ && NF == 4 && $3 != "0x0" {
337 # Turn the address into an offset from the section base.
339 sub(addr_prefix, "0x", soff);
340 soff = strtonum(soff) - sect_base[sect];
341 eoff = soff + strtonum($3);
343 # Determine which (if any) built-in modules the object belongs to.
346 # If we are processing a built-in module:
347 # - If the current object is within the same module, we update its
349 # - Otherwise:
374 # If we encountered an object that is not part of a built-in module, we
379 # At this point, we encountered the start of a new built-in module.
391 ARGIND == 3 && !need_o_map {
397 # (3) Collect offset ranges (relative to the section base address) for built-in
403 ARGIND == 3 && map_is_lld && NF == 5 && $5 ~ /:\(/ {
412 $0 = " "sect " 0x"$1 " 0x"$3 " " $5;
415 # (3b) Determine offset range info using vmlinux.o.map.
420 # Determine the top-level section that the object's section was included in
425 # procedure outlined in (3a).
427 ARGIND == 3 && /^ [^ ]/ && NF == 4 && $3 != "0x0" {
435 # Turn the address into an offset from the section base.
437 sub(addr_prefix, "0x", soff);
439 eoff = soff + strtonum($3);
441 # Determine which (if any) built-in modules the object belongs to.
444 # If we are processing a built-in module:
445 # - If the current object is within the same module, we update its
447 # - Otherwise:
472 # If we encountered an object that is not part of a built-in module, we
477 # At this point, we encountered the start of a new built-in module.
490 # records. They are added at an adjusted section base address (base << 1) to
500 idx = sprintf("%016x", sect_base[sect] * 2);