conflicting switches: -march=armv7-a -mcpu=cortex-a8

Bug #662720 reported by Jussi Hakala
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Low
Unassigned

Bug Description

Is combination of -march=armv7-a -mcpu=cortex-a8 or is this an issue with the compiler? Trying mtune instead of mcpu seems to work okay. Didn't find anything related to this from gcc's 4.5 release pages.

$ echo | arm-linux-gnueabi-gcc -march=armv7-a -mcpu=cortex-a8 -xc -
<stdin>:1:0: warning: switch -mcpu=cortex-a8 conflicts with -march= switch
/usr/lib/gcc/arm-linux-gnueabi/4.5.1/../../../../arm-linux-gnueabi/lib/crt1.o: In function `_start':
(.text+0x34): undefined reference to `main'
collect2: ld returned 1 exit status

$ arm-linux-gnueabi-gcc --version
arm-linux-gnueabi-gcc (Ubuntu/Linaro 4.5.1-7ubuntu1) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"

Revision history for this message
Julian Brown (julian-codesourcery) wrote :

Specifying both -march= and -mcpu= is redundant, and may not in fact have done what you expected in previous compiler versions (maybe even depending on the order in which the arguments were given). The -march switch selects a "generic" ARMv7-A CPU, and -mcpu selects specifically a Cortex-A8 CPU with tuning specific for that core.

Either use "-march=armv7-a -mtune=cortex-a8", or just use "-mcpu=cortex-a8".

Revision history for this message
Julian Brown (julian-codesourcery) wrote :
Revision history for this message
Jussi Hakala (jussi-hakala) wrote :

The gcc man page suggests that -march can be used "in conjunction with or instead of the -mcpu= option".

And quoting the behavior in the patch, when both -march and -mcpu is set, given the consistency, they are treated equal with only -mcpu set, which makes sense. However that particular patch doesn't seem to be applied in Linaro-4.5-2010.10-0.

Currently switched to -mtune instead of -mcpu, but still feeling a bit confused.

Michael Hope (michaelh1)
Changed in gcc-linaro:
importance: Undecided → Low
Revision history for this message
Michael Hope (michaelh1) wrote :

Fixed in Linaro GCC 2010.11.

Changed in gcc-linaro:
status: New → Fix Released
milestone: none → 4.5-2010.11-0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.