[PATCH v1 0/5 Add support for CRC64 generation in linker
binutils@emagii.com
binutils@emagii.com
Fri Feb 17 13:54:41 GMT 2023
Here is the first patchset for introducing CRC64 generation in the linker
Supports the following new linker commands:
* CRC64 ECMA '(' crc_start ',' crc_end ')'
* CRC64 ISO '(' crc_start ',' crc_end ')'
* CRC64 POLY '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
* CRC64 POLYI '[' mustbe_exp ']' '(' crc_start ',' crc_end ')'
* CRC64 TABLE
ECMA == 0x42F0E1EBA9EA3693
ISO == 0xD800000000000000
POLY == Allows your own polynome
POLYI == Allows your own polynome, with inversion during calc
The CRC is calculated from crc_start to crc_end (not included)
The "CRC64 <polynome> command
* Allows specifying the polynom (ECMA(default), ISO or your own)
* Allows for inversion in the CRC calculation (CRC64-WE)
* Allows specifying the area that should be checked.
* reserves room for the CRC (8 bytes)
* Declares a symbol ___CRC64___ for the address of the CRC.
* Declares a symbol ___CRC64_START___ for the first address of the checked area
* Declares a symbol ___CRC64_END___ for the first address after the checked area
The symbols names are declared in "checksum.h".
If the names are unsuitable, it is easy to change.
The CRC TABLE command
This is used to speed up the CRC calculation.
* Creates a 2kB table which speeds up the CRC calculation
* Can insert the 2kB table into the .text section at current location.
* Declares a symbol ___CRC64_TABLE___ if the table is inserted.
Comments on the code:
This version also supports the
* DEBUG ON
* DEBUG OFF
turning on/off yydebug
I find it useful for debugging the build, but it can easly be removed.
This patch contains a lot of debug output, that is enabled by
#define DEBUG_CRC 1
This should be removed in the final version.
The ld.texi stuff needs some more work. Not very experienced with that.
Added an entry in NEWS
Added 4 test cases for the different CRC64 polynome commands.
All testcases generate a CRC table.
The code is using the libcrc released under an MIT license found in
* https://www.libcrc.org/
* https://github.com/lammertb/libcrc/tree/v2.0
Author: Lammert Bies
A license for libcrc is added to the patch.
[PATCH v1 1/5] ldlex.l: CRC64
[PATCH v1 2/5] ldgram.y: CRC64
[PATCH v1 3/5] Calculate CRC64 over the .text area
[PATCH v1 4/5] CRC64 commands documentation
[PATCH v1 5/5] CRC64 testsuite
More information about the Binutils
mailing list