aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-05-14 12:32:12 +0100
committerNick Clifton <nickc@redhat.com>2015-05-14 12:32:12 +0100
commitfd1c42387bead88edbd6043440462ada755f8d6e (patch)
treedeb190f664b387f78bfe648a6ea41d06cc03f753 /ld
parente6c9a083ec5ae7a45bd71682b26aae1939849388 (diff)
downloadgdb-fd1c42387bead88edbd6043440462ada755f8d6e.zip
gdb-fd1c42387bead88edbd6043440462ada755f8d6e.tar.gz
gdb-fd1c42387bead88edbd6043440462ada755f8d6e.tar.bz2
Update description of the ASSERT linker script command to note its interation with PROVIDEd symbols.
* ld.texinfo (ASSERT): Describe the interaction with PROVIDEd symbols.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/ld.texinfo30
2 files changed, 35 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 4cd77f7..f849318 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-14 Nick Clifton <nickc@redhat.com>
+
+ * ld.texinfo (ASSERT): Describe the interaction with PROVIDEd
+ symbols.
+
2015-05-11 H.J. Lu <hongjiu.lu@intel.com>
* configure.tgt: Support i[3-7]86-*-elfiamcu target.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 77c02d6..0c5f884 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -3473,6 +3473,36 @@ There are a few other linker scripts commands.
Ensure that @var{exp} is non-zero. If it is zero, then exit the linker
with an error code, and print @var{message}.
+Note that assertions are checked before the final stages of linking
+take place. This means that expressions involving symbols PROVIDEd
+inside section definitions will fail if the user has not set values
+for those symbols. The only exception to this rule is PROVIDEd
+symbols that just reference dot. Thus an assertion like this:
+
+@smallexample
+ .stack :
+ @{
+ PROVIDE (__stack = .);
+ PROVIDE (__stack_size = 0x100);
+ ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
+ @}
+@end smallexample
+
+will fail if @code{__stack_size} is not defined elsewhere. Symbols
+PROVIDEd outside of section definitions are evaluated earlier, so they
+can be used inside ASSERTions. Thus:
+
+@smallexample
+ PROVIDE (__stack_size = 0x100);
+ .stack :
+ @{
+ PROVIDE (__stack = .);
+ ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
+ @}
+@end smallexample
+
+will work.
+
@item EXTERN(@var{symbol} @var{symbol} @dots{})
@kindex EXTERN
@cindex undefined symbol in linker script