From nobody Tue Jul 30 15:55:57 2024 X-Original-To: dev-commits-src-branches@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 4WYKZk150dz5RSQr; Tue, 30 Jul 2024 15:55:58 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WYKZk0ddxz45HS; Tue, 30 Jul 2024 15:55:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722354958; 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=p4bA05huwTWy/u6lkTZvDNrZ/XEeZLwYrHZCDoWzAaY=; b=V7A5BZOe6f3GZpLKw+BxLRderl/p/og4sm3T+DNQw+4rXDuXT749ed6h0WdjyJOdWp/sPf Su9M7UuYOEFHIGIaSPy5Qx68OYsyiTe010hmaMjbKzoZmzmW/7NkYyrnTqy/ws09j3bzsw qR6M+tDwKiVv4t0iHY75/MTUKEylj5zx3mfamc7YINkdiTW18VVMX19Gb+2koDoYyS8Nc8 vqIzIoq47B6cQsINCTfxqgiE6XE6WC9abd0hh+Knwif8uAYqazB2gNYdUA/QtGXVvxs2++ 2S8Nrx+t7NoPyeXvj75Hc+NzOz0KxxPvVUDLKzE+r/bEmh7rhQfFySB/eOdfhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722354958; a=rsa-sha256; cv=none; b=lr4FZ8o9/K498CBH/uQYp9itYybH3KctltiDuUcC2sK/MkSGEY9T/fyU9j0EIwWGW0oZw1 h2AGydJAfaSSSxzphoioD8S0OBgh3Fqoa9bSGkrc9W+zalkeCySvcvNLhot9I162D7qQIO Ai8cp0E5zu+OwUWlYqWZ7IrCsp+fUSl9ikyjeRddhv1WARV+nDSayhIjI0wwwO5yNIxuB4 myMfCUL/Cox/tHspnjVNCoGP+XShTt6APUVKmMsKzdajhv1iZLn6OZadLSxhgPrUDCBP1V BTi/JzsEK+0R0GqNjZq1XZh+ezWU5s6ShwWVZ47Q1QSQLlvleMF/FqCH+mz5fw== 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=1722354958; 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=p4bA05huwTWy/u6lkTZvDNrZ/XEeZLwYrHZCDoWzAaY=; b=T+giCWyzzU8RBgy3DOx1fOcmUIg2qaLbUJsjaEmjR2whz6lRBmVVU9tQauyaSYcETzcPs6 hLQVQzEBbL6DOrsI8JC5+6hotRB1WD+4TzMXYo3zOLt2UurrrRL2bE5ysMQL2L69qOt1L2 61NRXEDiFP48bcgoHc5F1wefky5T1PmYbIjXLCLq8XhLAcJqzKraio509xUfl5jTsR+myp +DghzuITwf2i/Fps0a8krBZl/PfFfWPi4nvZGzQfFEPJFaX3soScczEkP6BRU2s7LZ6Wn3 +2Z27e94ljLmXYcX8YWtmd2yZj4HquvXv0PFelRK2kVUfH8tEYmdZAhKK0wj+Q== 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 4WYKZk0F3QzPHl; Tue, 30 Jul 2024 15:55:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46UFtvjG082637; Tue, 30 Jul 2024 15:55:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46UFtvdL082634; Tue, 30 Jul 2024 15:55:57 GMT (envelope-from git) Date: Tue, 30 Jul 2024 15:55:57 GMT Message-Id: <202407301555.46UFtvdL082634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5437ef1dc12d - stable/14 - libdtrace: Compute the relocation offset for all non-ET_REL objects List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5437ef1dc12db8e34ecaf82b45be6255230ed5ba Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5437ef1dc12db8e34ecaf82b45be6255230ed5ba commit 5437ef1dc12db8e34ecaf82b45be6255230ed5ba Author: Mark Johnston AuthorDate: 2024-07-10 21:21:54 +0000 Commit: Mark Johnston CommitDate: 2024-07-30 15:55:32 +0000 libdtrace: Compute the relocation offset for all non-ET_REL objects The use of an ifdef here most likely carries over from when the dtrace port only worked on x86 platforms. MFC after: 2 weeks Sponsored by: Innovate UK (cherry picked from commit 7bbcbd43c53b49360969ca82b152fd6d971e9055) --- .../opensolaris/lib/libdtrace/common/dt_module.c | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c index 6fb9b0f84769..2a0386c33124 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -1251,19 +1251,21 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) * [Text][R/O data][R/W data][Dynamic][BSS][Non loadable] */ dmp->dm_text_size = dmp->dm_data_va - dmp->dm_text_va; -#if defined(__i386__) - /* - * Find the first load section and figure out the relocation - * offset for the symbols. The kernel module will not need - * relocation, but the kernel linker modules will. - */ - for (i = 0; gelf_getphdr(dmp->dm_elf, i, &ph) != NULL; i++) { - if (ph.p_type == PT_LOAD) { - dmp->dm_reloc_offset = k_stat->address - ph.p_vaddr; - break; + + if (!is_elf_obj) { + /* + * Find the first load section and figure out the relocation + * offset for the symbols. The kernel module will not need + * relocation, but the kernel linker modules will. + */ + for (i = 0; gelf_getphdr(dmp->dm_elf, i, &ph) != NULL; i++) { + if (ph.p_type == PT_LOAD) { + dmp->dm_reloc_offset = + k_stat->address - ph.p_vaddr; + break; + } } } -#endif if (dmp->dm_info.objfs_info_primary) dmp->dm_flags |= DT_DM_PRIMARY;