dk13
dk13

Reputation: 1501

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

I'm have created a c++ app and want to compile it for debian jessie 8.0 armbian target of a cubietruck board (ARM® Cortex™-A7 Dual-Core). The - cat /proc/cpuinfo gives :

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

and the - dpkg --print-architecture

armhf

I have concluded that the related arm gcc option for cross compilation I need are:

--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 

If I want to build the same source directly on board is the option -march=native (if it is supported) sufficient or do I need any of the above flags as well?

Upvotes: 0

Views: 1064

Answers (1)

Capybara
Capybara

Reputation: 1473

To find what flags -march=native activates use gcc -march=native -Q --help=target.

This is the output in my board (Pine64 - Cortex A53 with Linux 64 bits):

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]

Upvotes: 1

Related Questions