The following table lists the alignment and behavior values for -xmemalign
Table A–39 The -xmemalign Alignment and Behavior Values
a |
b | ||
---|---|---|---|
1 |
Assume at most 1 byte alignment. |
i |
Interpret access and continue execution. |
2 |
Assume at most 2 byte alignment. |
s |
Raise signal SIGBUS. |
4 |
Assume at most 4 byte alignment. |
f |
For variants of -xarch=v9 only: Raise signal SIGBUS for alignments less or equal to 4,otherwise interpret access and continue execution. For all other -xarch values, the f flag is equivalent to i. |
8 |
Assume at most 8 byte alignment. | ||
16 |
Assume at most 16 byte alignment |
You must specify -xmemalign whenever you want to link to an object file that was compiled with the value of b set to either i or f. For a complete list of all compiler options that must be specified at both compile time and at link time, see 3.3.3 Compile-Time and Link-Time Options.
The following default values only apply when no -xmemalign option is present:
-xmemalgin=8i for all v8 architectures.
-xmemalign=8s for all v9 architectures.
Here is the default when the -xmemalign option is present but no value is given:
-xmemalign=1i for all -xarch values.
The following table shows how you can use -xmemalign to handle different alignment situations.
Table A–40 Examples of -xmemalign
Command |
Situation |
---|---|
-xmemalign=1s |
There are many misaligned accesses so trap handling is too slow. |
-xmemalign=8i |
There are occasional, intentional, misaligned accesses in code that is otherwise correct. |
-xmemalign=8s |
There should be no misaligned accesses in the program. |
-xmemalin=2s |
You want to check for possible odd-byte accesses. |
-xmemalign=2i |
You want to check for possible odd-byte access and you want the program to work. |