Cross platform dlls (ios,android,pc)

I would like to build some library code into cross platform (pc,android,ios) dlls.
On android and pc it works, on iOS it fails to build:

Cross compilation job myDll.dll failed.
UnityEngine.UnityException: Failed AOT cross compiler: /Applications/Unity/Unity.app/Contents/BuildTargetTools/iPhonePlayer/mono-xcompiler --aot=full,asmonly,nodebug,nimt-trampolines=512,static,outfile="myDll.dll.s" "myDll.dll"  current dir : /Developer-old/Test/Repositories/Project/Temp/StagingArea/Data/Managed
 result file exists: False
stdout:
stderr:

  at UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultingFile) [0x00000] in <filename unknown>:0
  at UnityEditor.MonoCrossCompile.CrossCompileAOT (BuildTarget target, System.String crossCompilerAbsolutePath, System.String assembliesAbsoluteDirectory, CrossCompileOptions crossCompileOptions, System.String input, System.String output, System.String additionalOptions) [0x00000] in <filename unknown>:0
  at UnityEditor.MonoCrossCompile+JobCompileAOT.ThreadPoolCallback (System.Object threadContext) [0x00000] in <filename unknown>:0
UnityEditor.MonoCrossCompile:CrossCompileAOTDirectoryParallel(BuildTarget, CrossCompileOptions, String, String, String)
PostProcessiPhonePlayer:PostProcess(BuildTarget, String, String, String, String, String, String, String, BuildOptions, RuntimeClassRegistry)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

I have some code like this in the dll:

#if UNITY_ANDROID && !UNITY_EDITOR
    DoStuff();
#endif

Could it be that the iOS build fails because of these platform specific parts?
The dll would contain only android specific code, but it would be annoying if we had to delete it every time we wanted to build the project for ios.
Any ideas how to fix this?

No, it’s not a Unity bug. For iOS all game script code has to be converted into Arm assembler. We do this by compiling the script code. My guess is that your DLL only contains byte code.