From nobody Fri Apr 19 14:55:44 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VLd4K3MsVz5HC76; Fri, 19 Apr 2024 14:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VLd4K1894z4MTS; Fri, 19 Apr 2024 14:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713538545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y5L1RpnsYN4bMhRCCArVxAckGt6IuBhl//+fTZflG/U=; b=p+Ux2OFAmhNioZ0vLwJWudC/LGd1AJ5TY3m8tszk3SmMTzPxycg2hBc2Rb9MsLCfubaPsl z2+m6a52qXPbmAG4WDNZd4vOjQitsyaIFuR6vROa0itN7T3SjaAdgZ4QR5F2mS5i8EJkGN jnC3aVmsGha7w1VMh7L0UTAESCIAdvzbxywAr3x0ObojGdiyHhq7rpzNSP5sCSY06Gw0G2 g0fImcoqq9OxaFsLgbbr96LSq6ZnU/LGyWajYABJLqNSYApA9VV/cWpuCELj4N73XdG+pY eDL3ZmrVtS4AD8rhiJezL1lED8CbGONTpaDUbg5joaEBkFhs5SQL6UznGlIk5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713538545; a=rsa-sha256; cv=none; b=jVe2gAcQVkYQQmS/JPMYgVWq41X3BOjmp32IegRy7kwq4akV/po7zk/B9Tz8qHp/jyu1WE mXa8y5pzFcokg85gMR8rEnYCUsZqOL/iOMM0ECdzCCKI8yQGBkbQxbAsej6trPxV9W6nyX FMWbHvPMoeaMeagvf/NPhAuIurWsyA0ftP9HGxQ31UbtAJ2sAJZ7xvNSPJnvmNhmlVtS7l 3fR29Oit2KW6c+Cx1h+LnTNP0cyzdg25PJZ2aKHRUt2eWHFgCYUEIfncVMVGxpVy0fa/za k9PkRlqHkmwWMhwGKMuO+ZbiFg5v4Yv+RjQGZwPv40+N2j7Wkikq+/J8d5cxdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713538545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y5L1RpnsYN4bMhRCCArVxAckGt6IuBhl//+fTZflG/U=; b=Azu0oxt28akOJrysCphTDmFzI6GakVNRyrsC+mfYXp4hQxtP7+aGNUq/72f1zIYbYNPgOH at8pyiD0a0cV6iiDZNhOIiP+tl6tvFQE/VdsobxBOlHGiCpuSjT8nF6PcZz454ZU9H7t/n 6DMnl/dtqX+VM9ArWNE6HFEhVXJvR6xOXBy1lZlVDkWkg3EYZ2xnLugnj0lz0gM44Iy9f/ sMNumouIpKDNnzwkcESNH2Xc74/wfljKP0G3sDEVJYmz7Zimp8WbcE7Ht4MMiNvLjtu4Pz +za7HCHXil3XeNbT4Hb4bCnB7eN0ieKjKiimVz2emxfUPXu9RbHmoWs+pKZ5sA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VLd4K0kxpzxSx; Fri, 19 Apr 2024 14:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43JEtjFT014184; Fri, 19 Apr 2024 14:55:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43JEtipf014181; Fri, 19 Apr 2024 14:55:44 GMT (envelope-from git) Date: Fri, 19 Apr 2024 14:55:44 GMT Message-Id: <202404191455.43JEtipf014181@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan =?utf-8?Q?E=C3=9Fer?= Subject: git: 6b13e4cb3da2 - main - ldconfig: small optimization List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b13e4cb3da28be82f9d3b8bd98e229ae107c73a Auto-Submitted: auto-generated The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=6b13e4cb3da28be82f9d3b8bd98e229ae107c73a commit 6b13e4cb3da28be82f9d3b8bd98e229ae107c73a Author: Stefan Eßer AuthorDate: 2024-04-19 14:29:12 +0000 Commit: Stefan Eßer CommitDate: 2024-04-19 14:47:19 +0000 ldconfig: small optimization Swap which side of a comparison is byte-swapped by be32toh() on little-endian architectures. The be32toh() macro just returns the operand and big-endian architectures and returns it byte-swapped on little-endian architectures. When operating on a constant argument, the compiler can perform the swap operation at build time instead of swapping the data read from the hints file at run time. Reviewed by: kib Tested by: tuexen MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D44734 --- sbin/ldconfig/elfhints.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/ldconfig/elfhints.c b/sbin/ldconfig/elfhints.c index d6ee5e0918d6..64b3f916ba8d 100644 --- a/sbin/ldconfig/elfhints.c +++ b/sbin/ldconfig/elfhints.c @@ -220,7 +220,7 @@ read_elf_hints(const char *hintsfile, bool must_exist, bool force_be) close(fd); hdr = (struct elfhints_hdr *)mapbase; - is_be = be32toh(hdr->magic) == ELFHINTS_MAGIC; + is_be = hdr->magic == htobe32(ELFHINTS_MAGIC); if (COND_SWAP(hdr->magic) != ELFHINTS_MAGIC) errx(1, "\"%s\": invalid file format", hintsfile); if (force_be && !is_be)