跳转至

ev-mold-constexpr-entry-size-001

字段 值
项目 rui314/mold
固定 commit 27162691b71a
路径 src/mold.h
行段 L593-L594
特性 constexpr
许可证 MIT
代码来源 项目源码
级别 manual
审核 zyuhao7 @ 2026-10-27
测试代码 否
发现方式 manual

用法

用 constexpr 在编译期根据类型参数计算表头与表项大小

为什么典型

大小依赖 is_ppc64v2 等编译期布尔量,constexpr 让结果直接参与数组维度与静态断言。

摘录

  static constexpr i64 HDR_SIZE = (is_ppc64v2<E> ? 2 : 3) * sizeof(Word<E>);
  static constexpr i64 ENTRY_SIZE = (is_ppc64v1<E> ? 3 : 1) * sizeof(Word<E>);

备注

生产路径;ELF 重定位表头大小按目标架构在编译期确定。

查看固定 commit 源码 · 返回证据索引