From: binutils@emagii.com
To: binutils@sourceware.org
Cc: nickc@redhat.com, Ulf Samuelsson <ulf@emagii.com>
Subject: [PATCH v5 03/10] DIGEST: ld.texi
Date: Wed, 22 Feb 2023 17:16:02 +0100 [thread overview]
Message-ID: <20230222161609.239928-4-binutils@emagii.com> (raw)
In-Reply-To: <20230222161609.239928-1-binutils@emagii.com>
From: Ulf Samuelsson <ulf@emagii.com>
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
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 <polynome> 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 <polynome> 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 <polynome>} 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
next prev parent reply other threads:[~2023-02-22 16:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 16:15 [PATCH v5 0/10 Add support for CRC64 generation in linker binutils
2023-02-22 16:16 ` [PATCH v5 01/10] TIMESTAMP: ldlang: process binutils
2023-02-22 16:16 ` [PATCH v5 02/10] DIGEST: NEWS binutils
2023-02-22 16:16 ` binutils [this message]
2023-02-22 16:16 ` [PATCH v5 04/10] LIBCRC: license binutils
2023-02-22 16:16 ` [PATCH v5 05/10] DIGEST: ldlex.l binutils
2023-02-22 16:16 ` [PATCH v5 06/10] DIGEST: ldgram.y binutils
2023-02-22 16:16 ` [PATCH v5 07/10] DIGEST: Makefile.am: add new files binutils
2023-02-22 16:16 ` [PATCH v5 08/10] DIGEST: CRC-32/64 algorithms binutils
2023-02-22 16:16 ` [PATCH v5 09/10] DIGEST: ldmain.c: add CRC calculation binutils
2023-02-22 16:16 ` [PATCH v5 10/10] DIGEST: testsuite binutils
2023-02-22 18:23 ` [PATCH v5 0/10 Add support for CRC64 generation in linker Ulf Samuelsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230222161609.239928-4-binutils@emagii.com \
--to=binutils@emagii.com \
--cc=binutils@sourceware.org \
--cc=nickc@redhat.com \
--cc=ulf@emagii.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).