未验证 提交 af1ed052 编写于 作者: A Alexander Köplinger 提交者: GitHub

Pass linker flags to Mono build on Android correctly (#51403)

We were setting `_MonoLDFLAGS` in mono.proj but never passed the values down into CMake.
上级 fbd3b980
...@@ -60,7 +60,7 @@ endif() ...@@ -60,7 +60,7 @@ endif()
# Older CMake versions (3.8) do not assign the result of their tests, causing unused-value errors # Older CMake versions (3.8) do not assign the result of their tests, causing unused-value errors
# which are not distinguished from the test failing. So no error for that one. # which are not distinguished from the test failing. So no error for that one.
# For clang-5.0 avoid errors like "unused variable 'err' [-Werror,-Wunused-variable]". # For clang-5.0 avoid errors like "unused variable 'err' [-Werror,-Wunused-variable]".
set(CMAKE_REQUIRED_FLAGS "-Werror -Wno-error=unused-value -Wno-error=unused-variable") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror -Wno-error=unused-value -Wno-error=unused-variable")
# Apple platforms like macOS/iOS allow targeting older operating system versions with a single SDK, # Apple platforms like macOS/iOS allow targeting older operating system versions with a single SDK,
# the mere presence of a symbol in the SDK doesn't tell us whether the deployment target really supports it. # the mere presence of a symbol in the SDK doesn't tell us whether the deployment target really supports it.
......
...@@ -213,6 +213,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") ...@@ -213,6 +213,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(HOST_LINUX 1) set(HOST_LINUX 1)
add_definitions(-D_GNU_SOURCE -D_REENTRANT) add_definitions(-D_GNU_SOURCE -D_REENTRANT)
add_definitions(-D_THREAD_SAFE) add_definitions(-D_THREAD_SAFE)
add_compile_options(-Wl,-z,now)
add_compile_options(-Wl,-z,relro)
add_compile_options(-Wl,-z,noexecstack)
# The normal check fails because it uses --isystem <ndk root>/sysroot/usr/include # The normal check fails because it uses --isystem <ndk root>/sysroot/usr/include
set(HAVE_USR_INCLUDE_MALLOC_H 1) set(HAVE_USR_INCLUDE_MALLOC_H 1)
set(HOST_ANDROID 1) set(HOST_ANDROID 1)
......
...@@ -249,7 +249,6 @@ ...@@ -249,7 +249,6 @@
<_MonoCMakeArgs Include="-DCMAKE_OSX_DEPLOYMENT_TARGET=$(macOSVersionMin)" /> <_MonoCMakeArgs Include="-DCMAKE_OSX_DEPLOYMENT_TARGET=$(macOSVersionMin)" />
<_MonoCFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> <_MonoCFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" />
<_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" />
<_MonoLDFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" />
<!-- Force running as arm64 even when invoked from an x86 msbuild process --> <!-- Force running as arm64 even when invoked from an x86 msbuild process -->
<_MonoBuildEnv Condition="'$(BuildArchitecture)' == 'arm64'" Include="arch -arch arm64" /> <_MonoBuildEnv Condition="'$(BuildArchitecture)' == 'arm64'" Include="arch -arch arm64" />
</ItemGroup> </ItemGroup>
...@@ -264,7 +263,6 @@ ...@@ -264,7 +263,6 @@
<_MonoCXXFlags Condition="'$(TargetArchitecture)' == 'arm64'" Include="-target arm64-apple-ios14.2-macabi" /> <_MonoCXXFlags Condition="'$(TargetArchitecture)' == 'arm64'" Include="-target arm64-apple-ios14.2-macabi" />
<_MonoCXXFlags Condition="'$(TargetArchitecture)' == 'x64'" Include="-target x86_64-apple-ios13.5-macabi" /> <_MonoCXXFlags Condition="'$(TargetArchitecture)' == 'x64'" Include="-target x86_64-apple-ios13.5-macabi" />
<_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" />
<_MonoLDFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" />
<!-- Force running as arm64 even when invoked from an x86 msbuild process --> <!-- Force running as arm64 even when invoked from an x86 msbuild process -->
<_MonoBuildEnv Condition="'$(BuildArchitecture)' == 'arm64'" Include="arch -arch arm64" /> <_MonoBuildEnv Condition="'$(BuildArchitecture)' == 'arm64'" Include="arch -arch arm64" />
</ItemGroup> </ItemGroup>
...@@ -378,15 +376,6 @@ ...@@ -378,15 +376,6 @@
<_MonoCXXFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-DSK_RELEASE" /> <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-DSK_RELEASE" />
<_MonoCXXFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-DNDEBUG" /> <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-DNDEBUG" />
<_MonoCXXFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-UDEBUG" /> <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-UDEBUG" />
<_MonoLDFLAGS Include="-z now" />
<_MonoLDFLAGS Include="-z relro" />
<_MonoLDFLAGS Include="-z noexecstack" />
<_MonoLDFLAGS Include="-ldl" />
<_MonoLDFLAGS Include="-lm" />
<_MonoLDFLAGS Include="-llog" />
<_MonoLDFLAGS Include="-lc" />
<_MonoLDFLAGS Include="-lgcc" />
</ItemGroup> </ItemGroup>
<!-- Linux options --> <!-- Linux options -->
<ItemGroup Condition="'$(TargetsLinux)' == true"> <ItemGroup Condition="'$(TargetsLinux)' == true">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册