]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Extend the descriptiopn of how to access linker defined symbols from C.
authorNick Clifton <nickc@redhat.com>
Tue, 8 Sep 2015 08:36:02 +0000 (09:36 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 8 Sep 2015 08:36:02 +0000 (09:36 +0100)
* ld.texinfo (Source Code Reference): Extend description to
include an example using arrays.

ld/ChangeLog
ld/ld.texinfo

index a9eb7c8f44b8cc350ab38b0ebc9a2f722ea02f17..3ab9f751bb8f3c9284fca3a8082d7cef9ba7d727 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-08  Nick Clifton  <nickc@redhat.com>
+
+       * ld.texinfo (Source Code Reference): Extend description to
+       include an example using arrays.
+
 2015-07-28  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * ld.h (enum orphan_handling_enum): New.
index d20a59fd3412253fb67373f384c15584773706bb..be1d4906fae107ea3b33c50544c09e9e1fd3d469 100644 (file)
@@ -3887,6 +3887,19 @@ Then the C source code to perform the copy would be:
 @end smallexample
 
 Note the use of the @samp{&} operators.  These are correct.
+Alternatively the symbols can be treated as the names of vectors or
+arrays and then the code will again work as expected:
+
+@smallexample
+@group
+  extern char start_of_ROM[], end_of_ROM[], start_of_FLASH[];
+
+  memcpy (start_of_FLASH, start_of_ROM, end_of_ROM - start_of_ROM);
+@end group
+@end smallexample
+
+Note how using this method does not require the use of @samp{&}
+operators.
 
 @node SECTIONS
 @section SECTIONS Command