Skip to content

Commit 8a849e7

Browse files
committed
Try to fix osx
1 parent 6b0b66e commit 8a849e7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/coreclr/src/nativeaot/Bootstrap/main.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,18 @@ int main(int argc, char* argv[])
192192
#endif // !CORERT_DLL
193193

194194
#ifdef CORERT_DLL
195-
struct InitializeRuntimePointerHelper
195+
static struct InitializeRuntimePointerHelper
196196
{
197197
InitializeRuntimePointerHelper()
198198
{
199199
RhSetRuntimeInitializationCallback(&InitializeRuntime);
200200
}
201-
};
201+
} initializeRuntimePointerHelper;
202+
203+
extern "C" void* CoreRT_StaticInitialization();
202204

203-
extern "C" InitializeRuntimePointerHelper CoreRT_StaticInitialization;
204-
InitializeRuntimePointerHelper CoreRT_StaticInitialization;
205+
void* CoreRT_StaticInitialization()
206+
{
207+
return &initializeRuntimePointerHelper;
208+
}
205209
#endif // CORERT_DLL

src/coreclr/src/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ The .NET Foundation licenses this file to you under the MIT license.
8585
<LinkerArg Include="-licucore" Condition="'$(TargetOS)' == 'OSX'" />
8686
<LinkerArg Include="-dynamiclib" Condition="'$(TargetOS)' == 'OSX' and '$(NativeLib)' == 'Shared'" />
8787
<LinkerArg Include="-shared" Condition="'$(TargetOS)' != 'OSX' and '$(NativeLib)' == 'Shared'" />
88-
<LinkerArg Include="-Wl,--require-defined,CoreRT_StaticInitialization" Condition="'$(NativeLib)' == 'Shared'" />
89-
88+
<LinkerArg Include="-Wl,-u,_CoreRT_StaticInitialization" Condition="'$(TargetOS)' == 'OSX' and '$(NativeLib)' == 'Shared'" />
89+
<LinkerArg Include="-Wl,--require-defined,CoreRT_StaticInitialization" Condition="'$(TargetOS)' != 'OSX' and '$(NativeLib)' == 'Shared'" />
90+
9091
<LinkerArg Include="@(NativeFramework->'-framework %(Identity)')" Condition="'$(TargetOS)' == 'OSX'" />
9192
</ItemGroup>
9293

0 commit comments

Comments
 (0)