No support for arm64e (iOS/macOS)
I am building something with XCode 14.1 and passing "-fuse-ld=mold" through setting the LD_FLAGS argument to xcodebuild.
mold is returning:
mold: fatal: unknown -arch: arm64e
How difficult would it be to support arm64e?
interesting because building using clang from llvm.org fails because -macos_version_min is what ld64.mold expects and the actual parameter being used is -macosx_version_min...but llvm.org clang passes -arch arm64 which works. it seems the Xcode clang is passing -arch arm64e to the linker which is different. can fix both problems, with -arch and -macos_version_min by looking in macho/cmdline.cc and amending it there. for -arch look for the line starting with "else if (arg == "arm64" " and patch to "else if (arg == "arm64" || arg == "arm64e")" to fix the problem you are having and for the other one "else if (read_arg("-macosx_version_min")) {" can become "else if (read_arg("-macosx_version_min") || read_arg("-macos_version_min")) {" however this does not solve another problem I have; when linking against the libraries extracted from the dynamic linker cache for arm64e instead of the stub libraries, I get a segfault. it has to be in the code reading the library as the tbd support works...I will attempt to debug this , and find exactly where. I took a look but it was not in a debug build and I was not overly concerned. it had no problem though reading the archive libraries from the clang support libs. this isn't my normal GitHub account, hence the one post, I am just unable to log in easily and haven't in a while so I created this one to respond to this issue also I'd be happy to contribute especially if we could see the arm64e support be integrated to the gnu style linker. I am working on toolchains and have maintained an fork of the old ld64 of apples specifically to keep compatibility with that convention, and made a very functional support for much of the stuff apple removed..I maintain a lot of static libraries including a fairly complete libc and in fact I can say that supporting the gnu feature set may not be what apple is providing but there is call for it... if you make the adjustments to cmdline.cc above you should be able to link with Xcode. it's using stub libraries and those don't cause a problem
arm64e is an ARM64 ABI with pointer authentication. It shouldn't be too hard to support it, but we need to learn the ABI first.