Message ID | 20210122230538.3423312-1-shorne@gmail.com |
---|---|
State | Committed |
Commit | a4efbf44757477717a907078c340386146c7623f |
Delegated to: | Adhemerval Zanella Netto |
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 12D98393A408; Fri, 22 Jan 2021 23:05:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12D98393A408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611356751; bh=V6zLPp7wS2aqz/eSKNsVKmd0Wo1dTdeH13DCqJToNRo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=pi26+VqKvPOgLtbMK/YfK1uBObP9YfACcrt9rVcZfIm//FYubCdtkLPWr4U5IyHFA ADN6kvAx6IaGD5yFt/IlWpbRYEWTXJmO+5XQ1pybJngRj3Sry+Z+MUL8yHEz+tJnWr 7RsCTK3FsD6l2Sun2xwVfr5YTopiqjksTEeIlWZA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 62DB5386F41D for <libc-alpha@sourceware.org>; Fri, 22 Jan 2021 23:05:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 62DB5386F41D Received: by mail-pf1-x42c.google.com with SMTP id w18so4807183pfu.9 for <libc-alpha@sourceware.org>; Fri, 22 Jan 2021 15:05:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V6zLPp7wS2aqz/eSKNsVKmd0Wo1dTdeH13DCqJToNRo=; b=LKXYg96pbD7B7iTaQ0LsU1EeIWQOGaManQr8qSdSlSBQLigpwkQ7CWOeGr06vXyjsq FWbNf2XHSsEa+LiJlS+rHkgVzOV4b0XkR8D0wpjYZVDRsOgEkkVBQKmPzEOqL/FR85lz Bx4ml3Nh9CCcM9q9f9mGF07G9fXbwA44sJdkv/QNLr+JUV/8tSFa5I5EJeMNbTsxz4CR dB01WrXjS4oyo3t0JhyydEj8NhQ0rAhg493F9Om7+5Npom/3yPsQII8YZcyQ3albQwUT jOSVl04GrNLKRg5E+ME0am0omccqYK1EUVc+MA+Mar0mt7nBSINxLM8N96j17pQn0S84 tu+Q== X-Gm-Message-State: AOAM530hElftaX61F2gqPZELmsYtbbmxfSW+SZOp1xhPdyTJSTUsl+zz Sim1giDrWosxW6hb3c/gFcRx98fJ2RA= X-Google-Smtp-Source: ABdhPJzcmpq3F3fu2AmZyaof0G4t1us/qql2/Rq8/6PsyM5pZ42iwEMVT8zVHkN9+i5PULrkxjoCHg== X-Received: by 2002:a63:1f45:: with SMTP id q5mr6805311pgm.414.1611356747086; Fri, 22 Jan 2021 15:05:47 -0800 (PST) Received: from localhost (g238.115-65-210.ppp.wakwak.ne.jp. [115.65.210.238]) by smtp.gmail.com with ESMTPSA id p2sm1259182pgl.19.2021.01.22.15.05.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jan 2021 15:05:46 -0800 (PST) To: GLIBC patches <libc-alpha@sourceware.org> Subject: [PATCH v2] posix/tst-rfc3484: Fix compile failure linking to local __stat64 Date: Sat, 23 Jan 2021 08:05:38 +0900 Message-Id: <20210122230538.3423312-1-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Stafford Horne via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Stafford Horne <shorne@gmail.com> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
[v2] posix/tst-rfc3484: Fix compile failure linking to local __stat64
|
|
Commit Message
Stafford Horne
Jan. 22, 2021, 11:05 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 like is done for other local symbol usage. --- Changes since v1: - Fix typo in commit s/list/like/ - Address other tests that fail with the same issue posix/tst-rfc3484-2.c | 1 + posix/tst-rfc3484-3.c | 1 + posix/tst-rfc3484.c | 1 + 3 files changed, 3 insertions(+)
Comments
On 22/01/2021 20:05, Stafford Horne via Libc-alpha 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 like is > done for other local symbol usage. I am trying to understand why I haven't see a similar issue for riscv32, since it does not provide any xstat symbols. It seems that for tests, I am not seeing any __stat64 call, but rather __fstat64 ones: $ riscv32-glibc-linux-gnu-objdump -t posix/tst-rfc3484.o | grep stat 00000000 *UND* 00000000 __fstat64 $ riscv32-glibc-linux-gnu-objdump -t posix/tst-rfc3484-2.o | grep stat 00000000 *UND* 00000000 __fstat64 $ riscv32-glibc-linux-gnu-objdump -t posix/tst-rfc3484-3.o | grep stat 00000000 *UND* 00000000 __fstat64 It comes from gaiconf_init and I am not sure why __stat64 call from gaiconf_reload is not being generated (maybe this is being optimized out). And the __fstat64 seems to not generate a linking error because is being exported by libc.so in GLIBC_PRIVATE namespace (due 8ed005daf0ab03). I added this because of the libpthread usage, but it seems we don't actually required it. For 2.34 I plan to send: diff --git a/io/Versions b/io/Versions index 49c4d2d40a..4ffafd4bde 100644 --- a/io/Versions +++ b/io/Versions @@ -145,6 +145,5 @@ libc { __file_change_detection_for_stat; __file_change_detection_for_path; __file_change_detection_for_fp; - __fstat64; } } diff --git a/sysdeps/pthread/sem_open.c b/sysdeps/pthread/sem_open.c index b0b722121d..b3b4de779b 100644 --- a/sysdeps/pthread/sem_open.c +++ b/sysdeps/pthread/sem_open.c @@ -68,7 +68,7 @@ check_add_mapping (const char *name, size_t namelen, int fd, sem_t *existing) /* Get the information about the file. */ struct stat64 st; - if (__fstat64 (fd, &st) == 0) + if (fstat64 (fd, &st) == 0) { /* Get the lock. */ lll_lock (__sem_mappings_lock, LLL_PRIVATE); To remove the __fstat64 requirement on GLIBC_PRIVATE. This patch looks ok on 2.34 opens. > --- > Changes since v1: > - Fix typo in commit s/list/like/ > - Address other tests that fail with the same issue > > posix/tst-rfc3484-2.c | 1 + > posix/tst-rfc3484-3.c | 1 + > posix/tst-rfc3484.c | 1 + > 3 files changed, 3 insertions(+) > > diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c > index 5f5ada9420..ce8ccd5f38 100644 > --- a/posix/tst-rfc3484-2.c > +++ b/posix/tst-rfc3484-2.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 > diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c > index d9ec5cc851..ecb163963f 100644 > --- a/posix/tst-rfc3484-3.c > +++ b/posix/tst-rfc3484-3.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 > 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 >
On Mon, Jan 25, 2021 at 11:55:43AM -0300, Adhemerval Zanella wrote: > > > On 22/01/2021 20:05, Stafford Horne via Libc-alpha 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 like is > > done for other local symbol usage. > > I am trying to understand why I haven't see a similar issue for riscv32, > since it does not provide any xstat symbols. It seems that for tests, > I am not seeing any __stat64 call, but rather __fstat64 ones: > > $ riscv32-glibc-linux-gnu-objdump -t posix/tst-rfc3484.o | grep stat > 00000000 *UND* 00000000 __fstat64 > $ riscv32-glibc-linux-gnu-objdump -t posix/tst-rfc3484-2.o | grep stat > 00000000 *UND* 00000000 __fstat64 > $ riscv32-glibc-linux-gnu-objdump -t posix/tst-rfc3484-3.o | grep stat > 00000000 *UND* 00000000 __fstat64 > > It comes from gaiconf_init and I am not sure why __stat64 call from > gaiconf_reload is not being generated (maybe this is being optimized > out). > > And the __fstat64 seems to not generate a linking error because is being > exported by libc.so in GLIBC_PRIVATE namespace (due 8ed005daf0ab03). I > added this because of the libpthread usage, but it seems we don't > actually required it. For 2.34 I plan to send: Thanks for the explaination. I also wonder why it wasn't showing up in other platforms. > diff --git a/io/Versions b/io/Versions > index 49c4d2d40a..4ffafd4bde 100644 > --- a/io/Versions > +++ b/io/Versions > @@ -145,6 +145,5 @@ libc { > __file_change_detection_for_stat; > __file_change_detection_for_path; > __file_change_detection_for_fp; > - __fstat64; > } > } > diff --git a/sysdeps/pthread/sem_open.c b/sysdeps/pthread/sem_open.c > index b0b722121d..b3b4de779b 100644 > --- a/sysdeps/pthread/sem_open.c > +++ b/sysdeps/pthread/sem_open.c > @@ -68,7 +68,7 @@ check_add_mapping (const char *name, size_t namelen, int fd, sem_t *existing) > > /* Get the information about the file. */ > struct stat64 st; > - if (__fstat64 (fd, &st) == 0) > + if (fstat64 (fd, &st) == 0) > { > /* Get the lock. */ > lll_lock (__sem_mappings_lock, LLL_PRIVATE); > > To remove the __fstat64 requirement on GLIBC_PRIVATE. > > This patch looks ok on 2.34 opens. > > > --- > > Changes since v1: > > - Fix typo in commit s/list/like/ > > - Address other tests that fail with the same issue > > > > posix/tst-rfc3484-2.c | 1 + > > posix/tst-rfc3484-3.c | 1 + > > posix/tst-rfc3484.c | 1 + > > 3 files changed, 3 insertions(+) > > > > diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c > > index 5f5ada9420..ce8ccd5f38 100644 > > --- a/posix/tst-rfc3484-2.c > > +++ b/posix/tst-rfc3484-2.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 > > diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c > > index d9ec5cc851..ecb163963f 100644 > > --- a/posix/tst-rfc3484-3.c > > +++ b/posix/tst-rfc3484-3.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 > > 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 > >
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c index 5f5ada9420..ce8ccd5f38 100644 --- a/posix/tst-rfc3484-2.c +++ b/posix/tst-rfc3484-2.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 diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c index d9ec5cc851..ecb163963f 100644 --- a/posix/tst-rfc3484-3.c +++ b/posix/tst-rfc3484-3.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 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