diff options
author | Alan Modra <amodra@gmail.com> | 2010-08-19 05:51:50 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2010-08-19 05:51:50 +0000 |
commit | 7542af2ae81ecd2b97dcaa7c66d0b0d85e359d88 (patch) | |
tree | 624e07d23b75bdbfe2d36ae5fb676dbedfa2724d /ld/ldlang.c | |
parent | 56f75c03fc85f2ce65c85793eba9a7cef1666f3c (diff) | |
download | fsf-binutils-gdb-7542af2ae81ecd2b97dcaa7c66d0b0d85e359d88.zip fsf-binutils-gdb-7542af2ae81ecd2b97dcaa7c66d0b0d85e359d88.tar.gz fsf-binutils-gdb-7542af2ae81ecd2b97dcaa7c66d0b0d85e359d88.tar.bz2 |
binutils/
* NEWS: Mention change in linker script expression evaluation.
ld/
* ld.texinfo (Expression Section): Detail expression evaluation.
(Builtin Functions <ADDR>): Correct.
(Builtin Functions <LOADADDR>): Don't mention LOADADDR normally
the same as ADDR.
(Builtin Functions <SEGMENT_START>): Typo fix.
* ldexp.c (new_number): New function.
(make_abs, exp_get_abs_int): Cope with NULL expld.result.section.
(fold_unary <'~', '!', '-'>): Don't make_abs.
(fold_binary): Simplify result section logic. Return NULL section
for logical ops.
(fold_binary <SEGMENT_START>): Use new_rel_from_abs to set value to
a consistent result.
(fold_name <SIZEOF_HEADERS>): Return new_number, not new_abs.
(fold_name <DEFINED, SIZEOF, ALIGNOF, LENGTH, CONSTANT>): Likewise.
(fold_name <NAME>): No need to handle absolute symbols differently
from relative ones.
(fold_name <ORIGIN>): Don't return valid result when
lang_first_phase_enum. Return new_rel_from_abs, not new_abs.
(exp_fold_tree_1 <etree_value>): Return new_number, not new_rel.
(exp_fold_tree_1): Ajust for NULL expld.result.section. When assigning
a plain number to dot, assume the value is relative to expld.section.
Make terms not in an output section, absolute.
* ldlang.c (print_assignment): Fix style nit.
(lang_size_sections_1): Cope with NULL expld.result.section.
(lang_do_assignments_1): Likewise.
ld/testsuite/
* ld-scripts/memory.t: Remove ORIGIN fudge.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 41ab2ee..2b9971a 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3916,7 +3916,7 @@ print_assignment (lang_assignment_statement_type *assignment, { value = expld.result.value; - if (expld.result.section) + if (expld.result.section != NULL) value += expld.result.section->vma; minfo ("0x%V", value); @@ -3933,7 +3933,7 @@ print_assignment (lang_assignment_statement_type *assignment, { value = h->u.def.value; - if (expld.result.section) + if (expld.result.section != NULL) value += expld.result.section->vma; minfo ("[0x%V]", value); @@ -4718,7 +4718,11 @@ lang_size_sections_1 exp_fold_tree (os->addr_tree, bfd_abs_section_ptr, &dot); if (expld.result.valid_p) - dot = expld.result.value + expld.result.section->vma; + { + dot = expld.result.value; + if (expld.result.section != NULL) + dot += expld.result.section->vma; + } else if (expld.phase != lang_mark_phase_enum) einfo (_("%F%S: non constant or forward reference" " address expression for section %s\n"), @@ -5397,8 +5401,11 @@ lang_do_assignments_1 (lang_statement_union_type *s, case lang_data_statement_enum: exp_fold_tree (s->data_statement.exp, bfd_abs_section_ptr, &dot); if (expld.result.valid_p) - s->data_statement.value = (expld.result.value - + expld.result.section->vma); + { + s->data_statement.value = expld.result.value; + if (expld.result.section != NULL) + s->data_statement.value += expld.result.section->vma; + } else einfo (_("%F%P: invalid data statement\n")); { |