nginx/ngx-rust

unused demangling?

Closed this issue · 2 comments

https://github.com/nginxinc/ngx-rust/blob/85570e2e57eb6f3f171469eda1d3d94716d20ab2/src/http/request.rs#L11-L89

These macros define demangled functions, but the demangled symbols seem never used in dynamic loading.
Does the unused symbols have any advantage of compatibility or extendability?

No, there's no real purpose in #[no_mangle] there. extern "C" ABI qualifier is sufficient to declare a function callable from the nginx C code by address. The only declarations that require no_mangle are module exports, e.g. ngx_modules! macro internals and static ngx_module_t globals in the example modules.
I've planned to clean up the rest, but with everything else we need to do for this project it's a low priority.

The reason I asked this question: I tried to minimize revealed symbols of the module, but I didn't know which one is safe to remove, and which is not.
Now I got the proper criteria. Thank you for answering!