posix/tst-rfc3484: Fix compile failure linking to local __stat64

Message ID 20210122224302.3166767-1-shorne@gmail.com
State Superseded
Headers
Series posix/tst-rfc3484: Fix compile failure linking to local __stat64 |

Commit Message

Stafford Horne Jan. 22, 2021, 10:43 p.m. UTC
  After 04986243d1 ("Remove internal usage of extensible stat functions")
linking the __stat64 symbol in getaddrinfo for this test fails with the
below error:

    /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld: /home/shorne/work/gnu-toolchain/build-glibc/posix/tst-rfc3484.o: in function `gaiconf_reload':
    /home/shorne/work/gnu-toolchain/glibc/posix/../sysdeps/posix/getaddrinfo.c:2136: undefined reference to `__stat64'
    collect2: error: ld returned 1 exit status

This is because __stat64 is a local symbol, the test includes the
getaddrinfo directly and fails to link against the local symbol.  Fix
this by setting up an alias to the global stat64 symbol name list is
done for other local symbol usage.
---
 posix/tst-rfc3484.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Stafford Horne Jan. 22, 2021, 10:51 p.m. UTC | #1
On Sat, Jan 23, 2021 at 07:43:02AM +0900, Stafford Horne wrote:
> After 04986243d1 ("Remove internal usage of extensible stat functions")
> linking the __stat64 symbol in getaddrinfo for this test fails with the
> below error:
> 
>     /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld: /home/shorne/work/gnu-toolchain/build-glibc/posix/tst-rfc3484.o: in function `gaiconf_reload':
>     /home/shorne/work/gnu-toolchain/glibc/posix/../sysdeps/posix/getaddrinfo.c:2136: undefined reference to `__stat64'
>     collect2: error: ld returned 1 exit status
> 
> This is because __stat64 is a local symbol, the test includes the
> getaddrinfo directly and fails to link against the local symbol.  Fix
> this by setting up an alias to the global stat64 symbol name list is

I will fix this type "... symbol *name* like is done ..."

> done for other local symbol usage.
> ---
>  posix/tst-rfc3484.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
> index 97d065b6bf..3b2052eb54 100644
> --- a/posix/tst-rfc3484.c
> +++ b/posix/tst-rfc3484.c
> @@ -11,6 +11,7 @@
>  #define __gethostbyaddr_r gethostbyaddr_r
>  #define __gethostbyname2_r gethostbyname2_r
>  #define __qsort_r qsort_r
> +#define __stat64 stat64
>  
>  void
>  attribute_hidden
> -- 
> 2.26.2
>
  

Patch

diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
index 97d065b6bf..3b2052eb54 100644
--- a/posix/tst-rfc3484.c
+++ b/posix/tst-rfc3484.c
@@ -11,6 +11,7 @@ 
 #define __gethostbyaddr_r gethostbyaddr_r
 #define __gethostbyname2_r gethostbyname2_r
 #define __qsort_r qsort_r
+#define __stat64 stat64
 
 void
 attribute_hidden