From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 0BFD8385780B for ; Fri, 30 Oct 2020 13:22:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0BFD8385780B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-80-0Pne_p7qOGCF5XO-ASHJ9Q-1; Fri, 30 Oct 2020 09:22:17 -0400 X-MC-Unique: 0Pne_p7qOGCF5XO-ASHJ9Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE743100A24C; Fri, 30 Oct 2020 13:22:16 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 048AF5B4A7; Fri, 30 Oct 2020 13:22:15 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella via Libc-alpha Subject: Re: [PATCH 23/28] elf: Unify old and new format cache handling code in ld.so References: <286692c4-80ef-3115-0980-a5029fe8faa7@linaro.org> Date: Fri, 30 Oct 2020 14:22:14 +0100 In-Reply-To: <286692c4-80ef-3115-0980-a5029fe8faa7@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Fri, 16 Oct 2020 11:37:38 -0300") Message-ID: <87361vn915.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 30 Oct 2020 13:22:23 -0000 * Adhemerval Zanella via Libc-alpha: >> +/* Compute the address of the element INDEX of the array at LIBS. >> + Conceptually, this is &LIBS[INDEX], but use ENTRY_SIZE for the size >> + of *LIBS. */ >> +static inline const struct file_entry * >> +_dl_cache_file_entry (const struct file_entry *libs, size_t entry_size, >> + size_t index) >> +{ >> + return (const void *) libs + index * entry_size; >> +} >> + > > Although pointer arithmetic with void *is valid for gcc, I think we should > use uintptr_t here. Do you mean char *? It will need another cast for the result. I don't think it clarifies matters. >> +{ >> + /* Used by the HWCAP check in the struct file_entry_new case. */ >> + uint64_t platform = _dl_string_platform (GLRO (dl_platform)); >> + if (platform != (uint64_t) -1) >> + platform = 1ULL << platform; > > Maybe UINT64_C(1) << platform? 1ULL needs to be at least 64 bits, so this should be fine. >> + >> + best = string_table + lib->value; >> + >> + if (flags == GLRO (dl_correct_cache_id)) >> + /* We've found an exact match for the shared >> + object and no general `ELF' release. Stop > > Should we replace the grave accent with apostrophe in this case? I want to minimize the changes in this refactoring. >> diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h >> index b154740da9..fec209509d 100644 >> --- a/sysdeps/generic/dl-cache.h >> +++ b/sysdeps/generic/dl-cache.h >> @@ -66,8 +66,8 @@ >> */ >> struct file_entry >> { >> - int flags; /* This is 1 for an ELF library. */ >> - unsigned int key, value; /* String table indices. */ >> + int32_t flags; /* This is 1 for an ELF library. */ >> + uint32_t key, value; /* String table indices. */ >> }; >> > > Ok, although not sure if our code guidelines allows multiple fields in the > same line. Likewise. I'll assume your Reviewed-by: stands and push this separately. Thanks, Florian -- Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243, Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill