Skip to content
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

Closed
ramosian-glider opened this issue May 23, 2012 · 12 comments
Labels
bugzilla Issues migrated from bugzilla compiler-rt

Comments

@ramosian-glider
Copy link
Contributor

Bugzilla Link 12918
Resolution FIXED
Resolved on Jun 15, 2012 00:16
Version unspecified
OS MacOS X
CC @nico,@timurrrr

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)

@ramosian-glider
Copy link
Contributor Author

$ /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
cmd ?(0x00000029) Unknown load command

@ramosian-glider
Copy link
Contributor Author

Looks like r157062 has introduced the new LCT_DataInCode load command (=0x29) which is not supported by older toolchains.

@nico
Copy link
Contributor

nico commented May 26, 2012

*** Bug llvm/llvm-bugzilla-archive#12950 has been marked as a duplicate of this bug. ***

@llvmbot
Copy link
Collaborator

llvmbot commented May 26, 2012

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
$ sudo ln -s libtool /usr/local/bin/ranlib # ranlib is a symlink to 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.

@nico
Copy link
Contributor

nico commented May 28, 2012

grosbach: Can you comment if you intend to fix this, or is a prerelease ar now required to build clang on os x?

@llvmbot
Copy link
Collaborator

llvmbot commented May 30, 2012

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).

@nico
Copy link
Contributor

nico commented May 30, 2012

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.)

@ramosian-glider
Copy link
Contributor Author

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)

@timurrrr
Copy link
Contributor

timurrrr commented Jun 7, 2012

FTR, the easy workaround is:
../configure --enable-optimized --enable-targets=host-only

@nico
Copy link
Contributor

nico commented Jun 10, 2012

Yes, but that breaks cross-compilation completely and doesn't just remove iOS. (I use that for the stage 1 build.)

@nico
Copy link
Contributor

nico commented Jun 15, 2012

r158466

@nico
Copy link
Contributor

nico commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#12950

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla compiler-rt
Projects
None yet
Development

No branches or pull requests

4 participants