From patchwork Tue Jan 23 07:15:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 190760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp167197dyi; Mon, 22 Jan 2024 23:15:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWStsisI6FI8HV8c47v3cL6q3lYQVyi1Y0nj/K9WodFZ9QqH3UioFTd4BrxPOQQuPtni0x X-Received: by 2002:ac8:5b81:0:b0:42a:4677:28de with SMTP id a1-20020ac85b81000000b0042a467728demr483473qta.33.1705994158695; Mon, 22 Jan 2024 23:15:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705994158; cv=pass; d=google.com; s=arc-20160816; b=YhPv1IBY/8s1yR9727erOf0HP4N0hCY48MM6wxX3IQfx58OdD9cJiSi6RVip2zqxzy 6X22hle2je0TKDneKGEFPGfAYUBz4uDnPtW6WMvjEuoy26bMPA0D+6dulQ127/Abd3y1 UhrgKgO/3I+m10nF0Wk4ZQU3V6o6uZj1n17GC+KRw59rC9riiJnMw+OjXB/IKwOQLz62 H808om4QFreFYIzyRaJbvWGlBN3kJLUAnfAz+cxtBzuvJCtPzBRPR5PvEj+68L/Q0MIh LJuycRJL8WzXjQQ6x9QyrdWAWKU9R9QDI9hA8Gcjhq1HKFSxxAC80QWPO0jUXbCYzZJF pywQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:date:organization:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=Z+uCd89jhXkKXWWZC9+wmlNEL1mJK/sb1coGYA+uttA=; fh=oexAcL1GQ/7KI5o7JIA5z5L7G+umyjSpuUDYjScX5yc=; b=xGoPmP5rJH744cv5vSTk0gO82FEVUQ+ICnl7E0TJJHM+6R7hUu5haFa7y6032ZRTsc AVjfsOue2H9juUFBy6CJTH8H46F6LilAJQ3w3HgkNBr6egbuEKtdb3XFDgNY6ca1emrI UgkX2dAD/EJi35H/ttm+hrJhkByFwcIB+N+6ZmtamiSsmj+hgzX0EMr3/9Kb32ApvJ2g 46Z52IFjkLc5XRN3xKwFz6y99DXFiFux+CUgzdSd0ZC27D7QtmN0ceawda1QG/5r3sLD 7v4kadQ4eMyN+zgQifmymCysz3/g5i6JOoEjm8iJLekNV+9S3oeMvmGIksJmGe43OQuu Yylg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=NyY19uYW; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id a10-20020a05622a02ca00b0042a3cf09453si4254617qtx.48.2024.01.22.23.15.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 23:15:58 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=NyY19uYW; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 66DA53858408 for ; Tue, 23 Jan 2024 07:15:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 96DB13858D20 for ; Tue, 23 Jan 2024 07:15:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 96DB13858D20 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 96DB13858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::534 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705994116; cv=none; b=eCoz2/Czw7hwTqTXDBto/4ZKsz9gsKXa4WYVSOJuPPJwvuEw6Nxu1yY2oURjukt80QQSgaqVg1EM8LC/eeps8t9GlBsPQ4wjmxiwipHh2P32ci78TF5o1sD0kOS7RlN4hxSIw2a7+qRsdg8KagoBPv+LsMoZ4jAwsG/QmNA13Gs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705994116; c=relaxed/simple; bh=sPGmkBcCQ/N2fs0hplNnsi+KGNz7CVPU7u2Y89oOamY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=WrYkNN4iRCyQY9oITqoVo8/U+iOAozgP4mE1Uk2nuijdG11ktEEzgB9H9ZpiRebwTrcxe6h0csoo/L382cUks0gZC3d1rSxhAab3vPRtYYlwXNxmYg1B4ocSUBuywe5x1n6uHDori19v9uDBHPAwZaTXRz2K6aUbmDVnSD0A/Fc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-5cfd95130c6so622151a12.1 for ; Mon, 22 Jan 2024 23:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1705994113; x=1706598913; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Z+uCd89jhXkKXWWZC9+wmlNEL1mJK/sb1coGYA+uttA=; b=NyY19uYWXFhz/pTPHNlvZTwQbWwIK42c3ORaNMlbGJAh03x1qu8oiiM+4OH5cWot5U RjZ+M5EXMmz6cF+EaN71JdVPM/N5pM2oSfuDjiSrnk3NB+/vTp9AEcRzTsbKPYMdbryD qUD6qwFZ+G9yi1XnS6oJQnA90OAgaGKVuGhfDZFHkEwfZk5qIipSbnnjjjB3hCbKcXck xuklkDV+a+AGkoLFT0/zrmbEq+nlFoXN4XpY+JBJ7NFeGwEgd6v30zZJkIAiC5iYh5TV B2PGvsKVVfl57rbTMxBQ3ycm9eTS+k/ucjZEsvmVTGOgNgSk8JWhUo3b2zg9VGLCEjfy +S4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705994113; x=1706598913; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z+uCd89jhXkKXWWZC9+wmlNEL1mJK/sb1coGYA+uttA=; b=i0/Y634xrnj0FiVEzFSAabGErjLgofJ6aHhheGi9Mv1h6+ObYChUCF2kZ+LLYkYd64 jkDxdppHB6muWTrTDku7ii+j9bm7NE7ooF/aRHbdzOKcF1ffymkKSWMzVbE+NB6/zkol VZPivoRenfOUWWiiaC9hgNcUGJTz+3abmmxA4+rXX3EkGRFxJT/b8nyQ98J1PNPfecb6 S/3I3/JKhf2zp8ODB5Sos2us8yk+JMGa/ZjpQkvxV6J2NzINqOYK3WnG9KrgEjVNdkkw DRrezR+HXZrezSMn9q4UyAPAMHC6DtE+mHb/96kflSPXWu60zcnsxWT+D3/Yq/PE7Tyv Znig== X-Gm-Message-State: AOJu0Yy6xx/2aSt5BnCxxx1nRJIP02tfsyC1d5VjaH7aCC1QLoCiMb52 WlQA7D9a5A3FcmAxsOIX5JA47R6QpvNqJ33QERUwapweu90ZRBOgguKqv0BqyobaZ3HqJde/Atw = X-Received: by 2002:a17:90a:7103:b0:28b:d55c:fdc3 with SMTP id h3-20020a17090a710300b0028bd55cfdc3mr2211854pjk.89.1705994113590; Mon, 22 Jan 2024 23:15:13 -0800 (PST) Received: from free.home ([2804:7f1:218b:d88:4bd5:3dd7:ea20:12bc]) by smtp.gmail.com with ESMTPSA id sj15-20020a17090b2d8f00b0029082ec3619sm4878393pjb.30.2024.01.22.23.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 23:15:13 -0800 (PST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 40N7F5ci089621 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 23 Jan 2024 04:15:05 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: Rainer Orth , Mike Stump Subject: [PATCH] testsuite: require libc sym for -shared Organization: Free thinker, does not speak for AdaCore Date: Tue, 23 Jan 2024 04:15:05 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788864531199680791 X-GMAIL-MSGID: 1788864531199680791 Targets whose binutils support -shared, but that don't have a shared libc, and that can't add PDC (non-PIC) to shared libraries, may succeed at the effective target test for -shared, because it brings nothing from libc, but tests that rely on -shared and that use bits from libc, such as g++.dg/lto/pr108772, fail despite requiring the shared effective target. Extend the effective target test to bring malloc() from libc, that's likely to be present in libc and bring a substantial amount of code if no shared libc is available. Regstrapped on x86_64-linux-gnu, also tested on aarch64-elf with gcc-13, where the problem was observed. Ok to install? for gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_shared): Check for a static-only libc. --- gcc/testsuite/lib/target-supports.exp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 73360cd3a0d55..213dad355a6a5 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1391,10 +1391,16 @@ proc check_effective_target_aarch64_tlsle32 { } { proc check_effective_target_shared { } { # Note that M68K has a multilib that supports -fpic but not # -fPIC, so we need to check both. We test with a program that - # requires GOT references. + # requires GOT references, and with a libc symbol that would + # bring in significant parts of a static-only libc. Absent a + # shared libc, this would make -shared tests fail, so we don't + # want to enable the shared effective target then. return [check_no_compiler_messages shared executable { + #include extern int foo (void); extern int bar; - int baz (void) { return foo () + bar; } + char *baz (void) { + return foo () + (char*) malloc (bar); + } } "-shared -fpic"] }