Use libc_hidden_* for argz_next, __argz_next (bug 15105)

Message ID alpine.DEB.2.20.1802132134110.25645@digraph.polyomino.org.uk
State New, archived
Headers

Commit Message

Joseph Myers Feb. 13, 2018, 9:34 p.m. UTC
  Among other localplt test failures when building with -Os, there are
libc.so PLT references for argz_next and __argz_next.  This is a
simple case of functions that are inlined for -O2 but not for -Os;
this patch adds libc_hidden_proto / libc_hidden_def for them to avoid
localplt failures even when not inlined.

Tested for x86_64 (both that it removes these particular localplt
failures for -Os - but other such failures remain so the bug can't yet
be closed - and that the testsuite continues to pass without -Os).

2018-02-13  Joseph Myers  <joseph@codesourcery.com>

	[BZ #15105]
	* include/argz.h (argz_next): Use libc_hidden_proto.
	(__argz_next): Likewise.
	* string-argz-next.c (__argz_next): Use libc_hidden_def.
	(argz_next): Use libc_hidden_weak.
  

Comments

Adhemerval Zanella Feb. 15, 2018, 6:49 p.m. UTC | #1
On 13/02/2018 19:34, Joseph Myers wrote:
> Among other localplt test failures when building with -Os, there are
> libc.so PLT references for argz_next and __argz_next.  This is a
> simple case of functions that are inlined for -O2 but not for -Os;
> this patch adds libc_hidden_proto / libc_hidden_def for them to avoid
> localplt failures even when not inlined.
> 
> Tested for x86_64 (both that it removes these particular localplt
> failures for -Os - but other such failures remain so the bug can't yet
> be closed - and that the testsuite continues to pass without -Os).
> 
> 2018-02-13  Joseph Myers  <joseph@codesourcery.com>
> 
> 	[BZ #15105]
> 	* include/argz.h (argz_next): Use libc_hidden_proto.
> 	(__argz_next): Likewise.
> 	* string-argz-next.c (__argz_next): Use libc_hidden_def.
> 	(argz_next): Use libc_hidden_weak.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> 
> diff --git a/include/argz.h b/include/argz.h
> index 770f02e..e081b2a 100644
> --- a/include/argz.h
> +++ b/include/argz.h
> @@ -39,6 +39,8 @@ extern error_t __argz_replace (char **__restrict __argz,
>  libc_hidden_proto (argz_delete)
>  libc_hidden_proto (__argz_count)
>  libc_hidden_proto (__argz_stringify)
> +libc_hidden_proto (argz_next)
> +libc_hidden_proto (__argz_next)
>  
>  # endif /* !_ISOMAC */
>  #endif
> diff --git a/string/argz-next.c b/string/argz-next.c
> index abce451..9200eda 100644
> --- a/string/argz-next.c
> +++ b/string/argz-next.c
> @@ -36,4 +36,6 @@ __argz_next (const char *argz, size_t argz_len, const char *entry)
>      else
>        return NULL;
>  }
> +libc_hidden_def (__argz_next)
>  weak_alias (__argz_next, argz_next)
> +libc_hidden_weak (argz_next)
>
  

Patch

diff --git a/include/argz.h b/include/argz.h
index 770f02e..e081b2a 100644
--- a/include/argz.h
+++ b/include/argz.h
@@ -39,6 +39,8 @@  extern error_t __argz_replace (char **__restrict __argz,
 libc_hidden_proto (argz_delete)
 libc_hidden_proto (__argz_count)
 libc_hidden_proto (__argz_stringify)
+libc_hidden_proto (argz_next)
+libc_hidden_proto (__argz_next)
 
 # endif /* !_ISOMAC */
 #endif
diff --git a/string/argz-next.c b/string/argz-next.c
index abce451..9200eda 100644
--- a/string/argz-next.c
+++ b/string/argz-next.c
@@ -36,4 +36,6 @@  __argz_next (const char *argz, size_t argz_len, const char *entry)
     else
       return NULL;
 }
+libc_hidden_def (__argz_next)
 weak_alias (__argz_next, argz_next)
+libc_hidden_weak (argz_next)