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: 85686 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 309BD3857BB2 for ; Tue, 13 Feb 2024 23:15:55 +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-Google-Smtp-Source: AGHT+IEUnzxMrQ6G/+9Q3poXRdYJ8GUfOvVgORCSNPhUp5uP0k9bgBMeiK4i7cEFeRUkf2veDPRmpQ== 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+patchwork=sourceware.org@sourceware.org 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