* ldexp.c (fold_name <SIZEOF>): Return 0 for non-existent section.

(exp_fold_tree_1): Print assert message only in final stage of
	linking.  Trigger assertion failure if expression cannot be
	evaluated.
This commit is contained in:
Alan Modra
2005-09-07 06:27:36 +00:00
parent 12b9ff6c8b
commit 5397b1fec1
2 changed files with 12 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2005-09-07 Alan Modra <amodra@bigpond.net.au>
* ldexp.c (fold_name <SIZEOF>): Return 0 for non-existent section.
(exp_fold_tree_1): Print assert message only in final stage of
linking. Trigger assertion failure if expression cannot be
evaluated.
2005-09-06 H.J. Lu <hongjiu.lu@intel.com> 2005-09-06 H.J. Lu <hongjiu.lu@intel.com>
PR ld/1263 PR ld/1263

View File

@ -590,7 +590,9 @@ fold_name (etree_type *tree)
lang_output_section_statement_type *os; lang_output_section_statement_type *os;
os = lang_output_section_find (tree->name.name); os = lang_output_section_find (tree->name.name);
if (os != NULL && os->processed > 0) if (os == NULL)
new_abs (0);
else if (os->processed > 0)
new_abs (os->bfd_section->size / opb); new_abs (os->bfd_section->size / opb);
} }
break; break;
@ -655,15 +657,8 @@ exp_fold_tree_1 (etree_type *tree)
case etree_assert: case etree_assert:
exp_fold_tree_1 (tree->assert_s.child); exp_fold_tree_1 (tree->assert_s.child);
if (expld.result.valid_p) if (expld.phase == lang_final_phase_enum && !expld.result.value)
{
if (expld.phase == lang_mark_phase_enum)
/* We don't care if assert fails or not when we are just
marking if a section is used or not. */
expld.result.value = 1;
else if (!expld.result.value)
einfo ("%X%P: %s\n", tree->assert_s.message); einfo ("%X%P: %s\n", tree->assert_s.message);
}
break; break;
case etree_unary: case etree_unary: