From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 8B9B23858D28 for ; Thu, 28 Apr 2022 08:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B9B23858D28 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23S8DcxO014588 for ; Thu, 28 Apr 2022 08:19:57 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fqq7u82ns-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Apr 2022 08:19:57 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23S8Ckcm010916 for ; Thu, 28 Apr 2022 08:19:55 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06ams.nl.ibm.com with ESMTP id 3fm8qj75uk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Apr 2022 08:19:55 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23S86kuA22610344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Apr 2022 08:06:46 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D20E542047; Thu, 28 Apr 2022 08:19:51 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC12242042; Thu, 28 Apr 2022 08:19:51 +0000 (GMT) Received: from t3560005.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 28 Apr 2022 08:19:51 +0000 (GMT) From: Stefan Liebler To: binutils@sourceware.org Cc: krebbel@linux.ibm.com, Stefan Liebler Subject: [PATCH 2/2] s390: Add DT_JMPREL pointing to .rela.[i]plt with static-pie Date: Thu, 28 Apr 2022 10:19:43 +0200 Message-Id: <20220428081943.1003366-2-stli@linux.ibm.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220428081943.1003366-1-stli@linux.ibm.com> References: <20220428081943.1003366-1-stli@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: FV2uFc9u_j5MKoagQGtC_WCx3ndRB__5 X-Proofpoint-GUID: FV2uFc9u_j5MKoagQGtC_WCx3ndRB__5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-27_04,2022-04-27_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 impostorscore=0 bulkscore=0 mlxlogscore=528 priorityscore=1501 clxscore=1015 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204280049 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2022 08:20:00 -0000 In static-pie case, there are IRELATIVE-relocs in .rela.iplt (htab->irelplt), which will later be grouped to .rela.plt. On s390, the IRELATIVE relocations are always located in .rela.iplt - even for non-static case. Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added to the dynamic section even if htab->srelplt->size == 0. See _bfd_elf_add_dynamic_tags in bfd/elflink.c. bfd/ elf64-s390.c (elf_s390_size_dynamic_sections): Enforce DT_JMPREL via htab->elf.dt_jmprel_required. --- bfd/elf64-s390.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 00ee386baab..0b851f7ac0e 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1876,7 +1876,20 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, else if (startswith (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->elf.srelplt) - relocs = true; + { + relocs = true; + if (s == htab->elf.irelplt) + { + /* In static-pie case, there are IRELATIVE-relocs in + .rela.iplt (htab->irelplt), which will later be grouped + to .rela.plt. On s390, the IRELATIVE relocations are + always located in .rela.iplt - even for non-static case. + Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added + to the dynamic section even if htab->srelplt->size == 0. + See _bfd_elf_add_dynamic_tags in bfd/elflink.c. */ + htab->elf.dt_jmprel_required = true; + } + } /* We use the reloc_count field as a counter if we need to copy relocs into the output file. */ -- 2.33.1