This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] ld: Clarify --wrap documentation
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- Cc: binutils at sourceware dot org
- Date: Thu, 10 Jan 2019 15:16:08 -0500 (EST)
- Subject: Re: [PATCH] ld: Clarify --wrap documentation
- References: <20190110141146.1781-1-sebastian.huber@embedded-brains.de>
On Thu, 10 Jan 2019, Sebastian Huber wrote:
> ld/
> ld.texi (--wrap): Add example to emphasise that only undefined
> references are replaced by the linker
> ---
> ld/ld.texi | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/ld/ld.texi b/ld/ld.texi
> index cc0d220fa0..03c5581a3b 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, module 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}.
The "is not" is too affirmative: what happens depends on the
target and compiler options. Perhaps "may or may not be"?
> +
> +@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
> --
> 2.16.4
>
brgds, H-P