<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59070>59070</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Binary linked with LD64.LLD crashed at runtime due to "uncaught exception"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
oontvoo
</td>
</tr>
</table>
<pre>
Repro:
**Code:**
```
// main.m
#import <Foundation/Foundation.h>
static void throwExcFunc(int x) {
NSException* myException = [NSException exceptionWithName:@"MyCaughtException"
reason:@"Fake exception thrown WITH CATCH"
userInfo:nil];
@throw myException;
}
static void middleFunc1(int x) { throwExcFunc(x); }
static void catchFunc(int x) {
@try {
middleFunc1(x); // This repro'ed the crash
// throwExcFunc(x); // This did not repro the crash
} @catch (NSException* e) {
// do nothing
NSLog(@"^^^^caught the exception!!!");
}
}
int main() {
catchFunc(12);
return 0;
}
```
**Link command:**
```
clang -c -o main.o main.m
"ld64.lld" \
-demangle \
-dynamic \
-arch x86_64 \
-platform_version macos 13.0.0 13.0 \
-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk \
-o a.out main.o \
-framework Foundation \
-lobjc \
-lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/lib/darwin/libclang_rt.osx.a \
-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks \
-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVdtu2zgQ_Rr5hYigi2XLD3pIrBgt1s0u1gHat4CSKIsNRQok5cvf75CyLMZNF4sU6BqERc6MzhzOkEeFqM7Z36STwovvvSD3gvE_MmMtKm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