xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.45k stars 511 forks source link

"G25FAEEEE: invalid symbol redefinition" when compiling obfuscated libraries for device #8332

Open AlexNosk opened 4 years ago

AlexNosk commented 4 years ago

Steps to Reproduce

  1. Add reference to the attached dll to Xamarin.iOS project.
  2. Build for Generic Device or for Real iOS device
  3. Error G25FAEEEE: invalid symbol redefinition (G25FAEEEE) is thrown

If compile for iOS simulator everything works as expected, no compilation errors.

Expected Behavior

There should not be any compilation errors.

Actual Behavior

Compilation error when compile for real or generic device.

Environment

=== Visual Studio Community 2019 for Mac ===

Version 8.5 (build 3183)
Installation UUID: 45945212-7d8c-424d-92eb-8c38984b4dc8
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.14.1.39 (d16-5 / 30e8706b4)

    Package version: 608000123

=== Mono Framework MDK ===

Runtime:
    Mono 6.8.0.123 (2019-10/1d0d939dc30) (64-bit)
    Package version: 608000123

=== Roslyn (Language Service) ===

3.5.0-beta4-20125-04+1baa0b3063238ed752ad1f0368b1df6b6901373e

=== NuGet ===

Version: 5.4.0.6315

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.102/Sdks
SDK Versions:
    3.1.102
    3.1.101
    3.1.100
    3.0.100
    2.2.301
    2.2.104
    2.1.505
    2.1.504
    2.1.4
    2.0.0
    1.0.1
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.8.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    3.1.2
    3.1.1
    3.1.0
    3.0.0
    2.2.6
    2.2.2
    2.1.16
    2.1.15
    2.1.14
    2.1.13
    2.1.9
    2.1.8
    2.0.5
    2.0.0
    1.1.1
    1.0.4

=== Xamarin.Profiler ===

Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.4 (16134)
Build 11E146

=== Xamarin.Mac ===

Version: 6.14.1.39 (Visual Studio Community)
Hash: 30e8706b4
Branch: d16-5
Build date: 2020-02-20 16:41:47-0500

=== Xamarin.iOS ===

Version: 13.14.1.39 (Visual Studio Community)
Hash: 30e8706b4
Branch: d16-5
Build date: 2020-02-20 16:41:48-0500

=== Xamarin.Android ===

Version: 10.2.0.100 (Visual Studio Community)
Commit: xamarin-android/d16-5/988c811
Android SDK: /Users/mac1/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        5.1 (API level 22)
        6.0 (API level 23)
        7.1 (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.5
SDK Build Tools Version: 25.0.2

Build Information: 
Mono: c0c5c78
Java.Interop: xamarin/java.interop/d16-5@fc18c54
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.28.0@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/mac1/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.5.0.39
Hash: 6fb4c79
Branch: remotes/origin/d16-5
Build date: 2020-02-20 23:25:56 UTC

=== Android Device Manager ===

Version: 16.5.0.71
Hash: 49194e8
Branch: remotes/origin/d16-5
Build date: 2020-02-20 23:26:18 UTC

=== Xamarin Designer ===

Version: 16.5.0.471
Hash: 35aa4889d
Branch: remotes/origin/d16-5
Build date: 2020-02-25 00:52:08 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 805003183
Git revision: 60e06e010baa677204535600661dda3fb4677c2f
Build date: 2020-03-20 06:18:03-04
Build branch: release-8.5
Xamarin extensions: 60e06e010baa677204535600661dda3fb4677c2f

=== Operating System ===

Mac OS X 10.15.3
Darwin 19.3.0 Darwin Kernel Version 19.3.0
    Thu Jan  9 20:58:23 PST 2020
    root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64

Build Logs

log.txt

Example Project (If Possible)

TestRunner.zip TestVirtualization.zip

chamons commented 4 years ago

Thanks for the sample. I can confirm the compile issue:

/Applications/Xcode114.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode114.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk -Qunused-arguments -miphoneos-version-min=12.2 -arch arm64 -c -o /Users/donblas/Downloads/TestRunner/obj/iPhone/Debug/mtouch-cache/arm64/TestVirtualization.dll.o -x assembler -D DEBUG /Users/donblas/Downloads/TestRunner/obj/iPhone/Debug/mtouch-cache/arm64/TestVirtualization.dll.s
/Users/donblas/Downloads/TestRunner/obj/iPhone/Debug/mtouch-cache/arm64/TestVirtualization.dll.s(320297,1): error G25FAEEEE: invalid symbol redefinition
plt_________________0:
^
MTOUCH : error MT5106: Could not compile the file(s) '/Users/donblas/Downloads/TestRunner/obj/iPhone/Debug/mtouch-cache/arm64/TestVirtualization.dll.s'. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new

Obfuscated libraries sometimes contain either invalid (but executable) instructions or non-standard ones that cause issues like this.

Until someone can dig into the specifics and determine if this is our bug or not, consider changing the settings on your tool or discontinue use.