From abf4be64df114dbca199fc2c2fbf52fa17492649 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 1 Oct 2010 08:15:42 +0000 Subject: [PATCH] PR ld/12066 * ldexp.c (fold_name): Treat absolute symbols as plain numbers. * ld.texinfo (Expression Section): Don't say absolute symbols are addresses. --- ld/ChangeLog | 7 +++++++ ld/ld.texinfo | 10 +++++----- ld/ldexp.c | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 14a7f7c7ae5..4f64be44f73 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2010-10-01 Alan Modra + + PR ld/12066 + * ldexp.c (fold_name): Treat absolute symbols as plain numbers. + * ld.texinfo (Expression Section): Don't say absolute symbols + are addresses. + 2010-09-29 Alan Modra * ldlang.c (lang_place_orphans): Zero vma when relocatable or non-load diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 28c59f2a79f..206068a62f5 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -5453,11 +5453,11 @@ value of a section relative symbol. On the other hand, an absolute symbol will retain the same value throughout any further link operations. -Some terms in linker expressions are addresses. This is true of all -symbols and for builtin functions that return an address, such as -@code{ADDR}, @code{LOADADDR}, @code{ORIGIN} and @code{SEGMENT_START}. -Other terms are simply numbers, or are builtin functions that return a -non-address value, such as @code{LENGTH}. +Some terms in linker expressions are addresses. This is true of +section relative symbols and for builtin functions that return an +address, such as @code{ADDR}, @code{LOADADDR}, @code{ORIGIN} and +@code{SEGMENT_START}. Other terms are simply numbers, or are builtin +functions that return a non-address value, such as @code{LENGTH}. When the linker evaluates an expression, the result depends on where the expression is located in a linker script. Expressions appearing diff --git a/ld/ldexp.c b/ld/ldexp.c index 0549f19575b..de7f9f29bc1 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -553,6 +553,8 @@ fold_name (etree_type *tree) " referenced in expression\n"), tree->name.name); } + else if (output_section == bfd_abs_section_ptr) + new_number (h->u.def.value + h->u.def.section->output_offset); else new_rel (h->u.def.value + h->u.def.section->output_offset, output_section); -- 2.30.2