mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-01 01:26:32 +00:00
Allow section override when using patchable-function-entries
Sometimes it is necessary to group patchable function entrypoint records in distinct linker sections. This is the case for some bpf functions within the linux kernel which shouldn't be visible to ftrace. Extend `-Zpatchable-function-entry` to accept an argument of the form `prefix_nops,total_nops,record_section`, which places all entry record into a user specified section. Likewise, extend the `patchable_function_entry` attribute to accept an optional `section="name"` option to place a function into a specific section. This is made possible by llvm attribute `patchable-function-entry-section` added in llvm 21.
This commit is contained in:
@@ -24,3 +24,19 @@ pub fn no_parameters_given() {}
|
||||
#[patchable_function_entry(prefix_nops = 255, prefix_nops = 255)]
|
||||
//~^ ERROR malformed
|
||||
pub fn duplicate_parameter() {}
|
||||
|
||||
#[patchable_function_entry(section = 255)]
|
||||
//~^ ERROR malformed
|
||||
pub fn invalid_section_parameter() {}
|
||||
|
||||
#[patchable_function_entry(section = "foo", section = "bar")]
|
||||
//~^ ERROR malformed
|
||||
pub fn duplicate_section_parameter() {}
|
||||
|
||||
#[patchable_function_entry(section = "fo\0o")]
|
||||
//~^ ERROR null characters
|
||||
pub fn nul_in_section_parameter() {}
|
||||
|
||||
#[patchable_function_entry(section = "")]
|
||||
//~^ ERROR empty
|
||||
pub fn empty_section_parameter() {}
|
||||
|
||||
Reference in New Issue
Block a user