Skip to content

Commit 0ea1e16

Browse files
authored
Merge pull request #49 from riscv-non-isa/kitoc/opt-strict-align
Add document for -mstrict-align and -mno-strict-align
2 parents 05f991d + 79008be commit 0ea1e16

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

README.mkd

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,34 @@ specification, and in the draft [CORE-V Builtin
398398
Function](https://github.com/openhwgroup/core-v-sw/blob/master/specifications/corev-builtin-spec.md)
399399
specification.
400400

401+
## Common Toolchain Command Line Options
402+
403+
This section lists common RISC-V specific toolchain command line options.
404+
405+
### `-mstrict-align`/`-mno-strict-align`
406+
Indicates that the compiler should not assume that unaligned scalar and
407+
unaligned vector memory references are handled by the system.
408+
409+
`-mstrict-align`: The compiler disallows misaligned memory access.
410+
`-mno-strict-align`: The compiler allows misaligned memory access.
411+
412+
The compiler's behavior will follow this order of precedence:
413+
414+
- Use the setting from `-mstrict-align` / `-mno-strict-align` if either option
415+
is given, taking the last one specified.
416+
- Use the setting from `-mtune` if `-mstrict-align` / `-mno-strict-align` is not given.
417+
- Use the setting from `-mcpu` if neither of the above options is given.
418+
- Use the compiler's default setting if none of the above options are provided.
419+
420+
NOTE: Non-strict also known as unaligned access or misaligned access
421+
NOTE: The compiler may generate misaligned access if the program violates the
422+
alignment assumption.
423+
NOTE: This option does not affect inline assembly.
424+
401425
## TODO
402426

403-
* `-mdiv`, `-mno-div`, `-mfdiv`, `-mno-fdiv`, `-msave-restore`,
404-
`-mno-save-restore`, `-mstrict-align`, `-mno-strict-align`,
405-
`-mexplicit-relocs`, `-mno-explicit-relocs`
427+
* `-mdiv`, `-mno-div`, `-mfdiv`, `-mno-fdiv`, `-msave-restore`,
428+
`-mno-save-restore`, `-mexplicit-relocs`, `-mno-explicit-relocs`
406429

407430
## Appendix: Exposing a vendor-specific extension across the toolchain
408431

0 commit comments

Comments
 (0)