aboutsummaryrefslogtreecommitdiff
path: root/ld/ld.texinfo
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-12-20 13:00:14 +0000
committerAlan Modra <amodra@gmail.com>2010-12-20 13:00:14 +0000
commit5c3049d2ef5d591dadd42bd074f4866616ef8231 (patch)
treea8644a05274ecba59667fba45c3725987b59e6c2 /ld/ld.texinfo
parente759c116027e96bb72562d69ae49a86d6f271a3a (diff)
downloadgdb-5c3049d2ef5d591dadd42bd074f4866616ef8231.zip
gdb-5c3049d2ef5d591dadd42bd074f4866616ef8231.tar.gz
gdb-5c3049d2ef5d591dadd42bd074f4866616ef8231.tar.bz2
* ld.texinfo (Expression Section): Describe treatment of numbers
and absolute symbols. * ldemul.c (after_open_default): Look up __ld_compatibility. * ldexp.c (fold_name): Convert absolute symbols to numbers when inside output section definitions, or when __ld_compatibility >= 221. (exp_fold_tree_1): Convert numbers to absolute when not in output section definition and __ld_compatibility < 221. Don't always convert values outside an output section definition to absolute. * ldexp.h (uses_defined): Comment. * ldlang.c (ld_compatibility): New variable. * ldlang.h (ld_compatibility): Declare. * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/beos.em, * emultempl/elf32.em, * emultempl/genelf.em, * emultempl/lnk960.em, * emultempl/m68kcoff.em, * emultempl/mmo.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/sunos.em, * emultempl/z80.em: Call after_open_default from after_open function.
Diffstat (limited to 'ld/ld.texinfo')
-rw-r--r--ld/ld.texinfo27
1 files changed, 13 insertions, 14 deletions
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 6d36dfb..d4419aa 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -5503,17 +5503,17 @@ 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
-outside an output section definitions are evaluated with all terms
-first being converted to absolute addresses before applying operators,
-and evaluate to an absolute address result. Expressions appearing
-inside an output section definition are evaluated with more complex
-rules, but the aim is to treat terms as relative addresses and produce
-a relative address result. In particular, an assignment of a number
-to a symbol results in a symbol relative to the output section with an
-offset given by the number. So, in the following simple example,
+One complication is that unless you assign @code{__ld_compatibility}
+a value of 221 or larger, numbers and absolute symbols are treated
+differently depending on their location, for compatibility with older
+versions of @code{ld}. Expressions appearing outside an output
+section definition treat all numbers as absolute addresses.
+Expressions appearing inside an output section definition treat
+absolute symbols as numbers. If @code{__ld_compatibility} is assigned
+a value larger than 221, then absolute symbols and numbers are simply
+treated as numbers everywhere.
+
+In the following simple example,
@smallexample
@group
@@ -5537,9 +5537,8 @@ address 0x100 in the first two assignments, then both @code{.} and
@code{__data_start} are set to 0x10 relative to the @code{.data}
section in the second two assignments.
-For expressions appearing inside an output section definition
-involving numbers, relative addresses and absolute addresses, ld
-follows these rules to evaluate terms:
+For expressions involving numbers, relative addresses and absolute
+addresses, ld follows these rules to evaluate terms:
@itemize @bullet
@item