Propagating custom source annotation to LLVM IR

I'm building a research prototype which requires some custom source annotation such as:

#[do_something_llvm]
fn foo() {}

I'm trying to understand the best high-level approach to implement this and pass the metadata to LLVM so I can write a pass to make use of it. AFAIK compiler plugin is no longer a thing.

maybe something like:

#[unsafe(link_section = ".my_special_section")]
pub fn f() {}

or:

#[repr(C)]
struct FnAndAttrs<F> {
    f: F,
    foo: u8,
    bar: &'static str,
    baz: &'static [u8],
}
#[used]
#[unsafe(link_section = ".my_special_section")]
static F_ATTRS: FnAndAttrs<fn()> = FnAndAttrs {
    f,
    foo: 123,
    bar: "bar",
    baz: b"123abc\xFF",
};
pub fn f() {}

then your LLVM pass can look for things with section .my_special_section and then process those, making sure to remove the static or change the section back to .text as appropriate.