Link Time Optimization, r8e, Clang 3.2

241 views
Skip to first unread message

rj...@backflipstudios.com

unread,
Jul 18, 2013, 9:17:25 PM7/18/13
to andro...@googlegroups.com
Hi All,

I've been trying to get lto running all day, on either of the clang compilers, I'm hoping someone can give me a push in the right direction, cut down Application.mk:

APP_ABI := armeabi-v7a
APP_CFLAGS := -O3 -Wall -Wfatal-errors -Wno-comment -Wno-parentheses -Wno-psabi -Wno-sign-compare -Wno-switch -Wno-unknown-pragmas -Wno-unused -g 
APP_LDFLAGS := -flto -v
APP_PLATFORM := android-9
NDK_TOOLCHAIN_VERSION := clang

Cut down verbose output:

clang version 3.2 
Target: armv7-none-linux-androideabi
Thread model: posix
 "/Android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld" --sysroot=/Android/android-ndk-r8e/platforms/android-9/arch-arm -X --eh-frame-hdr -m armelf_linux_eabi -shared -Bsymbolic -dynamic-linker /system/bin/linker -o <files> -lgcc --fix-cortex-a8 --no-undefined -z noexecstack -z relro -z now -lz -ldl -llog -lOpenSLES -lGLESv1_CM -lc -lm -lstdc++ -lm -lgcc -ldl -lc -lgcc -ldl /Android/android-ndk-r8e/platforms/android-9/arch-arm/usr/lib/crtend_so.o
/Android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: lto-llvm.o-bRvUMz:1:1: invalid character
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/armeabi-v7a/libpgame.so] Error 1

I'm also curious to know if anyone has gotten it to work and what settings they use. Any help appreciated.

Richard

Justin Webb

unread,
Jul 23, 2013, 5:37:06 PM7/23/13
to andro...@googlegroups.com
I've no personal experience with this, but try adding '-flto' when compiling sources.

"This option runs the standard link-time optimizer. When invoked with source code, it generates GIMPLE (one of GCC's internal representations) and writes it to special ELF sections in the object file. When the object files are linked together, all the function bodies are read from these ELF sections and instantiated as if they had been part of the same translation unit."

Hope this helps. I'm migrating to Clang 3.2 at the moment so would be good to know if you have any luck.
Reply all
Reply to author
Forward
0 new messages