[PATCH v4 2/5] CRC64 testsuite

Ulf Samuelsson binutils@emagii.com
Tue Feb 21 15:13:33 GMT 2023


Den 2023-02-21 kl. 13:42, skrev Nick Clifton:
> Hi Ulf,
>
>> diff --git a/ld/testsuite/ld-scripts/crc32-poly.d 
>> b/ld/testsuite/ld-scripts/crc32-poly.d
>
> Did you actually try running these new tests ?
>
No, I am yet to learn how to do the tests
so I hoped that copying the the resulting text segment
would be sufficient, and if not, someone would tell me.

Is there any documentation on how to run the tests?

>
>> +Contents of section .text:
>> + 1100 434f4445 deadbeef 712c8793 0c110000  CODE....q,......
>
> These lines are regular expressions, not exact text matches so,
> for example:
>
>> + 2030 c5648dc3 17584c28 be6054a9 6c5c9542  .d...XL(.`T.l\.B
>
> Is bad because ( is a regexp control character.  In fact when I
> run this particular test I get this output:
>
>   ERROR: couldn't compile regular expression pattern: parentheses () 
> not balanced
>     while executing
>   "regexp "^$line_bx$" "$line_a""
>     (procedure "regexp_diff" line 121)
>     invoked from within
>   "regexp_diff $dumpfile "${dfile}" $regexp_subst"
>     (procedure "run_dump_test" line 667)
>     invoked from within
>   "run_dump_test "crc32-poly""
>
> Since I assume that the textual interpretation of the binary values
> is not important you can just use the period character to match any
> text:
>
>     2030 c5648dc3 17584c28 be6054a9 6c5c9542  ................
>
> Or just:
>
>     2030 c5648dc3 17584c28 be6054a9 6c5c9542  .*
>
> Also, you can skip filler lines using "#..." if you want, in order to
> make the .d files short.  So for example:

>
>> + 1120 434f4445 0c110000 ffffffff ffffffff  CODE............
>> + 1130 ffffffff ffffffff ffffffff ffffffff  ................
> ...
>> + 1fe0 ffffffff ffffffff ffffffff ffffffff  ................
>> + 1ff0 ffffffff ffffffff 434f4445 deadbeef  ........CODE....
>
> Could be written as:
>
>     1120 434f4445 0c110000 ffffffff ffffffff  CODE.*
>     #...
>     1ff0 ffffffff ffffffff 434f4445 deadbeef  .*CODE.*

OK.


> Also, be wary of using values larger than a byte:
>
> > + 1ff0 ffffffff ffffffff 434f4445 deadbeef  ........CODE....
>
> This works if the target is little endian, but on big
> endian architecture the bytes will be in a different order.
>
The "434f4445 deadbeef" style tag is to mark the beginning and end of a 
header.
(it is deadbeef 434f4445 in the end)
The validation of the image starts by checking these boundaries.
If they are not present, the validation will fail.
the actual value stored is not important, as long as the generation and 
check
uses the same value.


> Cheers
>   Nick
>


More information about the Binutils mailing list