I just learned from @bjorn3 that the way we represent statics with linkage, such as #[linkage = "extern_weak"], is kind of strange:
unsafe extern "C" {
#[linkage = "extern_weak"]
static test_symbol_that_does_not_exist: Option<unsafe extern "C" fn()>;
}
Here, test_symbol_that_does_not_exist will actually be a global variable local to this module that points to the weak symbol.
Now that we have the &raw address-of operator, we could avoid this extra indirection. Whether we should, I do not know.
Cc @bjorn3 @nikic @chorman0773
I just learned from @bjorn3 that the way we represent statics with linkage, such as
#[linkage = "extern_weak"], is kind of strange:Here,
test_symbol_that_does_not_existwill actually be a global variable local to this module that points to the weak symbol.Now that we have the
&rawaddress-of operator, we could avoid this extra indirection. Whether we should, I do not know.Cc @bjorn3 @nikic @chorman0773