On Thu, 2 Jan 2025 at 10:59, Steven Rostedt [off-list ref] wrote:
Where the file created by "nm -S" is read, recording the address
and the associated sizes of each function. It then is sorted, and
before sorting the mcount_loc table, it is scanned to make sure
all symbols in the mcounc_loc are within the boundaries of the functions
defined by nm. If they are not, they are zeroed out, as they are most
likely weak functions (I don't know what else they would be).
Please just do this by sorting non-existent functions at the end,
instead of just zeroing them out.
That makes the mcount_loc table dense in valid entries. We could then
just rewrite the size of the table (or just add a variable containing
the size, if you don't want to change ELF metadata - but you're
already sorting the table, so why not?)
Because:
Then on boot up, when creating the ftrace tables from the mcount_loc
table, it will ignore any function that matches the kaslr_offset()
value.
Why even do that? Why not just make the mcount_loc table be proper in
the first place.
Linus