From patchwork Tue Feb 13 23:15:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 200728 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp862992dyb; Tue, 13 Feb 2024 15:15:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU9PlSFDfobzg2YrdUWIMcM09OiegzWcY1vtfG4k/9OPrN17/IMfvOaT3miiSkMkxU/GNhw7M8Q23tC6U7dV66dyEfWXg== X-Google-Smtp-Source: AGHT+IFMeRn6gd/Ew4B/LWoFCKLVaPb3YwmYUp+J84gRynwIddr2KnwcWYsWTtBGYKEGAxLWXGFu X-Received: by 2002:a05:620a:7f1:b0:787:21fb:6ea7 with SMTP id k17-20020a05620a07f100b0078721fb6ea7mr1002813qkk.69.1707866136028; Tue, 13 Feb 2024 15:15:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707866136; cv=pass; d=google.com; s=arc-20160816; b=ClgF1wsnKtObMs8zDsT6jt0RZwt+C20TnVhNuMKpf2fcOEY/dPeoItiHv3hVXMn0/N ZCSPtXuI6pWfi5yjQOHOfWLSr0NoC47AorqI53roN1fd7m4Z9RzCtYrG+nCYmitdvBj2 QJidH7/W1LQE1ZUxwVPfsk6E/20UKFvIyyKs9oBB6osy1OV9iwnyYyJwRO5K3CaEjm8U QUfbx9wJg8ZBspk6h8TNx6HqOfXmIPfve9Y1roi2m8CDD7h7JOMOmOKO6x1myUGvDtga 0uDqCKDE+2ayd5FR3JB8royTTnrEoEeCOzAqHrDg4pgQkTpXcc6vAHNCDYkIW5HZErDl AVbA== 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:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=mBnWwwqSuezLALplnFwFwzf+Lix57WhmXNo0a77Iwbk=; fh=DOV9FvTPa1Sle2IXJiGFZAe+WoxiTGgmP5kPXrgaB0g=; b=I99qMazjw8bj8x4dmff+FElS56ML3rXlwJFEulPEcBGJOKKYKgVbtgdBrTOR9ZO/gM lz3LOleNZSbYQCY7PWnTHj01joUfCogXZE0NtmM5MrOGbIZc0DB5zVWUhtWpuiBPsmI7 NKoSR38u8CaaD6az4zBnepCC6wK4NkD7dOzp/bV9djxrwJmH9va6Gd4VQKFOxkmRdbK/ LzCWMEWHLX4e5UihmyAH59CmRhx/J/XyS0GlU5SehdKmF8XHPhe4CY1v1zGZLoppTRTX cD7f68ZL5Js8yM4aS8wA36S2yFomWd98v39//dAYZ3/L6RO7ml6LFFMaP+YTNUjINTLk R48A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=i23XliwA; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCXSIYIc+q9VYGpLb4BIN6/1MgJlBe3CVwRdzBimZtmZkqU36xZ7hMpGRAgVwxrnFED/pxvkH/iriV+phnGrDkgvhs+vMg== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 1-20020a05620a048100b00787167c97cfsi3647581qkr.324.2024.02.13.15.15.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 15:15:36 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=i23XliwA; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 939DF3857BB8 for ; Tue, 13 Feb 2024 23:15:35 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.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 79DAA3857C66 for ; Tue, 13 Feb 2024 23:15:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 79DAA3857C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 79DAA3857C66 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=1707866125; cv=none; b=ISsdGqsio7hN6Z0rkIKSjXj1WE8Xd89xiFh3yP59r4hXZUzZs33U6t8gpX5tmXYAlHzPmybMWjqe800Xt4Qnh4poGK2LaB2vZNkj79GVusJFnHtsFCCCGI9V4TGZyQaLvsOtrg3E9tYOovjIDiJdcnoMSUHP9ziyGHQtQnr6heE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707866125; c=relaxed/simple; bh=yz1boqRKS4JRKllwxam1ezs04UWA7XMsZx0WQEHLD8U=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=DCyxRCSJ/ukIgr3uJ1pU1q30wKefi9VlwBa23dl5zp9PtoU9BP3aWhuxe5SXjjGBdG3zeDFvizsEN4iRBsMQpjcuRNXFKInGBQNxhWI9IJaZ/bRHThGx4S2WeyF611af9IOVk25pKIjuh4lPQNS+6zCDNdsqj/Xl5Kq6xN//RUU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-5dbd519bde6so3712788a12.1 for ; Tue, 13 Feb 2024 15:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707866122; x=1708470922; darn=sourceware.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=mBnWwwqSuezLALplnFwFwzf+Lix57WhmXNo0a77Iwbk=; b=i23XliwAKm6zrnRWX8Gvaf6yV3ZD3pUdoEiKkuQu++h/VHxfuS5mKmUB3JE+4k5Nyk 64M2dzzRb/VIObDh5uX3xMBhoKqhqQLAr65BpaXNP2dVkI8/03J0aO9pl72/SKY7Z9de CgAjULqTIKtXHlb0CFcwm081KRvcOlx8EB1rOPyB0i/Le0uWDbmG5CprvFjI8wfvpbA7 6CMLuf1rsIcSSG5f5eBPfW2LeRlVtebOKQjlpHFRrVYgJAWhf/IUGMW5h3Rn02QI0sV0 9wILnbD0Zyd6Ex/NDiXBE2xkD7k/WZ7FSkuTgDfpcO4oi4uMe45fTQNzgCFwyCEWwbbr VEIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707866122; x=1708470922; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mBnWwwqSuezLALplnFwFwzf+Lix57WhmXNo0a77Iwbk=; b=JlB2XkQ6PtaG9l2dNO0ana4OeECC4qfHJe9duXvq9cc5+BxBDaTVF42RSncOwjGDNM 0IMIigAJnIIFvJ6PGrHa6xuotsKF2G4LUKurMyamPa3Un3aifE1NWif7lFJOa69p75pm adc5oV2iBWKYbvuzMYPBF0SL5TTvVf4Sr7XBcOmDNnpS62kfa769zHqcVSmiNlFYwEVP VjHtQPpqd1iKRQcQ5gmWhbEL8gnuEkPB+TxZVvbzv5w4K54BZPWfXVX0w43oStppIRyu VFJG0xbTfiIL2lOQsMz++iusqf86og8C4JKU3IE9i8sdPCiQxcecwuoHbOIzcNIeKd0q Y0KQ== X-Gm-Message-State: AOJu0YxiFMhDWPaVjSQEwRuZ6I9/LQmzxtgstwQF4+nsnE/uA1BdEbhH hX2rncrnrk163PdPsjvAWGVzDrR+//mtAAR/NEocMVaenFoO4McK+qrclxS7 X-Received: by 2002:a05:6a20:7b2a:b0:19c:9d37:ec59 with SMTP id s42-20020a056a207b2a00b0019c9d37ec59mr961131pzh.28.1707866122183; Tue, 13 Feb 2024 15:15:22 -0800 (PST) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id l21-20020a170902e2d500b001db57f03e18sm101442plc.8.2024.02.13.15.15.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 15:15:21 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 042EA1141378; Wed, 14 Feb 2024 09:45:19 +1030 (ACDT) Date: Wed, 14 Feb 2024 09:45:18 +1030 From: Alan Modra To: binutils@sourceware.org Cc: Andreas Krebbel Subject: s390-linux FAIL: pr22269-1 (static pie undefined weak) Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3033.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790827441488694168 X-GMAIL-MSGID: 1790827441488694168 Like 10e7c0457cb7 but for elf32-s390.c. Andreas is there a reason why this patch of yours for elf64-s390.c should not be applied to elf32-s390.c? I see there may be a bfd_link_dll vs. bfd_link_pic patch missing too. * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC. (allocate_dynrelocs): Likewise. (elf_s390_relocate_section): Check resolved_to_zero. (elf_s390_finish_dynamic_symbol): Don't generate runtime reloc if UNDEFWEAK_NO_DYNAMIC_RELOC. diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 1a2ade0414e..bd9eb1ea31b 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1447,8 +1447,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, { if (h->plt.refcount <= 0 || SYMBOL_CALLS_LOCAL (info, h) - || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT - && h->root.type != bfd_link_hash_undefweak)) + || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) { /* This case can occur if we saw a PLT32 reloc in an input file, but the symbol was never referred to by a dynamic @@ -1677,8 +1676,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) htab->elf.srelgot->size += sizeof (Elf32_External_Rela); else if (tls_type == GOT_TLS_GD) htab->elf.srelgot->size += 2 * sizeof (Elf32_External_Rela); - else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak) + else if (!UNDEFWEAK_NO_DYNAMIC_RELOC (info, h) && (bfd_link_pic (info) || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) htab->elf.srelgot->size += sizeof (Elf32_External_Rela); @@ -2240,9 +2238,7 @@ elf_s390_relocate_section (bfd *output_bfd, h) || (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h)) - || (ELF_ST_VISIBILITY (h->other) - && h->root.type == bfd_link_hash_undefweak)) - + || resolved_to_zero) { /* This is actually a static link, or it is a -Bsymbolic link and the symbol is defined @@ -3499,6 +3495,9 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, else if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h)) { + if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) + return true; + /* If this is a static link, or it is a -Bsymbolic link and the symbol is defined locally or was forced to be local because of a version file, we just want to emit a