交叉编译和直接在目标上编译时所需的 GCC arm 选项之间的区别?

Difference between GCC arm options necessary when cross-compiling and when compiling directly on target?

我已经创建了一个 c++ 应用程序并想为 cubietruck 板(ARM® Cortex™-A7 双核)的 debian jessie 8.0 armbian 目标编译它。 - cat /proc/cpuinfo 给出:

Processor       : ARMv7 Processor rev 4 (v7l)
processor       : 0
BogoMIPS        : 956.30

processor       : 1
BogoMIPS        : 959.75

Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 4

Hardware        : sun7i
Revision        : 0000
Serial          : 1651668805c0e142
Chipid          : 16516688-80515475-52574848-05c0e142

- dpkg --print-architecture

armhf

我得出结论,我需要的交叉编译的相关arm gcc选项是:

--with-abi=aapcs-linux  (-mabi)
--with-cpu=cortex-a7  (-mcpu)
--with-tune=cortex-a7 (-mtune)
--with-mode=arm/thumb  (-marm  -mthumb)
--with-fpu=neon-vfpv4  (-mfpu)
--with-float=hard 

如果我想直接在板上构建相同的源,选项 -march=native(如果支持)是否足够,或者我还需要上述任何标志吗?

要查找 -march=native 激活的标志,请使用 gcc -march=native -Q --help=target.

这是我的板子(Pine64 - Cortex A53 Linux 64 位)的输出:

debian@pine64:~$ gcc -march=native -Q --help=target
The following options are target specific:
    -mabi=ABI                           lp64
    -march=ARCH                         native
    -mbig-endian                        [disabled]
    -mbionic                            [disabled]
    -mcmodel=                           small
    -mcpu=CPU                           
    -mfix-cortex-a53-835769             [enabled]
    -mgeneral-regs-only                 [disabled]
    -mglibc                             [enabled]
    -mlittle-endian                     [enabled]
    -mlra                               [enabled]
    -momit-leaf-frame-pointer           [enabled]
    -mstrict-align                      [disabled]
    -mtls-dialect=                      desc
    -mtune=CPU                          
    -muclibc                            [disabled]
    ....
    [Omitted output]