From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id 7482A3858296 for ; Wed, 22 Feb 2023 16:16:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7482A3858296 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=emagii.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emagii.com Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id F0A1D12026D; Wed, 22 Feb 2023 17:16:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emagii.com; s=default; t=1677082617; bh=QFEv7rjZ4B6ofh2DrO4WgGx3asK822vIsiUKMC16Enc=; h=From:To:Subject; b=CKVK91ieCOaMPLxB4ZAowWEIDBNnwtWgsFtVARB+7LJ1BKYv4zQOvA/j0kfavN4wR 2cSl4yFfMCThBbb8e2c7hdVMpmgNPnaasIkTtFwiFtpwcfdKCYJOZsLsU9DIDhVMKK FwnOP6VpWuPCb+SIeHPMEHkIGj/lLZqB1/Vidfxg= Authentication-Results: emagii.beebytevps.io; spf=pass (sender IP is 84.55.68.216) smtp.mailfrom=binutils@emagii.com smtp.helo=valinor.ownit.se Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) From: binutils@emagii.com To: binutils@sourceware.org Cc: nickc@redhat.com, Ulf Samuelsson Subject: [PATCH v5 03/10] DIGEST: ld.texi Date: Wed, 22 Feb 2023 17:16:02 +0100 Message-Id: <20230222161609.239928-4-binutils@emagii.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230222161609.239928-1-binutils@emagii.com> References: <20230222161609.239928-1-binutils@emagii.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-PPP-Message-ID: <167708261631.2544257.4976086115200513802@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_FAIL,SPF_PASS,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 List-Id: From: Ulf Samuelsson Signed-off-by: Ulf Samuelsson --- ld/ld.texi | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) diff --git a/ld/ld.texi b/ld/ld.texi index 7802f0661b0..c321d383c0b 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -5394,6 +5394,152 @@ area: ASCIZ "This is 16 bytes" @end smallexample +@cindex output section strings +@kindex DIGEST "CRC64-ECMA" (@var{expression}, @var{expression}) +@kindex DIGEST "CRC64-WE" (@var{expression}, @var{expression}) +@kindex DIGEST "CRC64-ISO" (@var{expression}, @var{expression}) +@kindex DIGEST "CRC32" (@var{expression}, @var{expression}) +@kindex DIGEST POLY (@var{expression}, @var{expression})(@var{expression}, @var{expression}) +@kindex DIGEST POLYI (@var{expression}, @var{expression})(@var{expression}, @var{expression}) + +You can calculate the CRC of a part of the '.text' section through the +@code{DIGEST} command. +The commands take a parameter for the @code{polynome} and then two more, +specifying range of the checked area. The end address is the first address +past the checked area. + +There is one predefined 32-bit polynome + +@enumerate +@item +@code{CRC32} @code{0xEDB88320} +@end enumerate + +There are three predefined 64-bit polynomes + +@enumerate +@item +@code{CRC64-ECMA} @code{0x42F0E1EBA9EA3693} +@item +@code{CRC64-WE} @code{0x42F0E1EBA9EA3693} +@item +@code{CRC64-ISO} @code{0xD800000000000000} +@end enumerate + +You can also select your own @code{polynome} using the @code{DIGEST POLY} or +@code{DIGEST POLYI}. The @code{DIGEST POLYI} will invert the polynome before +and after the calculation which is neccessary for the @code{CRC64-WE} algorithm + +The default 64-bit polynome is the @code{ECMA} + +The 32-bit command defines some global symbols. + +@enumerate +@item +@code{___CRC32___} address of the CRC32 checksum +@item +@code{___CRC32_START___} first address in the checked area. +@item +@code{___CRC32_END___} first address past the checked area. +@end enumerate + +The 64-bit command defines some global symbols. + +@enumerate +@item +@code{___CRC64___} address of the CRC64 checksum +@item +@code{___CRC64_START___} first address in the checked area. +@item +@code{___CRC64_END___} first address past the checked area. +@end enumerate + +Note: The generated CRC value must be stored outside the checked area. + +Example 1: This request a CRC check using the @code{ECMA} algorithm + +@smallexample + CRC = '.'; + DIGEST "CRC64-ECMA" (START_CHECK,END_TEXT) + START_CHECK = '.'; +@end smallexample + +The user can retrieve the CRC value through the @code{CRC} label. + +Example 2: This request a CRC check using the @code{ISO} algorithm + +@smallexample + CRC = '.'; + DIGEST "CRC64-ISO" (START_CHECK,END_TEXT) + START_CHECK = '.'; +@end smallexample + +The user can retrieve the CRC value through the @code{CRC} label. + +Example 3: This request a CRC check using a user defined @code{polynome} + +@smallexample + CRC = '.'; + DIGEST POLY (64, 0xDEADBEEFDEADBEEF) (START_CHECK,END_TEXT) + START_CHECK = '.'; +@end smallexample + +The user can retrieve the CRC value through the @code{CRC} label. + +Example 4: This request a CRC check using a user defined @code{polynome} + The @code{polynome} is inverted before use, and teh result is inverted. + +@smallexample + CRC DIGEST POLYI (64, 0xDEADBEEFDEADBEEF) (START_CHECK,END_TEXT) + START_CHECK = '.'; +@end smallexample + +Example 5: This request a CRC check using the @code{CRC32} polynome + +@smallexample + CRC = '.'; + DIGEST "CRC32" (START_CHECK,END_TEXT) + START_CHECK = '.'; +@end smallexample + +The user can retrieve the CRC value through the @code{CRC} label. + +@cindex output section strings +@kindex DIGEST TABLE + +The @code{DIGEST TABLE} command creates a 1 or 2 kByte table for a table-driven +CRC calculation. This speeds up the CRC calculation over a non-table-driver +version since you can handle 8 bits at a time, instead of 1 bit. + +The table generated is for the @code{polynome} selected using a +@code{DIGEST } command. + +The command will define a symbol base on the size of the polynome + +@enumerate +@item +@code{___CRC32_TABLE___} address of the CRC32 table, or +@item +@code{___CRC64_TABLE___} address of the CRC64 table +@end enumerate + + +Example 1: Generate a 1 kB table + (assuming a previous @code{DIGEST "CRC32"} command + +@smallexample + mytable = '.'; + DIGEST TABLE +@end smallexample + +The user can declare @code{extern uint32_t *mytable;} in his code to use it. + +@cindex output section strings +@kindex TIMESTAMP + +The @code{TIMESTAMP} command creates 64-bit integer with the number of seconds +since Epoch (1970-01-01 00:00) + @kindex FILL(@var{expression}) @cindex holes, filling @cindex unspecified memory -- 2.34.1