aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-02-23 10:10:02 +0000
committerNathan Sidwell <nathan@codesourcery.com>2004-02-23 10:10:02 +0000
commit1b493742004fd74ebe85a9f93bf28aebe8e858c8 (patch)
treef1826439768b794f38f3eaa09a25daafcb5a0634 /ld/ldlang.c
parent33ed461333b1726596e446392627ad2a93b6a62c (diff)
downloadbinutils-1b493742004fd74ebe85a9f93bf28aebe8e858c8.zip
binutils-1b493742004fd74ebe85a9f93bf28aebe8e858c8.tar.gz
binutils-1b493742004fd74ebe85a9f93bf28aebe8e858c8.tar.bz2
* ldlang.h (struct lang_output_section_state): Change processed
field's type. * ldexp.c (check, invalid): Remove. (fold_name): Move valid_p assignments. Create undefined symbol when needed. Directly exampine section's processd flag. * ldlang.c (lang_output_section_statement_lookup): Adjust processed field init. (lang_size_sections_1): Allow LOADADDR when determining section's VMA. Adjust error message. Fold data statement's expr. (lang_size_sections): Correctly increment lang_statement_iteration. * ld-scripts/provide.exp: New. * ld-scripts/provide-{1,2,3}.{s,t,d}.exp: New. * ldexp.c (fold_tree): Follow indirect symbols.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index a25f5f3..0f5c630 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -622,7 +622,7 @@ lang_output_section_statement_lookup (const char *const name)
lookup->next = NULL;
lookup->bfd_section = NULL;
- lookup->processed = FALSE;
+ lookup->processed = 0;
lookup->sectype = normal_section;
lookup->addr_tree = NULL;
lang_list_init (&lookup->children);
@@ -2984,12 +2984,15 @@ lang_size_sections_1
{
etree_value_type r;
+ os->processed = -1;
r = exp_fold_tree (os->addr_tree,
abs_output_section,
lang_allocating_phase_enum,
dot, &dot);
+ os->processed = 0;
+
if (!r.valid_p)
- einfo (_("%F%S: non constant address expression for section %s\n"),
+ einfo (_("%F%S: non constant or forward reference address expression for section %s\n"),
os->name);
dot = r.value + r.section->bfd_section->vma;
@@ -3027,7 +3030,7 @@ lang_size_sections_1
= TO_SIZE (after - os->bfd_section->vma);
dot = os->bfd_section->vma + TO_ADDR (os->bfd_section->_raw_size);
- os->processed = TRUE;
+ os->processed = 1;
if (os->update_dot_tree != 0)
exp_fold_tree (os->update_dot_tree, abs_output_section,
@@ -3089,6 +3092,11 @@ lang_size_sections_1
s->data_statement.output_section =
output_section_statement->bfd_section;
+ /* We might refer to provided symbols in the expression, and
+ need to mark them as needed. */
+ exp_fold_tree (s->data_statement.exp, abs_output_section,
+ lang_allocating_phase_enum, dot, &dot);
+
switch (s->data_statement.type)
{
default:
@@ -3294,6 +3302,7 @@ lang_size_sections
&& first + last <= exp_data_seg.pagesize)
{
exp_data_seg.phase = exp_dataseg_adjust;
+ lang_statement_iteration++;
result = lang_size_sections_1 (s, output_section_statement, prev,
fill, dot, relax, check_regions);
}