From c39c821c1da3e8a64eff5984a39e104eb798e8b8 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Fri, 29 May 2020 16:04:50 +0100 Subject: gas: Fix checking for backwards .org with negative offset This patch fixes internal errors in (at least) arm and aarch64 GAS when assembling code that attempts a negative .org. The bug appears to be a regression introduced in binutils-2.29 by commit 9875b36538d. * write.c (relax_segment): Fix handling of negative offset when relaxing an rs_org frag. * testsuite/gas/aarch64/org-neg.d: New test. * testsuite/gas/aarch64/org-neg.l: Error output for test. * testsuite/gas/aarch64/org-neg.s: Input for test. * testsuite/gas/arm/org-neg.d: New test. * testsuite/gas/arm/org-neg.l: Error output for test. * testsuite/gas/arm/org-neg.s: Input for test. --- gas/testsuite/gas/aarch64/org-neg.d | 3 +++ gas/testsuite/gas/aarch64/org-neg.l | 2 ++ gas/testsuite/gas/aarch64/org-neg.s | 2 ++ gas/testsuite/gas/arm/org-neg.d | 3 +++ gas/testsuite/gas/arm/org-neg.l | 2 ++ gas/testsuite/gas/arm/org-neg.s | 2 ++ 6 files changed, 14 insertions(+) create mode 100644 gas/testsuite/gas/aarch64/org-neg.d create mode 100644 gas/testsuite/gas/aarch64/org-neg.l create mode 100644 gas/testsuite/gas/aarch64/org-neg.s create mode 100644 gas/testsuite/gas/arm/org-neg.d create mode 100644 gas/testsuite/gas/arm/org-neg.l create mode 100644 gas/testsuite/gas/arm/org-neg.s (limited to 'gas/testsuite') diff --git a/gas/testsuite/gas/aarch64/org-neg.d b/gas/testsuite/gas/aarch64/org-neg.d new file mode 100644 index 0000000..83e6af6 --- /dev/null +++ b/gas/testsuite/gas/aarch64/org-neg.d @@ -0,0 +1,3 @@ +#name: negative org should not cause internal error +#source: org-neg.s +#error_output: org-neg.l diff --git a/gas/testsuite/gas/aarch64/org-neg.l b/gas/testsuite/gas/aarch64/org-neg.l new file mode 100644 index 0000000..f8414ad --- /dev/null +++ b/gas/testsuite/gas/aarch64/org-neg.l @@ -0,0 +1,2 @@ +[^:]*: Assembler messages: +.*: Error: attempt to move .org backwards diff --git a/gas/testsuite/gas/aarch64/org-neg.s b/gas/testsuite/gas/aarch64/org-neg.s new file mode 100644 index 0000000..403e70d --- /dev/null +++ b/gas/testsuite/gas/aarch64/org-neg.s @@ -0,0 +1,2 @@ +.=-1 +ret diff --git a/gas/testsuite/gas/arm/org-neg.d b/gas/testsuite/gas/arm/org-neg.d new file mode 100644 index 0000000..83e6af6 --- /dev/null +++ b/gas/testsuite/gas/arm/org-neg.d @@ -0,0 +1,3 @@ +#name: negative org should not cause internal error +#source: org-neg.s +#error_output: org-neg.l diff --git a/gas/testsuite/gas/arm/org-neg.l b/gas/testsuite/gas/arm/org-neg.l new file mode 100644 index 0000000..f8414ad --- /dev/null +++ b/gas/testsuite/gas/arm/org-neg.l @@ -0,0 +1,2 @@ +[^:]*: Assembler messages: +.*: Error: attempt to move .org backwards diff --git a/gas/testsuite/gas/arm/org-neg.s b/gas/testsuite/gas/arm/org-neg.s new file mode 100644 index 0000000..f60486e --- /dev/null +++ b/gas/testsuite/gas/arm/org-neg.s @@ -0,0 +1,2 @@ +.=-1 +nop -- cgit v1.1