This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

linker script ASSERT


Hi,
the linker's documentation implies that one can use ASSERT (expr, msg)
as a command, but the grammar only allows it in an expression.  This
patch makes it usable as a command.  Also, it wasn't being recognised
by exp_init_os, thus assertions about otherwise uncreated sections
would crash.

ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2004-02-17  Nathan Sidwell  <nathan@codesourcery.com>

	* ldgram.y (statement_anywhere): Add assert rule.
	* ldlang.c (exp_init_os): Add assert case.

Index: ldgram.y
===================================================================
RCS file: /cvs/src/src/ld/ldgram.y,v
retrieving revision 1.30
diff -c -3 -p -r1.30 ldgram.y
*** ldgram.y	3 Jan 2004 12:39:07 -0000	1.30
--- ldgram.y	17 Feb 2004 16:56:53 -0000
*************** statement_anywhere:
*** 386,391 ****
--- 386,394 ----
  		ENTRY '(' NAME ')'
  		{ lang_add_entry ($3, FALSE); }
  	|	assignment end
+ 	|	ASSERT_K  {ldlex_expression ();} '(' exp ',' NAME ')'
+ 		{ ldlex_popstate ();
+ 		  lang_add_assignment (exp_assert ($4, $6)); }
  	;
  
  /* The '*' and '?' cases are there because the lexer returns them as
Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.135
diff -c -3 -p -r1.135 ldlang.c
*** ldlang.c	13 Jan 2004 11:10:53 -0000	1.135
--- ldlang.c	17 Feb 2004 16:57:03 -0000
*************** exp_init_os (etree_type *exp)
*** 775,780 ****
--- 775,784 ----
        exp_init_os (exp->trinary.rhs);
        break;
  
+     case etree_assert:
+       exp_init_os (exp->assert_s.child);
+       break;
+       
      case etree_unary:
        exp_init_os (exp->unary.child);
        break;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]