[all-commits] [llvm/llvm-project] a6d673: [lld-macho][nfc] define command UNWIND_MODE_MASK f...
Vy Nguyen via All-commits
all-commits at lists.llvm.org
Fri Oct 14 12:17:11 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a6d6734a41f4960bf7447db4515e2acfd187fea0
https://github.com/llvm/llvm-project/commit/a6d6734a41f4960bf7447db4515e2acfd187fea0
Author: Vy Nguyen <vyng at google.com>
Date: 2022-10-14 (Fri, 14 Oct 2022)
Changed paths:
M lld/MachO/InputFiles.cpp
M lld/MachO/Target.h
M lld/MachO/UnwindInfoSection.cpp
Log Message:
-----------
[lld-macho][nfc] define command UNWIND_MODE_MASK for convenience and rewrite mode-mask checking logic for clarity
The previous form is currently "harmless" and happened to work but may not in the future:
Consider the struct: (for x86-64, but same issue can be said for the ARM/64 families):
```
UNWIND_X86_64_MODE_MASK = 0x0F000000,
UNWIND_X86_64_MODE_RBP_FRAME = 0x01000000,
UNWIND_X86_64_MODE_STACK_IMMD = 0x02000000,
UNWIND_X86_64_MODE_STACK_IND = 0x03000000,
UNWIND_X86_64_MODE_DWARF = 0x04000000,
```
Previously, we were doing: `(encoding & MODE_DWARF) == MODE_DWARF`
As soon as a new `UNWIND_X86_64_MODE_FOO = 0x05000000` is defined, then the check above would always return true for encoding=MODE_FOO (because `(0b0101 & 0b0100) == 0b0100` )
Differential Revision: https://reviews.llvm.org/D135359
More information about the All-commits
mailing list