Another ld script backtrack

Message ID YRyHxX3yguuIl/ow@squeak.grove.modra.org
State New
Headers show
Series
  • Another ld script backtrack
Related show

Commit Message

Alan Modra via Binutils Aug. 18, 2021, 4:08 a.m.
Another case where an expression might be following by a NAME.

	* ldgram.y (length_spec): Throw away look-ahead NAME.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/ldgram.y b/ld/ldgram.y
index a0c881e9a73..c8396bbfd5b 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -809,6 +809,11 @@  origin_spec:
 length_spec:
 	     LENGTH '=' mustbe_exp
 		{
+		  if (yychar == NAME)
+		    {
+		      yyclearin;
+		      ldlex_backup ();
+		    }
 		  region->length_exp = $3;
 		}
 	;