Allow frag address wrapping in absolute section

Message ID ZAnOJ6t4+ezsABPt@squeak.grove.modra.org
State Repeat Merge
Headers
Series Allow frag address wrapping in absolute section |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Alan Modra March 9, 2023, 12:16 p.m. UTC
  This:
	 .struct -1
	x:
	 .fill 1
	y:
results in an internal error in frag_new due to abs_section_offset
wrapping from -1 to 0.  Frags in the absolute section don't do much so
I think we can allow the address wrap.

	* frags.c (frag_new): Allow address wrap in absolute section.
  

Patch

diff --git a/gas/frags.c b/gas/frags.c
index 2a2806da835..016d857ded6 100644
--- a/gas/frags.c
+++ b/gas/frags.c
@@ -166,7 +166,8 @@  frag_new (size_t old_frags_var_max_size
 
   /* Fix up old frag's fr_fix.  */
   frag_now->fr_fix = frag_now_fix_octets ();
-  gas_assert (frag_now->fr_fix >= old_frags_var_max_size);
+  gas_assert (frag_now->fr_fix >= old_frags_var_max_size
+	      || now_seg == absolute_section);
   frag_now->fr_fix -= old_frags_var_max_size;
   /* Make sure its type is valid.  */
   gas_assert (frag_now->fr_type != 0);