[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to distinguish armel and armhf at runtime?



On Fri, Sep 22, 2017 at 3:57 PM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
>...
> For armhf I need to define __ARM_PCS_VFP but that must be absent on armel.

Forgive my ignorance... If the compiler was built for the native
platform, then wouldn't the compiler and preprocessor definitions tell
you?

I guess I expect the compiler to tell the truth about its native
configuration. For example, below is from a BananaPi, and it was built
for a platform that uses hard floats.

Jeff

$ echo '#include <stdlib.h>' | gcc -dumpmachine
arm-linux-gnueabihf

$ echo '#include <stdlib.h>' | gcc -dM -E - | egrep -i
'arm|hard|hf|float' | sort
#define __ARMEL__ 1
#define __ARM_32BIT_STATE 1
#define __ARM_ARCH 7
#define __ARM_ARCH_7A__ 1
#define __ARM_ARCH_ISA_ARM 1
#define __ARM_ARCH_ISA_THUMB 2
#define __ARM_ARCH_PROFILE 65
#define __ARM_EABI__ 1
#define __ARM_FEATURE_CLZ 1
#define __ARM_FEATURE_DSP 1
#define __ARM_FEATURE_LDREX 15
#define __ARM_FEATURE_QBIT 1
#define __ARM_FEATURE_SAT 1
#define __ARM_FEATURE_SIMD32 1
#define __ARM_FEATURE_UNALIGNED 1
#define __ARM_FP 12
#define __ARM_NEON_FP 4
#define __ARM_PCS_VFP 1
#define __ARM_SIZEOF_MINIMAL_ENUM 4
#define __ARM_SIZEOF_WCHAR_T 32
#define __FLOAT_WORD_ORDER __BYTE_ORDER
#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __SIZEOF_FLOAT__ 4
#define __arm__ 1
#define __stub_chflags
#define __stub_fchflags


Reply to: