[v3,11/13] RISC-V/gas: warn about non-power-of-2 stack-align attribute
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
Only power-of-2 values are sensible for alignment.
Reviewed-by: Jiawei <jiawei@iscas.ac.cn>
---
Should we reject changing an already set non-zero value, like
riscv_merge_attributes() does?
Should we permit 0 as an explicit indication of "attribute not set"?
---
v2: New.
@@ -5902,6 +5902,13 @@ s_riscv_attribute (int ignored ATTRIBUTE
"any instructions"));
break;
+ case Tag_RISCV_stack_align:
+ if (!attr[Tag_RISCV_stack_align].i
+ || (attr[Tag_RISCV_stack_align].i &
+ (attr[Tag_RISCV_stack_align].i - 1)))
+ as_warn (_("`stack_align' attribute with non-power-of-2 value"));
+ break;
+
case Tag_RISCV_unaligned_access:
if (attr[Tag_RISCV_unaligned_access].i > 1)
as_warn (_("`unaligned_access' attribute with non-boolean value"));
@@ -4,4 +4,5 @@
Attribute Section: riscv
File Attributes
+ Tag_RISCV_stack_align: 65536-bytes
Tag_RISCV_arch: [a-zA-Z0-9_\"].*
@@ -1,2 +1,4 @@
.*: Assembler messages:
.*:2: Warning: `unaligned_access' attribute with non-boolean value
+.*:5: Warning: `stack_align' attribute with non-power-of-2 value
+.*:6: Warning: `stack_align' attribute with non-power-of-2 value
@@ -1,3 +1,7 @@
.attribute unaligned_access, 1
.attribute unaligned_access, 0x1234
.attribute unaligned_access, 0
+
+ .attribute stack_align, 0
+ .attribute stack_align, 0x4444
+ .attribute stack_align, 0x10000