[PATCH] Revert "parser_config.[ch]: remove duplicated hidden functions"

Vineet Gupta Vineet.Gupta1 at synopsys.com
Mon May 6 06:08:15 UTC 2013


Ping ? Any comments on this - it fixes a real issue - across arches !

-Vineet

On 04/24/2013 03:27 PM, Vineet Gupta wrote:
> This reverts commit 91450a8a3b3112066fd6d266a6c492365c9d8d61.
> 
> There's a namespace collision for config_{open,close,read} functions
> between uClibc and Busybox. Callers in uClibc and busybox need to call
> their local variants. In case of static linking, both the variants need
> to be pulled in the final executable.
> 
> Turns out that the existing hidden attribute is not enough for static
> linked Busybox where only it's local copy is included in the final link.
> Thus causing the uClibc callers to crap out at runtime.
> This can be fixed by restoring the libc_hidden_proto() annotation
> which causes the libc variants to be aliased with __GI_ prefix and
> makign both the symbols be available and properly referenced in the
> final link.
> 
> This issue was found with ARC gcc 4.8 + uClibc trunk.
> I can confirm the same thing with ARM uClibc buildroot build (when
> switching to uClibc daily snapshot).
> 
> All the credit for debugging the issue goes to Anton,Joern and Jeremy -
> I simply found the cure :-)
> 
> Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
> Cc: Anton Kolesov <akolesov at synopsys.com>
> Cc: Jeremy Bennett <jeremy.bennett at embecosm.com>
> Cc: Joern Rennecke <joern.rennecke at embecosm.com>
> Cc: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
> Cc: uclibc at uclibc.org
> ---
>  include/internal/parse_config.h    |    3 +++
>  libc/misc/internals/parse_config.c |    6 +++---
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/include/internal/parse_config.h b/include/internal/parse_config.h
> index 69be0cb..ebfb87e 100644
> --- a/include/internal/parse_config.h
> +++ b/include/internal/parse_config.h
> @@ -46,9 +46,12 @@ typedef struct parser_t {
>  } parser_t;
>  
>  parser_t* config_open(const char *filename) FAST_FUNC attribute_hidden;
> +libc_hidden_proto(config_open)
>  int config_read(parser_t *parser, char ***tokens, unsigned flags, const char *delims) FAST_FUNC attribute_hidden;
> +libc_hidden_proto(config_read)
>  #define config_read(parser, tokens, max, min, str, flags) \
>  	config_read(parser, tokens, ((flags) | (((min) & 0xFF) << 8) | ((max) & 0xFF)), str)
>  void config_close(parser_t *parser) FAST_FUNC attribute_hidden;
> +libc_hidden_proto(config_close)
>  
>  #endif /* __INTERNAL_PARSE_CONFIG_H */
> diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c
> index b79b7a0..4d21b5e 100644
> --- a/libc/misc/internals/parse_config.c
> +++ b/libc/misc/internals/parse_config.c
> @@ -129,7 +129,7 @@ static __always_inline parser_t * FAST_FUNC config_open2(const char *filename,
>  	return parser;
>  }
>  
> -parser_t * FAST_FUNC config_open(const char *filename)
> +parser_t attribute_hidden * FAST_FUNC config_open(const char *filename)
>  {
>  	return config_open2(filename, fopen_or_warn_stdin);
>  }
> @@ -142,7 +142,7 @@ static void config_free_data(parser_t *parser)
>  }
>  #endif
>  
> -void FAST_FUNC config_close(parser_t *parser)
> +void attribute_hidden FAST_FUNC config_close(parser_t *parser)
>  {
>  	if (parser) {
>  		fclose(parser->fp);
> @@ -176,7 +176,7 @@ mintokens > 0 make config_read() print error message if less than mintokens
>  (but more than 0) are found. Empty lines are always skipped (not warned about).
>  */
>  #undef config_read
> -int FAST_FUNC config_read(parser_t *parser, char ***tokens,
> +int attribute_hidden FAST_FUNC config_read(parser_t *parser, char ***tokens,
>  											unsigned flags, const char *delims)
>  {
>  	char *line;
> 



More information about the uClibc mailing list