Dealing with multiple gas versions

Ryan Mansfield rmansfield@qnx.com
Tue Oct 11 19:29:00 GMT 2011


Has there been any discussion of introducing a mechanism that allows 
users to write code that is for specific version(s) of gas?  Not 
frequently but occasionally there are changes between versions where it 
would be handy to write conditional code that could be assembled by 
multiple versions of gas.

A recent example would be the change to separate the security extensions 
from the base ARM v7-A architecture. E.g. prior to 2.21 gas would accept 
the smc instruction if the .arch armv7-a was used or -march=armv7-a was 
specified on the command line. Now it requires either +sec command line 
option, or the .arch_extension sec inline. Unfortunately the 
-march=armv7-a+sec option does not override the .arch option set by gcc, 
so compiling code with inline asm containing the sec extensions with 
-march=armv7-a -Wa,-march=armv7-a+sec is not possible unless the 
.arch_extension sec is used. As .arch_extension is a recent addition as 
well, it means the code needs to be written for the latest version of gas.

When we encounter a situation like this we usually end up encoding the 
instruction to avoid the problem of having to target multiple versions 
but it's far from ideal. If there was something like a builtin 
expression for the version (e.g. something similar to __GNUC__  and 
__GNUC_MINOR__) we could trigger off, it would be useful.

I apologize if this issue has been previously discussed and shot down 
but I didn't find any particularly relevant in a quick search of the 
mailing list.

Regards,

Ryan Mansfield



More information about the Binutils mailing list