Lines Matching +full:- +full:section
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);
53 # Update the ranges entry for the given module 'mod' in section 'osect'.
57 # section data, and the first module may very well start at the same address.
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".
85 # (2) Collect address information for each section.
89 # We collect the base address of the section in order to convert all addresses
90 # in the section into offset values.
92 # We collect the address of the anchor (or first symbol in the section if there
94 # ranges based on the actual load address of the section in the running kernel.
96 # We collect the start address of any sub-section (section included in the top
97 # level section being processed). This is needed when the final linking was
99 # section is to be obtained from vmlinux.o.map. The offset of the sub-section
117 # (LLD) Convert a section record fronm lld format to ld format.
120 # ->
123 ARGIND == 2 && map_is_lld && NF == 5 && /[0-9] [^ ]+$/ {
130 # ->
140 # ->
152 # We only care about these while processing a section for which no anchor has
156 # ->
159 ARGIND == 2 && map_is_lld && sect && !anchor && NF == 5 && $5 ~ /^[_A-Za-z][_A-Za-z0-9]*$/ {
165 ARGIND == 2 && map_is_lld && /^[0-9a-f]{16} / {
169 # (LD) Section records with just the section name at the start of the line
171 # loadable section. If it is, the next line will contains a hex value
183 # (LD) Object records with just the section name denote records with a long
184 # section name for which the remainder of the record can be found on the
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.
239 # If we are not in a section we care about, we ignore the record.
245 # Record the first anchor symbol for the current section.
247 # An anchor record for the section bears the same raw address as the section
251 anchor = sprintf("%s %08x-%08x = %s", sect, 0, 0, $2);
260 # If no anchor record was found for the current section, use the first symbol
261 # in the section as anchor.
266 addr = strtonum(addr) - base;
267 anchor = sprintf("%s %08x-%08x = %s", sect, addr, addr, $2);
276 # The first occurrence of a section name in an object record establishes the
277 # addend (often 0) for that section. This information is needed to handle
281 # If the section does not have a base yet, use the base of the encapsulating
282 # section.
287 if ($1 ~ /^\.rodata\.(cst|str)[0-9]/)
300 sect_addend[$1] = addr - sect_base[$1];
304 printf "[%s] ADDEND %016x - %016x = %016x\n", $1, addr, base, sect_addend[$1] >"/dev/stderr";
312 # (3) Collect offset ranges (relative to the section base address) for built-in
316 # the information we need (see section (3a)).
318 # vmlinux.o.map (see section (3b)).
322 # Since we are already processing vmlinux.map, the top level section that is
330 # - If the current object belongs to the same module(s), update the range data
332 # - Otherwise, ensure that the end offset of the range is valid.
334 # If the current object does not belong to a built-in module, ignore it.
336 # If it does, we add a new built-in module offset range record.
342 # Turn the address into an offset from the section base.
345 soff = strtonum(soff) - sect_base[sect];
348 # Determine which (if any) built-in modules the object belongs to.
351 # If we are processing a built-in module:
352 # - If the current object is within the same module, we update its
354 # - Otherwise:
355 # + If we are still processing within the same main section, we
359 # + Otherwise, we validate the end offset against the section
379 # If we encountered an object that is not part of a built-in module, we
384 # At this point, we encountered the start of a new built-in module.
402 # (3) Collect offset ranges (relative to the section base address) for built-in
422 # If we do not know an addend for the object's section, we are interested in
423 # anything within that section.
425 # Determine the top-level section that the object's section was included in
426 # during the final link. This is the section name offset range data will be
437 # We need to work with the main section.
440 # Turn the address into an offset from the section base.
446 # Determine which (if any) built-in modules the object belongs to.
449 # If we are processing a built-in module:
450 # - If the current object is within the same module, we update its
452 # - Otherwise:
453 # + If we are still processing within the same main section, we
457 # + Otherwise, we validate the end offset against the section
477 # If we encountered an object that is not part of a built-in module, we
482 # At this point, we encountered the start of a new built-in module.
494 # Anchor records are added for each section that contains offset range data
495 # records. They are added at an adjusted section base address (base << 1) to