From patchwork Thu Oct 3 02:26:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98299 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4792A386544F for ; Thu, 3 Oct 2024 02:26:51 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 0071D3858C48 for ; Thu, 3 Oct 2024 02:26:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0071D3858C48 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0071D3858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922390; cv=none; b=Rv0jlMOyNyqY16ICc+/Q4/iYHaoGJ0og4SzK4UXbEQmCJEnfRUsNQC/d8ru5Z+Jeadn/zxSs+Z+3cDzchqVn/FYXZnGUMUeOge26g0xHBArLTsAoR27OfmImas+6RpjnoJYXf/TthY13G+qkPI4wUnzb3s9arOeto9fOOzgqcRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922390; c=relaxed/simple; bh=byWtwlHhIhLpxX6rYB3MGBSB36cgTKq3Xm4086UXaq0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OZqbU+iK4KlA20NUOGLb5+us+QF/8t5d7wauJ0kg9GYdUSjtcHz3KVG/ypSy0oizXiDFgS5pZb23nmaKnMpRdOlCQxdqVzg3L8qxnG6XRhCUk5/AMVtZl3e3jmybkadHQmcBpAu9Gl/CrMyb8teWjVpVDVWQ5xkqQ015k4tn0Bc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t8Y8JPcqn4OA8Li5lVCIxBkvgMo1maSDheZ1ZqrgR7Y=; b=Fq4+ENDDduEP/VnvYeFxI4uvrevlm3dcG+TKsvRwthw/3JZSZ8U36VCayGs32yuktKS603 GpPz1v5Cb89wBCa7XqTayeY5ZkJ9h4F8azHl9nJYEzONXt0As5Zzk14h8YUM7Mo4dlDQtq laVtgXirqWLtbpSkDzDqWRw9IgrkhcU= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-691-Ntwtz1o6Mc6WTzbnhTDkBg-1; Wed, 02 Oct 2024 22:26:22 -0400 X-MC-Unique: Ntwtz1o6Mc6WTzbnhTDkBg-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C2808195608C for ; Thu, 3 Oct 2024 02:26:21 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CE2E819560A3; Thu, 3 Oct 2024 02:26:20 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 1/9 v2] doc: Add elf32_checksum.3 and elf64_checksum.3 Date: Wed, 2 Oct 2024 22:26:02 -0400 Message-ID: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Aaron Merey --- v2 changes: elf64_checksum.3 now refers to elf32_checksum.3. Explained which sections are used to calculate the checksum. Mentioned DT_CHECKSUM. Mentioned that the checksum is a 4-byte value that might be zero-extended. doc/elf32_checksum.3 | 60 ++++++++++++++++++++++++++++++++++++++++++++ doc/elf64_checksum.3 | 1 + 2 files changed, 61 insertions(+) create mode 100644 doc/elf32_checksum.3 create mode 100644 doc/elf64_checksum.3 diff --git a/doc/elf32_checksum.3 b/doc/elf32_checksum.3 new file mode 100644 index 00000000..ab707f15 --- /dev/null +++ b/doc/elf32_checksum.3 @@ -0,0 +1,60 @@ +.TH ELF32_CHECKSUM 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_checksum, elf64_checksum \- compute the checksum for a 32-bit or 64-bit +ELF object file + +.SH SYNOPSIS +.nf +.B #include + +.BI "long int elf32_checksum(Elf *" elf ");" +.BI "long int elf64_checksum(Elf *" elf ");" + +.SH DESCRIPTION +Compute a checksum for the ELF object file referred to by +.IR elf . +The checksum is computed from permanent parts of the ELF file and +the result is repeatable. To be repeatable, strippable sections are +not included in computing the checksum. +.B SHT_NOBITS +sections are also not included when computing the checksum. The checksum +can be used as a value for +.BR DT_CHECKSUM . + +.SH PARAMETERS +.TP +.I elf +The ELF object file for which the checksum is to be computed. + +.SH RETURN VALUE +On success, return the computed checksum. If an error occurs, return -1 +and set a libelf error code. The checksum is always calculated a 4-byte +value. If +.I long int +is larger than 4 bytes, then the checksum will be extended by padding +with zeros. + +.SH SEE ALSO +.BR elf_errno (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_checksum (), +.BR elf64_checksum () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_checksum.3 b/doc/elf64_checksum.3 new file mode 100644 index 00000000..16d3cc24 --- /dev/null +++ b/doc/elf64_checksum.3 @@ -0,0 +1 @@ +.so man3/elf32_checksum.3 From patchwork Thu Oct 3 02:26:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98300 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 82CFC385DDDD for ; Thu, 3 Oct 2024 02:27:10 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 2DDC5385840A for ; Thu, 3 Oct 2024 02:26:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2DDC5385840A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2DDC5385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922402; cv=none; b=Lm/GdjTc021CHPYG+noSkbOBzvecCZtzDi/ajYn3v/bA0AddkGJ3hdp+e1DSNTh3in5+dGGxdrDGHqcemcrF6Aa0X/NfcEOMiSBSOp5g/ip99v1qgpylFZAfIJQrJQaETNgWU2k51IKSe8WL7AI/F7bvETjSyIUAax7YrE2WSQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922402; c=relaxed/simple; bh=x4vt0jeHSBjWr201YtDA98sYBPkoi+QaS49mHS3kWns=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=mvowt6Y3GgC7QpSPzrta207GuCd7pDj98Ri2NKI7nmfAUE17SP0377CjvX3IZ+HGGOkq+TOEanCgRGmLyfHmmx/f5JjhghvtbZ7qW7cm+TFRxzKLGnCwd/7N84l2ANkmG3rXWDqihwBlVH7wA8HL0066kNoF+CMatWmja57cEc4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g1wUsO0yd9ohP/m8nxDoJIpEhtPNYO2e4mIhn07bRq8=; b=R9bPPtbIAcsUj4nNBGphG7ytilSOB0hv+/wrug7tiyLebvXTM7VQ+xCl7BWzWXeMZ/ZmDP qeN+timUVpBfy0DMmXnhelSU0JL+6YHrgYKizpSQ4M++nhbcjB4GN8y40+hBYOl5T/mIYv mF5bXkTa6lBOZWtxBgijKd0MncDLYcg= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-KH-aJ0WvMmWXosTp13EQww-1; Wed, 02 Oct 2024 22:26:29 -0400 X-MC-Unique: KH-aJ0WvMmWXosTp13EQww-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5865219560AE for ; Thu, 3 Oct 2024 02:26:26 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5B75219560A3; Thu, 3 Oct 2024 02:26:24 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 2/9 v2] doc: Add elf32_fsize.3 and elf64_fsize.3 Date: Wed, 2 Oct 2024 22:26:03 -0400 Message-ID: <20241003022610.129834-2-amerey@redhat.com> In-Reply-To: <20241003022610.129834-1-amerey@redhat.com> References: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Aaron Merey --- v2 changes: Reword description. State EV_CURRENT is the only valid version. Mention possibility of integer overflow. On Tue, Aug 27, 2024 at 12:32 PM Mark Wielaard wrote: > > Maybe give at least some examples of Elf_Type and which data structure > they represent? ELF_T_ADDR (32 bit address), ELF_T_EHDR (Elf32_Ehdr), > etc. > > And mention that elf_getdata will set the Elf_Data d_type to the > Elf_Type of the section? I added "See libelf(3) for more information regarding Elf_Type" to the description. This man page doesn't exist yet but I will add it and include a list of the different Elf_Type and its relationship to Elf_Data. doc/elf32_fsize.3 | 78 +++++++++++++++++++++++++++++++++++++++++++++++ doc/elf64_fsize.3 | 1 + 2 files changed, 79 insertions(+) create mode 100644 doc/elf32_fsize.3 create mode 100644 doc/elf64_fsize.3 diff --git a/doc/elf32_fsize.3 b/doc/elf32_fsize.3 new file mode 100644 index 00000000..a0aac70e --- /dev/null +++ b/doc/elf32_fsize.3 @@ -0,0 +1,78 @@ +.TH ELF32_FSIZE 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_fsize, elf64_fsize \- calculate the file size of an ELF data structure + +.SH SYNOPSIS +.nf +.B #include + +.BI "size_t elf32_fsize(Elf_Type " type ", size_t " count ", unsigned int " version ");" +.BI "size_t elf64_fsize(Elf_Type " type ", size_t " count ", unsigned int " version ");" + +.SH DESCRIPTION +Given an +.B Elf_Type +representation of a core ELF structure as well as the number of items, return +the number of bytes needed for the on-disk representation in a 32-bit or 64-bit +ELF file. The on-disk and in-memory representations of +.B Elf_Type +are assumed to be the same. See +.BR libelf (3) +for more information regarding +.BR Elf_Type . + +.SH PARAMETERS +.TP +.I type +The ELF data structure type for which the file size is to be calculated. + +.TP +.I count +The number of elements of the specified type. + +.TP +.I version +The ELF version. This should be set to +.BR EV_CURRENT , +which is the only valid value. + +.SH RETURN VALUE +The size in bytes of the specified count and type of data structure. +If version is not set to +.B EV_CURRENT +or +.I type +is not a valid +.BR Elf_Type , +return 0 and set a libelf error code. Integer overflow can occur if +the size of +.I type +multiplied by +.I count +is greater than +.BR SIZE_MAX . + +.SH SEE ALSO +.BR elf_errno (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_fsize (), +.BR elf64_fsize () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_fsize.3 b/doc/elf64_fsize.3 new file mode 100644 index 00000000..178152ec --- /dev/null +++ b/doc/elf64_fsize.3 @@ -0,0 +1 @@ +.so man3/elf32_fsize.3 From patchwork Thu Oct 3 02:26:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98305 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F9D7385DDCA for ; Thu, 3 Oct 2024 02:28:38 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id DD7FB385DDC1 for ; Thu, 3 Oct 2024 02:26:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD7FB385DDC1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DD7FB385DDC1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922403; cv=none; b=WID5n3iDyPMITucH/G/ysxR4NMppEx1/uPYAeFGC5M4IGIxBPhz9C+DQxL8idRJ5Qn27L7bjWep5IVHeiHik5QqYv1cBCdFqULddj8nDx5YRR/jA0p8AJ0MZ29JZu3swsIphbTShW9Su8lC/HSes2pWa5ePUE1zVwBl30l1xn6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922403; c=relaxed/simple; bh=iu716DWj7YnESJVzVztSQubpm4o2PQ801i6js+BXsos=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=eEt2MzL/Vy2pQbdje3x0xAP6FlBBYh6BH1DAkidJYaPSbJYvmvwaiZ0OAzcm0I0rdURWtzdCASOZaH/slMyT8dM52j6/EQftnKKwOE+zrPHYy6XFQOEad+8v+7xffr+fKG3gVjOBKP1TprLYYjaQnwfY/c+NRwLElcebDqOJyZo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XF+leGKvLFaRNxRGRrFsHN/xfE3S5pi4K7SPwnaeoPQ=; b=Hsza3Su4l/nTcTqV9T4jlp8spwQP1jR2BgmKA9bUp56ypGABS+QYf8iwmBBSwr3BIEm8gL c4epy2crxLES1tdfTPNHz5CD7Cgvf2HrI51Pb6up+2kVanHS2idkVCQKlLDLhHNjYmQfCr zK7PpS2ouYkPS6BnwQh0/9CaC1nuSDM= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-oqXfPgeTMW-IZWzgrtkqZA-1; Wed, 02 Oct 2024 22:26:32 -0400 X-MC-Unique: oqXfPgeTMW-IZWzgrtkqZA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 68E5E19560AF for ; Thu, 3 Oct 2024 02:26:27 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6C8B919560A3; Thu, 3 Oct 2024 02:26:26 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 3/9 v2] doc: Add elf32_getchdr.3 and elf64_getchdr.3 Date: Wed, 2 Oct 2024 22:26:04 -0400 Message-ID: <20241003022610.129834-3-amerey@redhat.com> In-Reply-To: <20241003022610.129834-1-amerey@redhat.com> References: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Aaron Merey --- v2 changes: Mention that SHF_COMPRESSED must be set. Add elf_compress (3) to SEE ALSO. Remove "This elfutils libelf function may not be found in other libelf implementations". On Tue, Aug 27, 2024 at 1:23 PM Mark Wielaard wrote: > > It should also mention what the Elf32_Chdr structure looks > like and what the meaning the fields have. What the legal values of > ch_type are, that ch_size is the uncompressed section data size, and > that ch_addralign is the alignment of the uncompressed data. I will include this information in the upcoming libelf man page. doc/elf32_getchdr.3 | 60 +++++++++++++++++++++++++++++++++++++++++++++ doc/elf64_getchdr.3 | 1 + 2 files changed, 61 insertions(+) create mode 100644 doc/elf32_getchdr.3 create mode 100644 doc/elf64_getchdr.3 diff --git a/doc/elf32_getchdr.3 b/doc/elf32_getchdr.3 new file mode 100644 index 00000000..f7f35c96 --- /dev/null +++ b/doc/elf32_getchdr.3 @@ -0,0 +1,60 @@ +.TH ELF32_GETCHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_getchdr, elf64_getchdr \- retrieve the compression header for a +section from a 32-bit or 64-bit ELF object file. + +.SH SYNOPSIS +.nf +.B #include + +.BI "Elf32_Chdr *elf32_getchdr(Elf_Scn *" scn ");" +.BI "Elf64_Chdr *elf64_getchdr(Elf_Scn *" scn ");" + +.SH DESCRIPTION +Retrieve the compression header for a section with compressed data. +Sections with compressed data are indicated with the +.B SHF_COMPRESSED +flag. See +.BR libelf (3) +for more information regarding the compression header. + +.SH PARAMETERS +.TP +.I scn +Section whose compression header will be retrieved. The section's +.B SHF_COMPRESSED +flag must be set. + +.SH RETURN VALUE +On success, return a pointer to the compression header. On failure, +return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_compress (3), +.BR elf_errno (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_getchdr (), +.BR elf64_getchdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. + +.SH HISTORY +.B elf32_getchdr +first appeared in elfutils 0.165. diff --git a/doc/elf64_getchdr.3 b/doc/elf64_getchdr.3 new file mode 100644 index 00000000..fa49616b --- /dev/null +++ b/doc/elf64_getchdr.3 @@ -0,0 +1 @@ +.so man3/elf32_getchdr.3 From patchwork Thu Oct 3 02:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98302 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D15B7385828B for ; Thu, 3 Oct 2024 02:27:37 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 0E0DB385DDC6 for ; Thu, 3 Oct 2024 02:26:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0E0DB385DDC6 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0E0DB385DDC6 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922402; cv=none; b=wlyGY+1IY1qUPQFto/rIMnUgwss5mXTNcOAEuHWHV/A5oudAQXgZ/iDPARR15oGMN0jzpcM2dFLmyHsU/dkSPgKgyLD5SMtogux9PrsnADaSAc7Vn3n8GiG8cGy2cJdlSVVtqP4evbqMp1cvunp4V52Cx2LWHrCQu+LhzYGc0yI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922402; c=relaxed/simple; bh=JuQf8Ugw8nbh9OiGyaDscZ46MESyabr92OrNU8NK2EQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jyuVEZkMQV1tKAPiZ8XqEIywJAjn3/b9tT7vT1IT+aQf0FwhkLLnhMCXFldW6SD6FBZs1YaTffYjMBFKx+mYbocSuV2qqjApUNksDI+AOA4fKOn58demxbzzhOxxuIjEHP6HxbWbkpobLtmA8zNyDVdOhLnakrvrEQ9J68obQYM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nnQE20DW9CNVwBv4uRTrz30Sqx/7y4X+hm4kkaD57H8=; b=JgPzxBlPXHHy63MgQ5uD1DsdY5YIcFFvg9bzmet0ueJWaWtcbhkFZJQfiL18hbfYPWUrAt KZ7bSaR/yXVgYGTsB8yN4ec6CDPGxoZgXUFsRXW0RT1U6oqBk1rBZ/dq/keOz7ZmApSLWz koJcswbjXET+oQfxUHWlbUF3FMV5uVo= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-XGxlIF7rOHmDPGtZSklmyw-1; Wed, 02 Oct 2024 22:26:32 -0400 X-MC-Unique: XGxlIF7rOHmDPGtZSklmyw-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 551C519560B6 for ; Thu, 3 Oct 2024 02:26:28 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8100119560A3; Thu, 3 Oct 2024 02:26:27 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 4/9 v2] doc: Add elf32_getphdr.3 and elf64_getphdr.3 Date: Wed, 2 Oct 2024 22:26:05 -0400 Message-ID: <20241003022610.129834-4-amerey@redhat.com> In-Reply-To: <20241003022610.129834-1-amerey@redhat.com> References: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Aaron Merey --- v2 changes: Improved description. Mention that NULL is returned if there is no program header. Add elf_getphdrnum and elf32_newphdr to SEE ALSO. doc/elf32_getphdr.3 | 66 +++++++++++++++++++++++++++++++++++++++++++++ doc/elf64_getphdr.3 | 1 + 2 files changed, 67 insertions(+) create mode 100644 doc/elf32_getphdr.3 create mode 100644 doc/elf64_getphdr.3 diff --git a/doc/elf32_getphdr.3 b/doc/elf32_getphdr.3 new file mode 100644 index 00000000..5e9fe2dd --- /dev/null +++ b/doc/elf32_getphdr.3 @@ -0,0 +1,66 @@ +.TH ELF32_GETPHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_getphdr, elf64_getphdr \- retrieve the program header table for a +32-bit or 64-bit ELF object file + +.SH SYNOPSIS +.nf +.B #include + +.BI "Elf32_Phdr *elf32_getphdr(Elf *" elf ");" +.BI "Elf64_Phdr *elf64_getphdr(Elf *" elf ");" + +.SH DESCRIPTION +Retrieve the program header table for the given ELF descriptor +.IR elf . +The number of elements in the program header table can be retrieved with +.B elf32_getphdrnum +and +.BR elf64_getphdrnum . +.B elf32_newphdr +and +.B elf64_newphdr +change the size of the program header table or to delete it. +If changing an element of the program header table, you must +call elf_flagphdr with +.B ELF_C_SET +and +.B ELF_F_DIRTY +in order to write the new data to disk. + +.SH PARAMETERS +.TP +.I elf +ELF descriptor from which to retrieve the program header table. + +.SH RETURN VALUE +On success, return a pointer to the program header table. Return NULL if +there is no program header. On failure, return NULL and set a libelf +error code. + +.SH SEE ALSO +.BR elf32_newphdr (3), +.BR elf_errno (3), +.BR elf_getphdrnum (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_getphdr (), +.BR elf64_getphdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_getphdr.3 b/doc/elf64_getphdr.3 new file mode 100644 index 00000000..3301d1e9 --- /dev/null +++ b/doc/elf64_getphdr.3 @@ -0,0 +1 @@ +.so man3/elf32_getphdr.3 From patchwork Thu Oct 3 02:26:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98303 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 328C2385DDCC for ; Thu, 3 Oct 2024 02:28:08 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id A4C2E385C6D3 for ; Thu, 3 Oct 2024 02:26:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4C2E385C6D3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A4C2E385C6D3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922402; cv=none; b=snzgZ3j9WQNrJF6Y5CXtLW7FmbmiJ9JSB+wt23Bst8zpIRoI4xhLV67hOplVjI0TUwQdq9Lv3i5Zca1Xc20s7lE56u8piXvMtaVnTCEb7e9u4sMMjMRCTfRCtrK87gDxwElCP9Z/BZdqYpDfw/WP4KWwKRr+7Yr4uB8o520Z4bY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922402; c=relaxed/simple; bh=zTLmZ9BSWMAxMQdKmb5regHbfaBDZy4Ea9aeb5GIbbo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RwmatyPTvh2Vl+4BTLjW1N/h6xwtS0XkNAcXz6ai1nSNncxJCHp/G32q8Eiyu6wuBnoJcDojiRLfExRzh47mxZD3hOH0OeW8rrt9Oqu8ejiPSqGB1jC0ye/5HpjRFxsit2G/yM3WxBbhdrx4CuX2OIkKcLAL9k8HJ7FRh7mqg4U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qVAP86C0/7TicOVH2qo+//Y1XcpDQsgHOEcH80XKXkE=; b=hlPYZ2bMqKLYTt785h4h26gr6V5hwpScgJ0YeN7H5LFxxuJ+Qm0WKYT5I7F6y2AqyAveC2 HHPDJAnX80MTX7S2dFodkEAE7M7y5sA+X3Ye0y18N1a0mM7upSE5ckTHDRyfwxfNoqALsU L2rAXFRdXjpKDgKgaBVxoh1ybWS2xKY= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-421-XMkdCUoZPYGHGUL6PvlkCA-1; Wed, 02 Oct 2024 22:26:30 -0400 X-MC-Unique: XMkdCUoZPYGHGUL6PvlkCA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8D9B219560AD for ; Thu, 3 Oct 2024 02:26:29 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B25C219560A3; Thu, 3 Oct 2024 02:26:28 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 5/9 v2] doc: Add elf32_getshdr.3 and elf64_getshdr.3 Date: Wed, 2 Oct 2024 22:26:06 -0400 Message-ID: <20241003022610.129834-5-amerey@redhat.com> In-Reply-To: <20241003022610.129834-1-amerey@redhat.com> References: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Aaron Merey --- v2 changes: Mention elf_flagshdr. Mention NULL is returned if scn is NULL. doc/elf32_getshdr.3 | 59 +++++++++++++++++++++++++++++++++++++++++++++ doc/elf64_getshdr.3 | 1 + 2 files changed, 60 insertions(+) create mode 100644 doc/elf32_getshdr.3 create mode 100644 doc/elf64_getshdr.3 diff --git a/doc/elf32_getshdr.3 b/doc/elf32_getshdr.3 new file mode 100644 index 00000000..abc8aaeb --- /dev/null +++ b/doc/elf32_getshdr.3 @@ -0,0 +1,59 @@ +.TH ELF32_GETSHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_getshdr, elf64_getshdr \- retrieve the section header for a section +in 32-bit or 64-bit ELF object file + +.SH SYNOPSIS +.nf +.B #include + +.BI "Elf32_Shdr *elf32_getshdr(Elf_Scn *" scn ");" +.BI "Elf64_Shdr *elf64_getshdr(Elf_Scn *" scn ");" + +.SH DESCRIPTION +Retrieve the section header for the section referred to by +.IR scn . +If the retrieved section header is modified, +.B elf_flagshdr +must be called +with +.B ELF_C_SET +and +.B ELF_F_DIRTY +in order to write the modified section header to disk. + +.SH PARAMETERS +.TP +.I scn +The section descriptor whose section header is to be retrieved. + +.SH RETURN VALUE +On success, return a pointer to the section header. If scn is NULL then +NULL will be returned. If an error occurs, return NULL and set a libelf +error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf_flagshdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_getshdr (), +.BR elf64_getshdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_getshdr.3 b/doc/elf64_getshdr.3 new file mode 100644 index 00000000..c0d2410c --- /dev/null +++ b/doc/elf64_getshdr.3 @@ -0,0 +1 @@ +.so man3/elf32_getshdr.3 From patchwork Thu Oct 3 02:26:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98301 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EFDFE3858C48 for ; Thu, 3 Oct 2024 02:27:20 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 39AC7385C6CC for ; Thu, 3 Oct 2024 02:26:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 39AC7385C6CC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 39AC7385C6CC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922402; cv=none; b=mdyH9e0Sqs3s49CSRRESbQ3Jsfw39w2fseXbaGUqY5BjmnbJoP1Orv1IvwWxF2rLKkOnDg/5czLAJNFYup2w9GCvuuJnKnfY84+8MXtvdzUXHqLEiCfA6mN1zNJkXIGphEGzslbN3Hvjkd6XTD6NgKAcDoarB0/zVjj2dOHq6mM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922402; c=relaxed/simple; bh=ZNKGY5T9G6/cfnr0UuyXVPdGTNkClgxT7Ijx+imb3zg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pyop/WWh8K1SPd/PaRdCkxGP4hOWGkyT7L5RCtEsQAkQTC/JO4D4cG4LMWM6WdXayHu51VwG8JKdMs0E0Nm4nhNuyzkCNx4I3Scqp5pF8b2Bom4gFUN6sZxXw9/9+z/QV4t6/Etvb7T7Kdw37cUSmeaM6GA+k0va77bv9sc7QPY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zaY+5TI0k+lMuROgJz8GyPydDNiuEKxfx02MfKmu9iw=; b=AVRkx0B+SbWiIn2mOhbp8LvaoakYOhCTljiq05i0zSvr7RnzdLY+Ka8Bex0iwiYeyaGQaF G2W4uNq6JZjWxOf0P6ub3shpDkIIdzYe+fSAgiFwjePXx1mbvq/uX1EJxYlYZ/ntdaQECP 8Zvinm9i/iXWpcefArhkz/gnCicYdUk= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-K3ZxbwQoOFm1t1tq2p8n9A-1; Wed, 02 Oct 2024 22:26:31 -0400 X-MC-Unique: K3ZxbwQoOFm1t1tq2p8n9A-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF22B1955D48 for ; Thu, 3 Oct 2024 02:26:30 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0A74119560A3; Thu, 3 Oct 2024 02:26:29 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 6/9 v2] doc: Add elf32_newehdr.3 and elf64_newehdr.3 Date: Wed, 2 Oct 2024 22:26:07 -0400 Message-ID: <20241003022610.129834-6-amerey@redhat.com> In-Reply-To: <20241003022610.129834-1-amerey@redhat.com> References: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Aaron Merey --- v2 changes: Mention that the existing header will be returned if one is already present. Mention that an ELF header must be present before callling elf_newscn or elf_newphdr doc/elf32_newehdr.3 | 60 +++++++++++++++++++++++++++++++++++++++++++++ doc/elf64_newehdr.3 | 1 + 2 files changed, 61 insertions(+) create mode 100644 doc/elf32_newehdr.3 create mode 100644 doc/elf64_newehdr.3 diff --git a/doc/elf32_newehdr.3 b/doc/elf32_newehdr.3 new file mode 100644 index 00000000..d5d34547 --- /dev/null +++ b/doc/elf32_newehdr.3 @@ -0,0 +1,60 @@ +.TH ELF32_NEWEHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_newehdr, elf64_newehdr \- create a new ELF header for a 32-bit or +64-bit ELF object file + +.SH SYNOPSIS +.nf +.B #include + +.BI "Elf32_Ehdr *elf32_newehdr(Elf *" elf ");" +.BI "Elf64_Ehdr *elf64_newehdr(Elf *" elf ");" + +.SH DESCRIPTION +This function initializes a new ELF header and associates it with +.IR elf . +If +.I elf +already has an ELF header associated with it, no new header will be created +and the existing header will be returned. An ELF header must be present +before calling +.B elf_newscn +or +.BR elf_newphdr . + +.SH PARAMETERS +.TP +.I elf +ELF descriptor for which a new ELF header is to be created. + +.SH RETURN VALUE +On success, return a pointer to the newly created ELF header. If +.I elf +already has an ELF header associated with it, this pre-existing header is +returned and no new header is created. On failure, return NULL and set a +libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_newehdr (), +.BR elf64_newehdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_newehdr.3 b/doc/elf64_newehdr.3 new file mode 100644 index 00000000..9119d838 --- /dev/null +++ b/doc/elf64_newehdr.3 @@ -0,0 +1 @@ +.so man3/elf32_newehdr.3 From patchwork Thu Oct 3 02:26:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98307 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B54A7385828B for ; Thu, 3 Oct 2024 02:29:01 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 6C7B4385DDCC for ; Thu, 3 Oct 2024 02:26:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C7B4385DDCC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6C7B4385DDCC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922409; cv=none; b=sYZIg7i7HAB1OWFsAb6FXrop4Sgqash0jl13h51oLMwLTJSBdKt1nQ0nKkq/AVvbfYJhEeQikwdBMyCdt/GL93OpabS7mztlMItp/OiJzLKV7JLQU+6Hn3yzLIWC4WsVnsuSrS5zALqjnyhmIUzfujFmi7tqEhsAA9m+c2WEsGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922409; c=relaxed/simple; bh=AB0yJhcz3ths2p6aYNLpm8JplDSZLnwChxYcAzJ6I9Q=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=QB4uBrQPNhA0YeUgqe+xuMD8rYEHvA3gRKa77FIVNNwu5P5vU4pG2fA0Cp4DWlUkL+gOURtK4BaUD/DOR9+W4uRrRk9nBdL/2JLsAxQdibHzvYDW6OXbAsFHQYonFOjH4m7eVryY2EPuH7uhT5QKWBg/Lya/CfQWtuHjNNmbEp8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uQG1vPzgmNERIoJuvwBdWX8xLp15yRgF3jg0iyY58P8=; b=SfBzIU1twbVTFJTVN5PDuS/Wmd7AF+iQLCAL157SJclS0x7eeAlUz8GIVwHiU8e/IITbDn xYRVwEZiJUHo7WsF1mZCOi4lrEY1+nEPmY043nfhbxF/f2mcWZj3Urm+3pILbpFCrP8GJx QCOV1FyfJmo/hfDH62WjJhAuBdT858w= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-SZaHUo6yOLCH40X8XJru2w-1; Wed, 02 Oct 2024 22:26:37 -0400 X-MC-Unique: SZaHUo6yOLCH40X8XJru2w-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3EF06195609F for ; Thu, 3 Oct 2024 02:26:32 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 46B7119560A3; Thu, 3 Oct 2024 02:26:31 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 7/9 v2] doc: Add elf32_newphdr.3 and elf64_newphdr.3 Date: Wed, 2 Oct 2024 22:26:08 -0400 Message-ID: <20241003022610.129834-7-amerey@redhat.com> In-Reply-To: <20241003022610.129834-1-amerey@redhat.com> References: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Aaron Merey --- v2 changes: Mention new program header table is zero'ed out and that NULL is returned if elf is NULL. doc/elf32_newphdr.3 | 72 +++++++++++++++++++++++++++++++++++++++++++++ doc/elf64_newphdr.3 | 1 + 2 files changed, 73 insertions(+) create mode 100644 doc/elf32_newphdr.3 create mode 100644 doc/elf64_newphdr.3 diff --git a/doc/elf32_newphdr.3 b/doc/elf32_newphdr.3 new file mode 100644 index 00000000..9b3ddc91 --- /dev/null +++ b/doc/elf32_newphdr.3 @@ -0,0 +1,72 @@ +.TH ELF32_NEWPHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_newphdr, elf64_newphdr \- create a new program header table for a +32-bit or 64-bit ELF object file + +.SH SYNOPSIS +.nf +.B #include + +.BI "Elf32_Phdr *elf32_newphdr(Elf *" elf ", size_t " count ");" +.BI "Elf64_Phdr *elf64_newphdr(Elf *" elf ", size_t " count ");" + +.SH DESCRIPTION +Create a new program header table for the ELF object file referred to by +.IR elf . +The number of entries in the new program header table is specified by +.IR count . +A +.I count +of zero removes the existing program header table. + +The function allocates a new array of +.B Elf32_Phdr +and makes it the program header table for +.IR elf . +The new program header contents are set to zero and any previous program +header table is discarded. An ELF header must exist before creating a +program header table. + +.SH PARAMETERS +.TP +.I elf +Pointer to the ELF object for which a new program header table is to be created. + +.TP +.I count +The number of entries in the new program header table. A count of zero removes +the existing program header table. + +.SH RETURN VALUE +On success, return a pointer to the first +.B Elf32_Phdr +in the newly created program header table. If +.I elf +is NULL then return NULL. If an error occurs, return NULL and set a libelf +error code. + +.SH SEE ALSO +.BR elf32_newehdr (3), +.BR elf_errno (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_newphdr (), +.BR elf64_newphdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_newphdr.3 b/doc/elf64_newphdr.3 new file mode 100644 index 00000000..86e8ed3c --- /dev/null +++ b/doc/elf64_newphdr.3 @@ -0,0 +1 @@ +.so man3/elf32_newphdr.3 From patchwork Thu Oct 3 02:26:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98306 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 03554385DDE6 for ; Thu, 3 Oct 2024 02:28:42 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 643BD385EC23 for ; Thu, 3 Oct 2024 02:26:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 643BD385EC23 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 643BD385EC23 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922417; cv=none; b=el1JyzoLd9YEi59iFJ2WykhLDWtJqYOudaAfmPpZjOpiUAbiG4ZTATSLnxqo6v5uRajqT8mrc0lC0MxHsjBuAZrx3zWz9SjCmp3xDlDJ/AfAKl6CXUTju7Jo2RCdSlSGUZEqyW9MBs7eKYJCBE3jhfnS7EWV4LKyllPGDs2EhQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922417; c=relaxed/simple; bh=P85Zv6JK6nmyQlkoUOiu+WuBDDFmJqfwufuLOrAfqBg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=aiim/TX9kIXjZvPPGDQU7GcLleLdIyOFtI0BRjZqyuE9ZXNfWaE5YEhqqmupHTLFVvY2XYJzPBWMs0MyE/44qUV+edfAVgYY1tpB5vusB3OlCOmitsAzAGGJEKpjmJhei1DxrsOyO5rpF5zik2HmR55Ii0Fwkv1g4fLIRkawg7U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QIe9dY38I6hBOLKbIgTn7H7X4azI2j5wWrKMizegFaY=; b=KJW6ZUA7maWHM7MRXT2gtcDaRXiPyqpG/4uWhuAJqmBfZCAY7lKvkQk0SmROdd0+J4hgUG 5ZxZNLN3WU7YREsj3Hmn/Uufgrnngr9KxkIlG5fk7Ld/lCrgQ4BbD5iWuVCDigpvw5YSgO OFSEVIX8VTBsAxkdVBtszfuPG2JKacY= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-458-9p7Ds06TMYiUe6JzD27kAg-1; Wed, 02 Oct 2024 22:26:38 -0400 X-MC-Unique: 9p7Ds06TMYiUe6JzD27kAg-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5DBA71956096 for ; Thu, 3 Oct 2024 02:26:33 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6592819560A3; Thu, 3 Oct 2024 02:26:32 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 8/9 v2] doc: Add elf{32, 64}_xlatetof.3 and elf{32, 64}_xlatetom.3 Date: Wed, 2 Oct 2024 22:26:09 -0400 Message-ID: <20241003022610.129834-8-amerey@redhat.com> In-Reply-To: <20241003022610.129834-1-amerey@redhat.com> References: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Aaron Merey --- v2 changes: Merge xlatetof and xlatetom man pages. Added additional details suggested in Mark's review https://sourceware.org/pipermail/elfutils-devel/2024q3/007377.html doc/elf32_xlatetof.3 | 1 + doc/elf32_xlatetom.3 | 130 +++++++++++++++++++++++++++++++++++++++++++ doc/elf64_xlatetof.3 | 1 + doc/elf64_xlatetom.3 | 1 + 4 files changed, 133 insertions(+) create mode 100644 doc/elf32_xlatetof.3 create mode 100644 doc/elf32_xlatetom.3 create mode 100644 doc/elf64_xlatetof.3 create mode 100644 doc/elf64_xlatetom.3 diff --git a/doc/elf32_xlatetof.3 b/doc/elf32_xlatetof.3 new file mode 100644 index 00000000..47ecda27 --- /dev/null +++ b/doc/elf32_xlatetof.3 @@ -0,0 +1 @@ +.so man3/elf32_xlatetom.3 diff --git a/doc/elf32_xlatetom.3 b/doc/elf32_xlatetom.3 new file mode 100644 index 00000000..ec2024fd --- /dev/null +++ b/doc/elf32_xlatetom.3 @@ -0,0 +1,130 @@ +.TH ELF32_XLATETOM 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +.nf +elf32_xlatetom, elf64_xlatetom \- translate 32-bit or 64-bit ELF data from file +representation to memory representation + +elf32_xlatetof, elf64_xlatetof \- translate 32-bit or 64-bit ELF data from memory +representation to file representation + +.SH SYNOPSIS +.nf +.B #include + +.BI "int elf32_xlatetom(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");" +.BI "int elf64_xlatetom(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");" + +.BI "int elf32_xlatetof(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");" +.BI "int elf64_xlatetof(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");" + +.SH DESCRIPTION +Translate ELF data from file representation to memory representation or +vice versa. File and memory representations of ELF data can differ in +terms of endianness. Data in file representation normally comes from +.B elf_rawdata +while data in memory representation normally comes from +.BR elf_getdata . +When there is no difference between file and memory representations, +these functions simply copy the ELF data from +.I src +to +.IR dst . +Otherwise the encoding with swap between +.B ELFDATA2LSB +(two's complement little-endian) and +.B ELFDATA2MSB +(two's complement big-endian). The encoding of an ELF file is specified +in the +.B Elf32_Ehdr +or +.B Elf64_Ehdr e_ident[EI_DATA] +member. To know the memory encoding for a program you can +.B #include +and check BYTE_ORDER == LITTLE_ENDIAN (corresponding to +.BR ELFDATA2LSB ) +or BYTE_ORDER == BIG_ENDIAN (corresponding to +.BR ELFDATA2MSB ). + +.SH PARAMETERS +.TP +.I dst +Destination where the translated data will be stored. +The +.B d_size +of +.I dst +should be at least as big as the +.B d_size +of +.IR src . + +.TP +.I src +Source data. For the +.B xlatetom +functions, the source data should be in file representation. +For the +.B xlatetof +functions, the source data should be in memory representation. + +.TP +.I encoding +Specifies an encoding. Can be either +.B ELFDATA2LSB +(two's complement little-endian) or +.B ELFDATA2MSB +(two's complement big-endian). For the +.B xlatetom +functions, this specifies the encoding of +.IR src . +For the +.B xlatetof +functions, this specifies the encoding of +.IR dst . + +.SH RETURN VALUE +On success, return +.IR dst , +which will contain the translated data. If there is no difference +between the file and memory representations, +.I dst +will contain a copy of the source data. The +.B d_type +and +.B d_size +of +.I dst +will be set to those of +.IR src . + + If an error occurs, return +NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf_getdata (3), +.BR elf_rawdata (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_xlatetom (), +.BR elf64_xlatetom (), +.BR elf32_xlatetof (), +.BR elf64_xlatetof () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_xlatetof.3 b/doc/elf64_xlatetof.3 new file mode 100644 index 00000000..47ecda27 --- /dev/null +++ b/doc/elf64_xlatetof.3 @@ -0,0 +1 @@ +.so man3/elf32_xlatetom.3 diff --git a/doc/elf64_xlatetom.3 b/doc/elf64_xlatetom.3 new file mode 100644 index 00000000..47ecda27 --- /dev/null +++ b/doc/elf64_xlatetom.3 @@ -0,0 +1 @@ +.so man3/elf32_xlatetom.3 From patchwork Thu Oct 3 02:26:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 98304 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F59B385DDD5 for ; Thu, 3 Oct 2024 02:28:10 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id A82E6385DDEF for ; Thu, 3 Oct 2024 02:26:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A82E6385DDEF Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A82E6385DDEF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922411; cv=none; b=GlhdEauO571P4j0sEwED3xGPasU+tLmd7oqURjrS+axUxgFQzvJ7yNMl6ztmixzGDadmrsAokIrLNNde+0Gp2vCg9Y+WS9odwtyHrvQwEM2HC3AO/Gf+hLFJPsSjjcEBw7NLiYMfytxH3x4kCAXYqkhxX+091VvhVsTd4AePdpQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727922411; c=relaxed/simple; bh=dGPhGvSDat+1Cl0FdbufIK//E5cgARHkgvKBtOL/aD8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=H1ImAcQk6nRmklu8KHUFODd79uu4pgnNDug6IdSpXt+LM/uZjo2KLbRhoDGBSdGgYsOMNwSRgLNVgoaPqTFp4uQmZ4ugeQm3oFRBCmaK8qnx4BAygjhROLqMn6alvmdh96lYvbeELhnA6X1G8S84SKxv4Kemof5ei0vQduerI+o= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727922396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wVFq0cT2JNsLSRPq4mlemqG4pBcGGI+osmLMbz4G62s=; b=iWEG3Yn9YbUwH2nhDiugErEfDEQNjATpXiXsdGb2JAcKvvXBlJZpWynSDJRD8SaNzkPYhE gtTNK2Sg3z15xYh9xmvOAa1eLy9UB13ECvE71S5Vg24h3C6YD75ONF9hBxkOlPqlg+1dWv U2ytYpfTpfHeTwEk3xmjTTDKHA/TCvw= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-425-UpWChFRqOBirAM9UJ5boMw-1; Wed, 02 Oct 2024 22:26:35 -0400 X-MC-Unique: UpWChFRqOBirAM9UJ5boMw-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 79B011955F3E for ; Thu, 3 Oct 2024 02:26:34 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.64.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9297D19560A3; Thu, 3 Oct 2024 02:26:33 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH 9/9] doc/Makefile.am: Add man pages Date: Wed, 2 Oct 2024 22:26:10 -0400 Message-ID: <20241003022610.129834-9-amerey@redhat.com> In-Reply-To: <20241003022610.129834-1-amerey@redhat.com> References: <20241003022610.129834-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 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_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org Add the following man pages to notrans_dist_man3_MANS: elf32_xlatetom.3 elf64_xlatetom.3 elf32_xlatetof.3 elf64_xlatetof.3 elf32_newphdr.3 elf64_newphdr.3 elf32_newehdr.3 elf64_newehdr.3 elf32_getshdr.3 elf64_getshdr.3 elf32_getphdr.3 elf64_getphdr.3 elf32_getchdr.3 elf64_getchdr.3 elf32_fsize.3 elf64_fsize.3 elf32_checksum.3 elf64_checksum.3 Signed-off-by: Aaron Merey --- doc/Makefile.am | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 86c1d82d..ceb6fd2d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -39,7 +39,25 @@ notrans_dist_man3_MANS= elf_update.3 \ elf32_offscn.3 \ elf64_offscn.3 \ elf_getscn.3 \ - elf_ndxscn.3 + elf_ndxscn.3 \ + elf32_xlatetom.3 \ + elf64_xlatetom.3 \ + elf32_xlatetof.3 \ + elf64_xlatetof.3 \ + elf32_newphdr.3 \ + elf64_newphdr.3 \ + elf32_newehdr.3 \ + elf64_newehdr.3 \ + elf32_getshdr.3 \ + elf64_getshdr.3 \ + elf32_getphdr.3 \ + elf64_getphdr.3 \ + elf32_getchdr.3 \ + elf64_getchdr.3 \ + elf32_fsize.3 \ + elf64_fsize.3 \ + elf32_checksum.3 \ + elf64_checksum.3 # libdebuginfod man pages (also notrans) # Note we include them even when not building them because we want