-
Notifications
You must be signed in to change notification settings - Fork 169
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
bitcode_hide_symbols support #31
Comments
Seems like you must use Apple's LLVM/Clang version due to
=> Re-build cctools and ld64 (not tested). => Ensure ld64 uses the correct libLTO.so:
|
I followed your instructions and all goes fine until I tried to rebuild cc-tools, with the following commands (that have always worked using the default installed clang/llvm):
But unfortunately I got some link errors when generating/linking ld64:
Any idea? Many thanks in advance! |
Please post the whole build log + tmp/cctools/config.log. |
Here are the steps I've followed: Build and install xar library:
Build and install tapi lib:
NB: at the end of these two steps within /usr/local/lib I've:
Redirect clang/llvm in order to point to Apple one:
Now building with the following commands:
|
Weird. Could you also upload |
Sure, I zip it and attach. A question: during the linking phase, does ld will use libtapi generated within target/lib or will it use the one I've installed in the system in /usr/local/lib ? UPDATEJust checked, they have two different size:
|
Remove |
After your suggestion, cctools and ld64 built successfuly! Unfortunately the produced ld does not depend on Apple clang/llvm:
|
Force the linker to use the Apple one.
I dont know of a better way at the moment. If possible, uninstall libllvm and libllvm-dev. |
Now it works, simple and dirty. The whole solution sounds just a big workaround, but I'll trust that next official mainstream version of clang will support bitcode ;) MANY thanks! |
Uhm, does rpath linking actually work on your system? On my system all libs are used correctly without need to adjust LD_LIBRARY_PATH. I also have libLTO.so in /usr/lib, but ldd -correctly- shows /opt/compiler/apple-clang/lib/libLTO.so. What dist are you on? Also please let me see the current config.log. |
Just forgot to tell you that after building cctools I've copied libtapi.so to /usr/local/lib |
What's the output of |
chrpath /usr/ioscross/bin/arm-apple-darwin11-ld |
Okay, thanks. I will try to look into it. This issue bugs me. |
You moved the whole directory, that's why RPATH is not working. /usr/ioscross/bin/arm-apple-darwin11-ld: RUNPATH=/usr/lib/llvm-3.9/lib:/tmp/ioscross/cctools-port/usage_examples/ios_toolchain/target/lib:/tmp/ioscross/cctools-port/usage_examples/ios_toolchain/target/lib64:/tmp/ioscross/cctools-port/usage_examples/ios_toolchain/target/lib32 Also I think you compiled with the wrong compiler. Ensure clang and llvm-config are used from /opt/compiler/apple-clang/bin.
If you really must to move the target directory, add
|
Compiler was set correctly (pointed to apple clang), but yes after building I moved the whole directory "sudo mv target /usr/ioscross". Is there a better way to move the built tools (in osxcross it worked)?
When trying to prelink some object files compiled with embedded bitcode
|
The same applies to llvm-config?
|
developer@BuildBox:/tmp/ioscross/cctools-port/usage_examples/ios_toolchain: which llvm-config clang
developer@BuildBox:/tmp/ioscross/cctools-port/usage_examples/ios_toolchain: cat tmp/cctools/config.log |grep llvm-config|grep found
developer@BuildBox:/tmp/ioscross/cctools-port/usage_examples/ios_toolchain: ldd ./target/bin/arm-apple-darwin11-ld
It seems all right, correct? UPDATEBy not moving the produced tools into /usr/ioscross, but instead redirecting my CMake toolchain configuration in order to point to /tmp/ioscross (i.e. the directory where I built cctools), 'bitcode_hide_symbols' seems to work without problems! So, I can simply build cctools in /usr/ioscross instead of building into /tmp/osxcross + move directory. The only 'ugly' thing of the overall process is that I must set PATH env variable in order to point to Apple Clang/LLVM instead of the one installed by default in the host system. |
Good. :-)
Add
OSXCross does not depend on the TAPI library (yet). I want to make sure things are working properly before adding TAPIv2 support to OSXCross. I think the best solution would be to adjust the RPATH manually with chrpath. i.e.: Please do not copy libs into /usr/local/lib. |
I decided to move the PATH=/opt/compiler/apple-clang/bin:$PATH into my build script (PATH=... && cmake ...), I prefer this change in order to not touch "global/shell-persistent" PATH variable. Anyway, many thanks again for your precious help!!! |
You are welcome! You should compile your iOS and macOS projects with "apple-clang" otherwise you might run into problems. LD64 uses libLTO for code generation (LTO and the bitcode stuff). Edit: Nvm. I think I got your sentence wrong. Anyway, ensure you are always using "apple-clang" when targeting iOS or macOS. |
Hello,
I downloaded and compiled successfuly the last version of cctools. I'm trying to pre-link some object files (containing bitcode) into a single one:
ld -r -x -bitcode_bundle -bitcode_hide_symbols -arch armv7 -o prelinked_mylib.a <OBJ_FILES>
and I'm getting the following error: "ld: loaded libLTO doesn't support -bitcode_hide_symbols: LLVM version 3.9.1 for architecture armv7"
Is there a way to get support for 'bitcode_hide_symbols' features? Any idea/switch?
Many thanks in advance,
Matteo.
The text was updated successfully, but these errors were encountered: