/* * IGVisibility.h — 符号可见性控制(抗静态调用关系分析,§7 硬化)。 * * 背景:静态库 .a 里所有全局函数默认都是导出符号(nm 显示 T),接入方链进 App 后, * 若不 strip,_ig_poison_mark / _ig_poison_mask / _ig_policy_* 等**内部**符号名 * 会留在符号表,成为「nm 一把定位 → 找调用点 → NOP」的锚点。 * * 策略: * - 整个 defender 库用 -fvisibility=hidden 编译:默认所有符号隐藏(private extern)。 * - 只有接入方跨 bridging header 真正引用的入口用 IG_PUBLIC 显式导出: * ig_defender_scan / ig_policy_scan_and_mark / ig_poison_init / ig_poison_apply。 * - 其余(mark/mask/sink/reset/evaluate/anti_jb_* 及各探针内部)保持 hidden, * 最终 App 链接 + strip 后从符号表消失,nm 再也捞不到名字。 * * 边界(如实声明): * - 这不消除调用图的「边」(bl 仍在),只抹掉「节点的名字」——把定位成本从 * 「nm 一把」抬到「靠交叉引用 + 语义猜」。真正删边要靠内联(apply 揉进解密) * 与间接化调用点,见 docs/18 §7。 * - 在 .a 阶段 hidden 符号仍可能以 private-extern 出现在**静态**符号表(nm 无 -g); * 决定性的一步是最终镜像 strip。故接入方必须保持 Release 的 strip(见 docs/18 §7.0)。 */ #ifndef IG_VISIBILITY_H #define IG_VISIBILITY_H #if defined(__GNUC__) || defined(__clang__) #define IG_PUBLIC __attribute__((visibility("default"))) #define IG_INTERNAL __attribute__((visibility("hidden"))) #else #define IG_PUBLIC #define IG_INTERNAL #endif #endif /* IG_VISIBILITY_H */