New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression(r157062 ): compiler-rt build on mac is broken due to armv6 changes #13290
Comments
$ /Users/glider/src/asan/llvm/build/Release+Asserts/bin/clang -arch armv6 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -Werror -O3 -fomit-frame-pointer -miphoneos-version-min=1.0 -isysroot /Users/glider/src/asan/llvm/projects/compiler-rt/SDKs/darwin -c -fPIC -o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib/int_util.o /Users/glider/src/asan/llvm/projects/compiler-rt/lib/int_util.c && otool -l /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib/int_util.o 2>&1 | grep Unknown |
Looks like r157062 has introduced the new LCT_DataInCode load command (=0x29) which is not supported by older toolchains. |
*** Bug llvm/llvm-bugzilla-archive#12950 has been marked as a duplicate of this bug. *** |
You can get around this fairly easily--for certain definitions of "easy" :). Go to opensource.apple.com and get the source to the cctools project from any Xcode version >= 4.3. We're going to build our own ar and ranlib. After unpacking the tarball, chdir into /libstuff and build the libstuff library with make. Then, chdir to ../misc and make libtool.NEW. Execute these commands when the build finishes: $ sudo install -c -m 0755 libtool.NEW /usr/local/bin/libtool Finally, chdir to ../ar and make ar.NEW. When that's done, install ar.NEW to /usr/local/bin like so: $ sudo install -c -m 0755 ar.NEW /usr/local/bin/ar This should fix the issue you're seeing. It did for me. |
grosbach: Can you comment if you intend to fix this, or is a prerelease ar now required to build clang on os x? |
Yes, the data in code load command requires very recent cctools+ld64. However, why is clang trying to build anything for iOS outside of an Apple internal build environment? That shouldn't be happening (this is a good example of why). |
compiler-rt is built for OS X and iOS by default. I don't know if that's intentional (ddunbar?), but I guess it makes sense since one might want to use the mac clang to build iOS apps. (I could do without that, but I don't want to use a non-default compiler-rt build config.) |
For the record, I had to pass additional options in order to build ar and libtool with Xcode 4.2: $ make LTO= TRIE= -j8 -k (there was also a linktime error in lipo.NEW, so I had to pass -k) |
FTR, the easy workaround is: |
Yes, but that breaks cross-compilation completely and doesn't just remove iOS. (I use that for the stage 1 build.) |
r158466 |
mentioned in issue llvm/llvm-bugzilla-archive#12950 |
Extended Description
I'm building compiler-rt for AddressSanitizer according to http://code.google.com/p/address-sanitizer/wiki/HowToBuild
The following command fails when running make:
ARCHIVE: clang_darwin/ios/armv6: /Users/buildbot/src/llvm-buildbot/slave/mac10.6/build/llvm-build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/libcompiler_rt.a
make[5]: *** [/Users/buildbot/src/llvm-buildbot/slave/mac10.6/build/llvm-build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/libcompiler_rt.a] Error 1
Setting VERBOSE=1 prints the failing command:
ar cru /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/libcompiler_rt.a /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/divmodsi4.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib/int_util.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib/mulodi4.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib/mulosi4.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib/muloti4.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/restore_vfp_d8_d15_regs.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/save_vfp_d8_d15_regs.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/switch16.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/switch32.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/switch8.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/switchu8.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/sync_synchronize.o /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/SubDir.lib__arm/udivmodsi4.o
, which results in:
/usr/bin/ranlib: object: /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/ios/armv6/libcompiler_rt.a(int_util.o) malformed object (unknown load command 1)
The text was updated successfully, but these errors were encountered: