public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld failure introduced with pr797 patch
@ 2005-06-02 12:07 Alan Modra
  2005-06-02 14:59 ` H. J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2005-06-02 12:07 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils

Hi HJ,
  I believe your fix for PR797 is to blame for a ld problem which can be
demonstrated by building binutils for tic30-unknown-coff and running the
ld testsuite.  I see "+FAIL: check sections 1".  The linker script has

.const :
{
        *(.const)
        __etext = . ;
} > rom
.mdata : AT( ADDR(.const) + SIZEOF(.const) )
{
        __data = . ;
        *(.data);
        __edata = . ;
} > ram

.const is empty, so fails to have its output_section_statement fully
initialized.  This results in "nonconstant expression for load base".

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ld failure introduced with pr797 patch
  2005-06-02 12:07 ld failure introduced with pr797 patch Alan Modra
@ 2005-06-02 14:59 ` H. J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H. J. Lu @ 2005-06-02 14:59 UTC (permalink / raw)
  To: binutils

On Thu, Jun 02, 2005 at 09:37:20PM +0930, Alan Modra wrote:
> Hi HJ,
>   I believe your fix for PR797 is to blame for a ld problem which can be
> demonstrated by building binutils for tic30-unknown-coff and running the
> ld testsuite.  I see "+FAIL: check sections 1".  The linker script has
> 
> .const :
> {
>         *(.const)
>         __etext = . ;
> } > rom
> .mdata : AT( ADDR(.const) + SIZEOF(.const) )
> {
>         __data = . ;
>         *(.data);
>         __edata = . ;
> } > ram
> 
> .const is empty, so fails to have its output_section_statement fully
> initialized.  This results in "nonconstant expression for load base".
> 

I missed load base. I am testing this patch.



H.J.
---
2005-06-02  H.J. Lu  <hongjiu.lu@intel.com>

	* ldexp.c (exp_mark_used_section): Call fold_binary on
	etree_binary.

	* ldlang.c (lang_mark_used_section_1): Handle load base.

--- ld/ldexp.c.base	2005-06-02 06:33:30.000000000 -0700
+++ ld/ldexp.c	2005-06-02 07:53:53.000000000 -0700
@@ -1237,6 +1237,8 @@ align_n (bfd_vma value, bfd_vma align)
 void
 exp_mark_used_section (etree_type *tree, asection *current_section)
 {
+  bfd_vma dot = 0;
+
   switch (tree->type.node_class)
     {
     case etree_value:
@@ -1252,6 +1254,8 @@ exp_mark_used_section (etree_type *tree,
       break;
 
     case etree_binary:
+      fold_binary (tree, current_section, lang_allocating_phase_enum,
+		   dot, &dot, TRUE);
       break;
 
     case etree_trinary:
@@ -1263,7 +1267,6 @@ exp_mark_used_section (etree_type *tree,
       if (tree->assign.dst[0] != '.' || tree->assign.dst[1] != 0)
 	{
 	  etree_value_type result;
-	  bfd_vma dot = 0;
 
 	  result = exp_fold_tree_1 (tree->assign.src,
 				    current_section,
--- ld/ldlang.c.base	2005-06-02 06:33:30.000000000 -0700
+++ ld/ldlang.c	2005-06-02 07:48:22.000000000 -0700
@@ -3065,7 +3065,12 @@ lang_mark_used_section_1
 
 	    os = &(s->output_section_statement);
 	    if (os->bfd_section != NULL)
-	      lang_mark_used_section_1 (os->children.head, os);
+	      {
+		lang_mark_used_section_1 (os->children.head, os);
+		if (os->load_base)
+		  exp_mark_used_section (os->load_base,
+					 bfd_abs_section_ptr);
+	      }
 	  }
 	  break;
 	case lang_wild_statement_enum:

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-06-02 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-02 12:07 ld failure introduced with pr797 patch Alan Modra
2005-06-02 14:59 ` H. J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).