已开启
[feature]: codesize 优化之lto场景下删除导入包反射信息 #889
duan创建于 5月12日
5月12日 添加了label:bug
7月13日 删除了关联的pull request:fix: opt diasble importlib reflection
7月13日 删除了关联的pull request:fix: opt diasble importlib reflection
7月13日 删除了关联的pull request:feat: disable import lto reflection
7月13日 删除了关联的pull request:feat: disable import lto reflection
21 天前 修改了issue 的描述
21 天前 修改了issue 的描述
7 天前 修改标题为 “[feat]: codesize 优化之lto场景下删除导入包反射信息”,原标题为“[Bug]: codesize 优化之lto场景下删除导入包反射信息”
7 天前 修改标题为 “[feature]: codesize 优化之lto场景下删除导入包反射信息”,原标题为“[feat]: codesize 优化之lto场景下删除导入包反射信息”
感谢对仓颉社区的支持与关注,欢迎反馈缺陷。 | Thanks for your support and attention to the community. We welcome feedback on any issues.
发生了什么问题? | Describe the issue that occurred.
在 Cangjie Native 使用 LTO 编译时,导入包中的反射信息未被裁剪,导致最终生成的可执行文件包含不必要的反射元数据,增加了二进制文件体积。
期望行为是什么? | What is the expected behavior?
在启用 --disable-reflection 的 LTO 场景下,应清理导入包中的无用反射信息。该行为不限制优化级别,但在不同优化级别下,最终可被消除的反射符号数量可能不同。
如何复现该缺陷? | How to reproduce the bug?
其中,main.cj 导入 pkgs 和 pkga,并使用其中的类型和方法。
预期结果:
main.out 可以正常运行;
main.out 小于 main_reflect.out;
导入包中不必要的 reflection 信息被删除,例如反射方法,参数等;
保留导入包中必要的字段反射元数据,例如 Data.tt.fieldnames;
同时需要覆盖以下场景:
Full LTO:--lto=full
Thin LTO:--lto=thin
平台:Linux + Cangjie Native
其他补充信息
当前测试用例目录:cangjie_test/testsuites/LLT/compiler/Driver/LTO/disable_import_lib_reflection/
当前覆盖场景:Linux + CJNATIVE
Windows 当前不支持 LTO,执行 LTO 命令会提示:
Windows does not support LTO.
其他补充信息 | Additional information
cjc版本信息 | cjc version information
当前dev
分支版本信息 | Branch version information