Linaro toolchain Android linking problem redivivus

2013-04-18 Thread Marius Cetateanu

Hi,

Some time ago I had some problems linking my project libraries for
Android using the Linaro toolchain 4.7.1 which I reported to the
list:

http://lists.linaro.org/pipermail/linaro-toolchain/2012-June/002631.html

I ended up using the 4.6.x version of the compiler because
I could not find a fix and I did not get any hints from
the mailing list.
Now I need to really switch to 4.7(for better C++11 support)
but I'm pretty much having the same issue with the 4.7.3 version:

E.g.

System/Logging/DroidLogger.cpp.o: requires unsupported dynamic reloc 
R_ARM_REL32; recompile with -fPIC
/home/dev/android/android_linaro_toolchain_4.7/bin/../libexec/gcc/arm-linux-androideabi/4.7.3/real-ld: 
error: 
/home/marius/Development/ToolChains/Android/experimental_ndk/sources/cxx-stl/gnu-libstdc++/4.7.3/libs/armeabi-v7a/libsupc++.a(eh_globals.o): 
requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
/home/dev/android/android_linaro_toolchain_4.7/bin/../libexec/gcc/arm-linux-androideabi/4.7.3/real-ld: 
error: hidden symbol '__dso_handle' is not defined locally
/home/dev/android/android_linaro_toolchain_4.7/bin/../libexec/gcc/arm-linux-androideabi/4.7.3/real-ld: 
error: hidden symbol '__dso_handle' is not defined locally


I'm using it with the Android NDK version r8e.
I have downloaded the prebuilt binaries:
android-toolchain 4.7 (ICS, JB)  4.7-2013.03 
13.03

(Linaro GCC 4.7-2013.03) 4.7.3 20130226 (prerelease)

Does anyone have any hints on how to overcome the above mentioned problem?

--

Marius Cetateanu | Software Engineer
T  +32 2 888 42 60
F  +32 2 647 48 55
E  m...@softkinetic.com
YT www.youtube.com/softkinetic

SK Logo 

Boulevard de la Plaine 15, 1050, B-Brussels, Belgium
Registration No: RPM/RPR Brussels 0811 784 189

Our e-mail communication disclaimers & liability are available at: 
www.softkinetic.com/disclaimer.aspx



___
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain


Re: clang + VFP

2013-04-18 Thread Renato Golin
Hi Tom,

On 17 April 2013 21:13, Tom Gall  wrote:

> When the clang .o is linked to the gcc/gcc+, I'm getting
> /home/tgall/opencl/SNU/tmp2/cl_temp_1.tkl uses VFP register arguments,
> /home/tgall/opencl/SNU/tmp2/cl_temp_1.o does not
>

This is pretty common. Clang assumes ARMv4 unless you're pretty specific
about your core.


clang -mfloat-abi=hard -mfpu=neon -S -emit-llvm -x cl
> -I/home/tgall/opencl/SNU/src/compiler/tools/clang/lib/Headers
> -I/home/tgall/opencl/SNU/inc -include
> /home/tgall/opencl/SNU/inc/comp/cl_kernel.h
> /home/tgall/opencl/SNU/tmp2/cl_temp_1.cl -o
> /home/tgall/opencl/SNU/tmp2/cl_temp_1.ll
>

What target triple do you see when you run:

$ head /home/tgall/opencl/SNU/tmp2/cl_temp_1.ll

If it's "arm-blah", then it'll default to ARMv4. It has to be "armv7*" to
default to Cortex-A8, but would be good to specify the CPU as well. It
won't detect from the hardware you're in yet.



> so first obvious question is -mfloat-abi=hard -mfpu=neon correct for clang?
>

Neither required, nor sufficient. ;)

When you chose your triple "armv7l-*" it'll default to A8, Neon,
hard-float. If you specify hard-float and Neon, it won't default to A8 and
the parameters will be ignored further in. It doesn't make sense, I agree,
and it's a problem not just for cross-compilation, but native.

The best bet is to specify the triple AND the CPU, so that you're sure
you're getting what you want:

$ clang -target arm-linux-gnueabihf -mcpu=cortex-a9 -mfpu=neon -mthumb

As you noticed, Thumb2 is not the default for Cortex-A*, but hard-float is.
You can always see what hidden options you got by adding -v to the command
line. Also, the triple here is "arm-*" but Clang will notice the A9 option
and will change accordingly in the IR and pass the correct options to the
assembler. If you do in two steps, you still have to pass it yourself,
because "armv7-*" in the IR will turn out as Cortex-A8 by default.

Two other options that I encourage you to try:

-integrated-as : the experimental (on ARM) integrated assembler. You won't
be using GAS, so if your code depends on GAS' idiosyncrasies, don't use
this option.

-O3 : Apart from the usual, this will turn on auto-vectorization (like
GCC), which is also kind of experimental. Just be aware of that.

Hope that helps,
--renato

PS: If you're cross compiling, you'll have to manually specify the include
paths.
___
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain


Re: Linaro toolchain Android linking problem redivivus

2013-04-18 Thread Christophe Lyon
Could you post the full command-line leading to this error?
Did you try to add -fPIC as suggested?

Christophe.



On 18 April 2013 09:53, Marius Cetateanu  wrote:

>  Hi,
>
> Some time ago I had some problems linking my project libraries for
> Android using the Linaro toolchain 4.7.1 which I reported to the
> list:
>
> http://lists.linaro.org/pipermail/linaro-toolchain/2012-June/002631.html
>
> I ended up using the 4.6.x version of the compiler because
> I could not find a fix and I did not get any hints from
> the mailing list.
> Now I need to really switch to 4.7(for better C++11 support)
> but I'm pretty much having the same issue with the 4.7.3 version:
>
> E.g.
>
> System/Logging/DroidLogger.cpp.o: requires unsupported dynamic reloc
> R_ARM_REL32; recompile with -fPIC
> /home/dev/android/android_linaro_toolchain_4.7/bin/../libexec/gcc/arm-linux-androideabi/4.7.3/real-ld:
> error:
> /home/marius/Development/ToolChains/Android/experimental_ndk/sources/cxx-stl/gnu-libstdc++/4.7.3/libs/armeabi-v7a/libsupc++.a(eh_globals.o):
> requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
> /home/dev/android/android_linaro_toolchain_4.7/bin/../libexec/gcc/arm-linux-androideabi/4.7.3/real-ld:
> error: hidden symbol '__dso_handle' is not defined locally
> /home/dev/android/android_linaro_toolchain_4.7/bin/../libexec/gcc/arm-linux-androideabi/4.7.3/real-ld:
> error: hidden symbol '__dso_handle' is not defined locally
>
> I'm using it with the Android NDK version r8e.
> I have downloaded the prebuilt binaries:
> android-toolchain 4.7 (ICS, JB) 4.7-2013.03 
> 13.03
> (Linaro GCC 4.7-2013.03) 4.7.3 20130226 (prerelease)
>
> Does anyone have any hints on how to overcome the above mentioned problem?
>
>  --
>
> Marius Cetateanu | Software Engineer
> T  +32 2 888 42 60
> F  +32 2 647 48 55
> E  m...@softkinetic.com
> YTwww.youtube.com/softkinetic
>
> [image: SK Logo] 
>
> Boulevard de la Plaine 15, 1050, B-Brussels, Belgium
> Registration No: RPM/RPR Brussels 0811 784 189
>
> Our e-mail communication disclaimers & liability are available at:
> www.softkinetic.com/disclaimer.aspx
>
>
>
> ___
> linaro-toolchain mailing list
> linaro-toolchain@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-toolchain
>
>
___
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain