Skip to content

Commit ba4ba4d

Browse files
committed
feat(port): PE 上的异常机制跟随我们带的 unwinder
clang 面向这个三元组会定义 __SEH__,因为那是 mingw 在这个架构上用的东西 —— 而 libunwind 自己的公开头于是去够 <windows.h> 和 <ntverp.h>: unwind.h:22 → …/mingw32/include/windows.h → crtdefs.h → corecrt.h:98 typedef redefinition ⚠️ 和这个目标上其它每一条失败同一类:一个平台宏被读成了「底下是什么」的陈述。 这里答案是一个 flag 而不是一份覆盖,因为问题确实是一个构建决定:这个程序的 unwinder 就是本包里的这个,而它读 DWARF 表 —— 和它在 ELF 上、Mach-O 上读的 是同一批。 ⚠️ 它必须到达图里每一个翻译单元(docs/13 记着 -fno-exceptions 的同一条理由: 模型记在 BMI 里)。写在这里覆盖本包;消费者也要写一遍,而由 capability 决定 才是能消掉这份重复的形状。 ⚠️ 我第一次把它写在了 block header **之前**,于是它落进了上一个块 —— 实测 compile_commands 里根本没有这个 flag,而报错一字未变。
1 parent 5b5dcf5 commit ba4ba4d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

mcpp.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,31 @@ sources = [
219219
"!llvm/compiler-rt/lib/builtins/*xc3.c",
220220
]
221221

222+
# ⭐ THE EXCEPTION MECHANISM FOLLOWS THE UNWINDER WE SHIP, NOT THE PLATFORM'S
223+
# DEFAULT.
224+
#
225+
# clang targeting this triple defines `__SEH__`, because that is what mingw uses
226+
# on this architecture — and libunwind's own public header then reaches for
227+
# `<windows.h>` and `<ntverp.h>`:
228+
#
229+
# unwind.h:22 → /usr/x86_64-w64-mingw32/include/windows.h
230+
# → crtdefs.h → corecrt.h:98 typedef redefinition
231+
#
232+
# ⚠️ That is the same class of failure as every other one on this target: a
233+
# vendor SDK reached because a platform macro was read as a statement about what
234+
# is underneath. Here the answer is a flag rather than an overlay, because the
235+
# question is genuinely a build decision: this program's unwinder is the one in
236+
# this package, and it reads DWARF tables — the same ones it reads on ELF and on
237+
# Mach-O.
238+
#
239+
# ⚠️ IT HAS TO REACH EVERY TRANSLATION UNIT IN THE GRAPH, for the reason
240+
# docs/13 records about `-fno-exceptions`: the model is recorded in a BMI, and a
241+
# dependency compiled one way cannot be imported by a unit compiled the other.
242+
# Stated here it covers this package; a consumer states it too, and mcpp
243+
# deciding it from the capability is the shape that would remove the repetition.
222244
[target.'cfg(windows)'.build]
245+
cxxflags = ["-fdwarf-exceptions"]
246+
cflags = ["-fdwarf-exceptions"]
223247
sources = [
224248
"!llvm/libcxx/src/filesystem/int128_builtins.cpp",
225249
"llvm/compiler-rt/lib/builtins/*.c",

0 commit comments

Comments
 (0)