Go to main content
Oracle® Developer Studio 12.5: GCC Compatibility Guide

Exit Print View

Updated: June 2017
 
 

Assembler Compatibility

The SPARC and x86 assemblers act very differently in terms of machine code, and in terms of pseudo-ops. Therefore, the compatibility issues between the GNU assembler (gas) and the Oracle Developer Studio and Oracle Solaris assemblers will be different on different platforms.

The same source code is used to produce the assemblers that ship with Oracle Solaris (SPARC and x86) and the assemblers that ship with Oracle Developer Studio (SPARC and x86), so you should expect similar compatibility issues when dealing with either the Oracle Developer Studio or Oracle Solaris assemblers.

x86 Assembler

Note the following x86 assembler issues when switching between the Oracle Developer Studio and Oracle Solaris assemblers and the GCC assembler.

  • gcc can often infer opcode suffixes, whereas Oracle Developer Studio insists they be explicitly provided. Being more explicit satisfies both. For example, change "mov" to "movw" and "shr" to "shrw".

  • '#' introduces comments in gcc assembler files, but has historically been expected to introduce preprocessing directives in Oracle Developer Studio assembler files.

For more information, see x86 Assembly Language Reference Manual (https://docs.oracle.com/cd/E53394_01/html/E54851/index.html)

SPARC Assembler

The official SPARC assembly format is defined by The SPARC Assembly Reference Language Manual (http://docs.oracle.com/cd/E53394_01/html/E54833/index.html).

Assembler Directives Related to ELF Sections

The .section directive takes different arguments in the SPARC assembler. The attribute flags are defined using explicit tokens instead of a character string as in the GNU assembler (gas). For example, with gas, a .section directive would appear as follows:

.section .init,"aw"

When using the Oracle Developer Studio or Oracle Solaris SPARC assembler the directive would appear as follows:

.section ".init",#alloc,#write

Note -  The SPARC assembler supports the.pushsection and .popsection directives, but not .previous directive.

Pseudo-Op Issues

The .symver pesudo-op is supported in the SPARC assembler for GNU compatibility.

The .uleb128 and .sleb128 pseudo-ops are supported.

SPARC Assembler Resources

For further information, see the following resources: