From patchwork Wed Jul 21 19:04:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 44448 Return-Path: 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 C573E3886C67 for ; Wed, 21 Jul 2021 19:04:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C573E3886C67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626894295; bh=v+zJF8NWWWKm6/cXAgsK4qRhAEW8boK9sWK6at9x0sw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=KKDU9ziRvajt+iVpk7QFBrjPu7aCCE6Hi2YE+PxKYCzKg4r9VFMLvzGe/6NdoskIr UKJyTcDkJrY6ZHu0icEmP2vTI7YRnFjqFtfSb9kuhsjKWZXcKXbG00tVxYcpr7qK18 QHHfbH/7OuIQUHn824sZk9t41hhXBGTRwi7d4XQQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id C80A33857424; Wed, 21 Jul 2021 19:04:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C80A33857424 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id B7A21229; Wed, 21 Jul 2021 21:04:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4h3I1I4O8bXB; Wed, 21 Jul 2021 21:04:30 +0200 (CEST) Received: from begin (unknown [IPv6:2a01:cb19:956:1b00:de41:a9ff:fe47:ec49]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 0A0BD164; Wed, 21 Jul 2021 21:04:28 +0200 (CEST) Received: from samy by begin with local (Exim 4.94.2) (envelope-from ) id 1m6HW8-00EZx5-4c; Wed, 21 Jul 2021 21:04:28 +0200 Date: Wed, 21 Jul 2021 21:04:28 +0200 To: libc-alpha@sourceware.org, Siddhesh Poyarekar , DJ Delorie Subject: tst-interpose-static-thread-{m,malloc-}check linking statically? Message-ID: <20210721190428.dfnqd4lpqdpohy2a@begin> MIME-Version: 1.0 Content-Disposition: inline Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spamd-Bar: - X-Rspamd-Server: hera X-Rspamd-Queue-Id: B7A21229 X-Spamd-Result: default: False [-1.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_ORG_HEADER(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; SUBJECT_ENDS_QUESTION(1.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Samuel Thibault via Libc-alpha From: Samuel Thibault Reply-To: Samuel Thibault Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Hello, tl;dr: I believe we want the patch below? AIUI the tst-interpose-static-{no,}thread-{m,malloc-}check tests are supposed to be linked completely statically? On the GNU/Hurd port we have an issue linking the tst-interpose-static-thread-{m,malloc-}check tests: gcc -pie -Wl,-O1 -nostdlib -nostartfiles -o /usr/src/glibc-upstream/build/malloc/tst-interpose-static-thread-mcheck -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both /usr/src/glibc-upstream/build/csu/Scrt1.o /usr/src/glibc-upstream/build/csu/crti.o `gcc --print-file-name=crtbeginS.o` /usr/src/glibc-upstream/build/malloc/tst-interpose-static-thread.o /usr/src/glibc-upstream/build/support/libsupport_nonshared.a /usr/src/glibc-upstream/build/malloc/libmcheck.a /usr/src/glibc-upstream/build/malloc/tst-interpose-aux-thread.o ../htl/libpthread_syms.a /usr/src/glibc-upstream/build/htl/libpthread.a /usr/src/glibc-upstream/build/mach/libmachuser.a /usr/src/glibc-upstream/build/hurd/libhurduser.a -Wl,-dynamic-linker=/lib/i386-gnu/ld.so.1 -Wl,-rpath-link=/usr/src/glibc-upstream/build:/usr/src/glibc-upstream/build/math:/usr/src/glibc-upstream/build/elf:/usr/src/glibc-upstream/build/dlfcn:/usr/src/glibc-upstream/build/nss:/usr/src/glibc-upstream/build/nis:/usr/src/glibc-upstream/build/rt:/usr/src/glibc-upstream/build/resolv:/usr/src/glibc-upstream/build/mathvec:/usr/src/glibc-upstream/build/support:/usr/src/glibc-upstream/build/crypt:/usr/src/glibc-upstream/build/htl:/usr/src/glibc-upstream/build/mach:/usr/src/glibc-upstream/build/hurd -lgcc -Wl,--as-needed -lgcc_s -Wl,--no-as-needed /usr/src/glibc-upstream/build/libc.so.0.3 /usr/src/glibc-upstream/build/libc_nonshared.a -Wl,--as-needed /usr/src/glibc-upstream/build/elf/ld.so -Wl,--no-as-needed -lgcc -Wl,--as-needed -lgcc_s -Wl,--no-as-needed `gcc --print-file-name=crtendS.o` /usr/src/glibc-upstream/build/csu/crtn.o /usr/bin/ld: /usr/src/glibc-upstream/build/htl/libpthread.a(pt-sysdep.o): in function `_init_routine': /usr/src/glibc-upstream/htl/../sysdeps/mach/hurd/htl/pt-sysdep.c:88: undefined reference to `_dl_init_static_tls' collect2: error: ld returned 1 exit status The problem is that libpthread.a is getting linked in, but not libc.a, and thus _dl_init_static_tls (from libc.a) is not available to libpthread. But I'm wondering: are we supposed to support linking libpthread statically in while not linking libc statically in? The source code suggests me that we aren't. Samuel diff --git a/malloc/Makefile b/malloc/Makefile index 47369b6084..fc66abe94b 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -46,7 +46,11 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \ tests-static := \ tst-interpose-static-nothread \ + tst-interpose-static-nothread-mcheck \ + tst-interpose-static-nothread-malloc-check \ tst-interpose-static-thread \ + tst-interpose-static-thread-mcheck \ + tst-interpose-static-thread-malloc-check \ tst-malloc-usable-static \ # Test for the malloc_set_state symbol removed in glibc 2.25.