aboutsummaryrefslogtreecommitdiff
path: root/ld/ld.texi
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-01-10 15:05:19 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-01-14 08:24:44 +0100
commit4ea904edb7b04ad526bd8a5401729a6c1f5a982f (patch)
tree1a9b216b857705dcf28229f1e94c62311200a718 /ld/ld.texi
parent8a2d34fe51edb115574056f56dcea8438acd5285 (diff)
downloadgdb-4ea904edb7b04ad526bd8a5401729a6c1f5a982f.zip
gdb-4ea904edb7b04ad526bd8a5401729a6c1f5a982f.tar.gz
gdb-4ea904edb7b04ad526bd8a5401729a6c1f5a982f.tar.bz2
ld: Clarify --wrap documentation
ld/ * ld.texi (--wrap): Add example to emphasise that only undefined references are replaced by the linker.
Diffstat (limited to 'ld/ld.texi')
-rw-r--r--ld/ld.texi19
1 files changed, 19 insertions, 0 deletions
diff --git a/ld/ld.texi b/ld/ld.texi
index cc0d220..5179af3 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2392,6 +2392,25 @@ you should not put the definition of @code{__real_malloc} in the same
file as @code{__wrap_malloc}; if you do, the assembler may resolve the
call before the linker has a chance to wrap it to @code{malloc}.
+Only undefined references are replaced by the linker. So, translation unit
+internal references to @var{symbol} are not resolved to
+@code{__wrap_@var{symbol}}. In the next example, the call to @code{f} in
+@code{g} is not resolved to @code{__wrap_f}.
+
+@smallexample
+int
+f (void)
+@{
+ return 123;
+@}
+
+int
+g (void)
+@{
+ return f();
+@}
+@end smallexample
+
@kindex --eh-frame-hdr
@kindex --no-eh-frame-hdr
@item --eh-frame-hdr