[PATCH v1] LoongArch: Warning about incorrect 3rd argument of .align

Lulu Cai cailulu@loongson.cn
Mon May 19 04:01:42 GMT 2025


344b1e0f5f7 Introduced range-check 3rd argument of .align, incorrect
value are not converted silently. added warning message to fix regression.
---
 gas/testsuite/gas/loongarch/relax_align.d | 6 ++++++
 gas/testsuite/gas/loongarch/relax_align.l | 3 +++
 gas/testsuite/gas/loongarch/relax_align.s | 6 ++++--
 3 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 gas/testsuite/gas/loongarch/relax_align.l

diff --git a/gas/testsuite/gas/loongarch/relax_align.d b/gas/testsuite/gas/loongarch/relax_align.d
index fc1fd032611..a92df37c636 100644
--- a/gas/testsuite/gas/loongarch/relax_align.d
+++ b/gas/testsuite/gas/loongarch/relax_align.d
@@ -1,6 +1,7 @@
 #as:
 #objdump: -dr
 #skip: loongarch32-*-*
+#warning_output: relax_align.l
 
 .*:[    ]+file format .*
 
@@ -44,3 +45,8 @@ Disassembly of section .text:
 [ 	]+68:[ 	]+03400000[ 	]+nop
 [ 	]+6c:[ 	]+03400000[ 	]+nop
 [ 	]+70:[ 	]+4c000020[ 	]+ret
+[ 	]+74:[ 	]+03400000[ 	]+nop
+[ 	]+74: R_LARCH_ALIGN[ 	]+\*ABS\*\+0xc
+[ 	]+78:[ 	]+03400000[ 	]+nop
+[ 	]+7c:[ 	]+03400000[ 	]+nop
+[ 	]+80:[ 	]+4c000020[ 	]+ret
diff --git a/gas/testsuite/gas/loongarch/relax_align.l b/gas/testsuite/gas/loongarch/relax_align.l
new file mode 100644
index 00000000000..e33fa86f7f3
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/relax_align.l
@@ -0,0 +1,3 @@
+.*Assembler messages:
+.*: Warning: ignoring out of range alignment maximum
+.*: Warning: ignoring out of range alignment maximum
diff --git a/gas/testsuite/gas/loongarch/relax_align.s b/gas/testsuite/gas/loongarch/relax_align.s
index 4f4867fb209..079f549895c 100644
--- a/gas/testsuite/gas/loongarch/relax_align.s
+++ b/gas/testsuite/gas/loongarch/relax_align.s
@@ -1,5 +1,4 @@
-# If max < -0x80000000, max becomes a positive number because type conversion
-# (bfd_signed_vma -> unsigned int).
+# Range of max: 0<= max <= 0xffffffff
   .text
 .L1:
   ret
@@ -13,6 +12,9 @@
   ret
   .align 4, , 12
   ret
+  .align 4, , 0xffffffff
+  ret
+# ignore out of range alignment maxumum
   .align 4, , -1
   ret
   .align 4, , -0x80000000
-- 
2.34.1



More information about the Binutils mailing list