Ai
3 Star 3 Fork 1

Gitee 极速下载/harfbuzz

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/harfbuzz/harfbuzz
克隆/下载
check-static-inits.py 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
Khaled Hosny 提交于 2025-05-06 18:17 +08:00 . [check-*.py] Remove autotoolism
#!/usr/bin/env python3
import glob
import os
import re
import shutil
import subprocess
import sys
srcdir = sys.argv[1]
base_srcdir = sys.argv[2]
builddir = sys.argv[3]
objdump = os.getenv("OBJDUMP", shutil.which("objdump"))
if not objdump:
print("check-static-inits.py: 'ldd' not found; skipping test")
sys.exit(77)
if sys.version_info < (3, 5):
print("check-static-inits.py: needs python 3.5 for recursive support in glob")
sys.exit(77)
OBJS = glob.glob(os.path.join(builddir, "**", "*hb*.o"), recursive=True)
if not OBJS:
print("check-static-inits.py: object files not found; skipping test")
sys.exit(77)
stat = 0
tested = False
print("Checking that the following object files has no static initializers/finalizers")
print("\n".join(OBJS))
result = subprocess.run(
objdump.split() + ["-t"] + OBJS, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
if result.returncode:
if result.stderr.find(b"not recognized") != -1:
# https://github.com/harfbuzz/harfbuzz/issues/3019
print('objdump returned "not recognized", skipping')
else:
print("objdump returned error:\n%s" % (result.stderr.decode("utf-8")))
stat = 2
else:
tested = True
result = result.stdout.decode("utf-8")
# Checking that no object file has static initializers
for lib in re.findall(r"^.*\.[cd]tors.*$", result, re.MULTILINE):
if not re.match(r".*\b0+\b", lib):
print("Ouch, library has static initializers/finalizers")
stat = 1
# Checking that no object file has lazy static C++ constructors/destructors or other such stuff
if ("__cxa_" in result) and ("__ubsan_handle" not in result):
print(
"Ouch, library has lazy static C++ constructors/destructors or other such stuff"
)
stat = 1
sys.exit(stat if tested else 77)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/mirrors/harfbuzz.git
git@gitee.com:mirrors/harfbuzz.git
mirrors
harfbuzz
harfbuzz
main

搜索帮助