Fixes objtool warning on write_allowlist() via attribute "cold". #189
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #188.
gcc v8+ can, during compilation, mark code as "cold" that cannot be executed during compliant runs (e.g., executes via undefined behavior). Users can also add the "cold" attribute to functions to indicate they are executed rarely, can be optimized for size rather than speed, and may be placed together with other "cold" functions elsewhere in the binary to improve locality of hot functions.
The 4.18 kernel builds an objdump tool that (erroneously?) detects code fallthrough between the write_allowlist() and write_allowlist.cold() functions (and vice versa). Rather than force the use of a more recent objdump, we simple declare the entire function as "cold" for kernels older that v5.
The warnings are not present with gcc 15.2.0 and kernel/objdump 6.14.0.