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 C64793858428 for ; Fri, 3 Dec 2021 12:40:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C64793858428 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1B39Gk6Y031166 for ; Fri, 3 Dec 2021 12:40:53 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 3cqgff3kxe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Dec 2021 12:40:53 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1B3CcvcK017207 for ; Fri, 3 Dec 2021 12:40:52 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma01dal.us.ibm.com with ESMTP id 3ckcaebt59-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Dec 2021 12:40:52 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1B3CeoNw39911828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Dec 2021 12:40:50 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9B96C6057; Fri, 3 Dec 2021 12:40:50 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 496B4C6055; Fri, 3 Dec 2021 12:40:50 +0000 (GMT) Received: from localhost (unknown [9.77.153.129]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 3 Dec 2021 12:40:49 +0000 (GMT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20211104181039.97106-1-lamm@linux.ibm.com> References: <20211022211201.983646-1-lamm@linux.ibm.com> <20211104181039.97106-1-lamm@linux.ibm.com> Subject: Re: [PATCH] powerpc: Use FLAG_ELF_LIBC6 for 32-bit known libraries From: "Lucas A. M. Magalhaes" Cc: tuliom@linux.ibm.com To: "Lucas A. M. Magalhaes via Libc-alpha" Date: Fri, 03 Dec 2021 09:40:48 -0300 Message-ID: <163853524863.709311.1781855978223452439@localhost.localdomain> User-Agent: alot/0.9.1 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ehC9z1vV6xp7ECMiGl-lyuMo_eZ0ted_ X-Proofpoint-ORIG-GUID: ehC9z1vV6xp7ECMiGl-lyuMo_eZ0ted_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-03_06,2021-12-02_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112030078 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, 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: 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-List-Received-Date: Fri, 03 Dec 2021 12:40:56 -0000 Ping. Quoting Lucas A. M. Magalhaes via Libc-alpha (2021-11-04 15:10:39) > In systems with more versions of the known libraries, i.e. on IBM > Advance Toolchain, ldconfig will order them incorrectly on ld.cache. >=20 > The issue only occurs with 32-bit libraries that don't depend on libc or > libm. That's because process_elf32_file check if the elf depends on one > of the libraries at known_libs to select the elf flag. For example, as > libc.so.6 don't depend on itself or on libm it will be flagged as > FLAG_ELF instead of FLAG_ELF_LIBC6 as expected. >=20 > This commit fixes this by checking if a appropriate flag was set by > process_elf32_file. If not it will search on known_libs and use the flag > in there. > --- > sysdeps/unix/sysv/linux/powerpc/readelflib.c | 21 +++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) >=20 > diff --git a/sysdeps/unix/sysv/linux/powerpc/readelflib.c b/sysdeps/unix/= sysv/linux/powerpc/readelflib.c > index 51f8a9496a..94da21c407 100644 > --- a/sysdeps/unix/sysv/linux/powerpc/readelflib.c > +++ b/sysdeps/unix/sysv/linux/powerpc/readelflib.c > @@ -33,11 +33,26 @@ process_elf_file (const char *file_name, const char *= lib, int *flag, > char **soname, void *file_contents, size_t file_length) > { > ElfW(Ehdr) *elf_header =3D (ElfW(Ehdr) *) file_contents; > - int ret; > + int ret, j; > =20 > if (elf_header->e_ident [EI_CLASS] =3D=3D ELFCLASS32) > - return process_elf32_file (file_name, lib, flag, osversion, isa_leve= l, > - soname, file_contents, file_length); > + { > + ret =3D process_elf32_file (file_name, lib, flag, osversion, isa_l= evel, > + soname, file_contents, file_length); > + /* Use the apropriate flag for known_libs instead of FLAG_ELF. */ > + if (*flag =3D=3D FLAG_ELF) > + { > + for (j =3D 0; > + j < sizeof (known_libs) / sizeof (known_libs [0]); > + ++j) > + if (strcmp (lib, known_libs [j].soname) =3D=3D 0) > + { > + *flag =3D known_libs [j].flag; > + break; > + } > + } > + return ret; > + } > else > { > ret =3D process_elf64_file (file_name, lib, flag, osversion, isa_l= evel, > --=20 > 2.31.1 >