Open randomPoison opened 2 days ago
From what I can tell, I don't think we need to change the apply_to = hasType(functionType)
in IA2_BEGIN_NO_WRAP
. With this
https://godbolt.org/z/3qsfqYEdG
typedef void(*a_fn)(int);
IA2_BEGIN_NO_WRAP
typedef void(*b_fn)(int, int);
struct DSP1 {
a_fn a;
b_fn b;
};
IA2_END_NO_WRAP
struct DSP2 {
a_fn a;
b_fn b;
};
b_fn
, DSP1::a
, DSP2::b
all get AnnotateAttr
s with ia2_skip_wrap
.
So what we need to do is the rest of what @ayrtonm outlined:
ignore_type
to SourceRewriter.cpp
analogous to the existing ignore_function
ignore_type
somewhere in the run
method in the FnPtrTypes
class
For some function pointers in a library, we don't want those to be rewritten because we know the function pointers are entirely internal to the compartment. We can use
IA2_IGNORE
in all of the places where function addresses are taken, but the fn ptr type will still get rewritten, resulting in compiler errors. We need a general mechanism for marking function pointer types that shouldn't be rewritten at all.IA2_BEGIN_NO_WRAP
seems like the right mechanism for this, but currently it only applies to direct function calls, and can't be used in the way we want.