Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zld: handle parsing and synthesising unwind info in the MachO linker #14397

Merged
merged 9 commits into from
Jan 21, 2023
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,12 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/src/link/MachO/Object.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/Relocation.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/Trie.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/UnwindInfo.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/ZldAtom.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/dyld_info/bind.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/dyld_info/Rebase.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/dead_strip.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/eh_frame.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/fat.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/load_commands.zig"
"${CMAKE_SOURCE_DIR}/src/link/MachO/thunks.zig"
Expand Down
2 changes: 2 additions & 0 deletions lib/std/macho.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,7 @@ pub const UNWIND_PERSONALITY_MASK: u32 = 0x30000000;
// x86_64
pub const UNWIND_X86_64_MODE_MASK: u32 = 0x0F000000;
pub const UNWIND_X86_64_MODE = enum(u4) {
OLD = 0,
RBP_FRAME = 1,
STACK_IMMD = 2,
STACK_IND = 3,
Expand Down Expand Up @@ -2039,6 +2040,7 @@ pub const UNWIND_X86_64_REG = enum(u3) {
// arm64
pub const UNWIND_ARM64_MODE_MASK: u32 = 0x0F000000;
pub const UNWIND_ARM64_MODE = enum(u4) {
OLD = 0,
FRAMELESS = 2,
DWARF = 3,
FRAME = 4,
Expand Down
3 changes: 3 additions & 0 deletions src/link.zig
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ pub const File = struct {
/// TODO audit this error set. most of these should be collapsed into one error,
/// and ErrorFlags should be updated to convey the meaning to the user.
pub const FlushError = error{
BadDwarfCfi,
CacheUnavailable,
CurrentWorkingDirectoryUnlinked,
DivisionByZero,
Expand Down Expand Up @@ -737,6 +738,8 @@ pub const File = struct {
MissingEndForExpression,
/// TODO: this should be removed from the error set in favor of using ErrorFlags
MissingMainEntrypoint,
/// TODO: this should be removed from the error set in favor of using ErrorFlags
MissingSection,
MissingSymbol,
MissingTableSymbols,
ModuleNameMismatch,
Expand Down
526 changes: 432 additions & 94 deletions src/link/MachO/Object.zig

Large diffs are not rendered by default.

Loading