Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lldb] Support Universal Mach-O binaries with a fat64 header
Support universal Mach-O binaries with a fat64 header. After 4d683f7, dsymutil can now generate such binaries when the offsets would otherwise overflow the 32-bit offsets in the regular fat header. rdar://107289570 Differential revision: https://reviews.llvm.org/D147012
- Loading branch information
1 parent
a955a31
commit fda53ad
Showing
6 changed files
with
145 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
EXE := fat.out | ||
|
||
ifdef FAT64_DSYM | ||
DSFLAGS_EXTRAS=-fat64 | ||
endif | ||
|
||
include Makefile.rules | ||
|
||
all: fat.out | ||
|
||
fat.out: fat.arm64.out fat.x86_64.out | ||
lipo -fat64 -create -o $@ $^ | ||
|
||
fat.x86_64.out: fat.x86_64.o | ||
$(CC) -isysroot $(SDKROOT) -target x86_64-apple-macosx10.9 -o $@ $< | ||
|
||
fat.arm64.out: fat.arm64.o | ||
$(CC) -isysroot $(SDKROOT) -target arm64-apple-macosx10.9 -o $@ $< | ||
|
||
fat.x86_64.o: main.c | ||
$(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64-apple-macosx11 -c -o $@ $< | ||
|
||
fat.arm64.o: main.c | ||
$(CC) -isysroot $(SDKROOT) -g -O0 -target arm64-apple-macosx11 -c -o $@ $< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import * | ||
from lldbsuite.test import lldbutil | ||
|
||
|
||
class Universal64TestCase(TestBase): | ||
NO_DEBUG_INFO_TESTCASE = True | ||
|
||
def do_test(self): | ||
# Get the executable. | ||
exe = self.getBuildArtifact("fat.out") | ||
|
||
# Create a target. | ||
self.target = self.dbg.CreateTarget(exe) | ||
|
||
# Create a breakpoint on main. | ||
main_bp = self.target.BreakpointCreateByName("main") | ||
self.assertTrue(main_bp, VALID_BREAKPOINT) | ||
|
||
# Make sure the binary and the dSYM are in the image list. | ||
self.expect("image list ", patterns=['fat.out', 'fat.out.dSYM']) | ||
|
||
# The dynamic loader doesn't support fat64 executables so we can't | ||
# actually launch them here. | ||
|
||
@skipUnlessDarwin | ||
@skipIfDarwinEmbedded | ||
def test_universal64_executable(self): | ||
"""Test fat64 universal executable""" | ||
self.build(debug_info="dsym") | ||
self.do_test() | ||
|
||
@skipUnlessDarwin | ||
@skipIfDarwinEmbedded | ||
@skipIf(compiler="clang", compiler_version=['<', '7.0']) | ||
def test_universal64_dsym(self): | ||
"""Test fat64 universal dSYM""" | ||
self.build(debug_info="dsym", dictionary={'FAT64_DSYM': '1'}) | ||
self.do_test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <stdio.h> | ||
|
||
int foo() { return 0; } | ||
|
||
int main(int argc, char **argv) { return foo(); } |