-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce FPs when handling static inline
functions
#85
Comments
Judging from that thread, the Python folks could use a collection tool for those inline methods and macros. Sounds like a fun project for getting into the cPython codebase. fyi, you can also assign me directly here, I'm planning to work on this soon (until end of week). |
#87 fixes this in practice, but I'll leave this open for the longer-term potential fix of checking symbol visibility. |
So regarding the symbol visibility, how do we fetch/infer the visibility from the |
I was thinking about it from the opposite direction 🙂 -- rather than trying to infer each function's intended visibility, we can look at actual symbol visibilities in the symbol table and apply the following rules:
That way we'd end up allowing |
Just for my understanding, public visibility means "linked in from an external lib", and "local/private" means from the project itself? How do I even get Py_XDECREF as a local/private visibility symbol? |
Yep, pretty much. The way you end up with a local/private As a contrived example: // myheader.h
static inline int foo() { return 42; } // mytool.c
#include <myheader.h> expands roughly to: // mytool.c
// myheader.h
static inline int foo() { return 42; } In effect, this means that every translation unit (i.e. TL;DR: this all happens a "public" header (like those in CPython) can define |
Done. |
See #55, #82, and #83.
abi3audit
currently considers all symbols when auditing. This is generally correct, but results in false positives when astatic inline
function (such asPy_XDECREF
) doesn't get inlined, but instead remains as a local/private symbol.The cause below this is nuanced:
static inline
functions likePy_XDECREF
are part of the limited API but not the stable ABI; they're expected to be inlined into code that is part of the stable ABI. In other words,static inline
functions are referentially opaque: their expansion is compatible with the stable ABI, but function identifiers themselves are not.In practice this is a non-issue, and
abi3audit
should not flag local-only symbols forstatic inline
functions.To do this, the
audit
phase probably needs two things:static inline
functions to ignoreSymbol
's visibility, to know whether to ignore itFor (1), we can just start with
Py_XDECREF
. For (2), I think we'll need to extend theabi3info
Symbol
model to include avisibility: Visibility | None
attribute, which will need to be populated as appropriate from each supported symbol table/object file.CC @nicholasjng, who helped triage this and has graciously offered to help out 🙂
The text was updated successfully, but these errors were encountered: