public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ulf Samuelsson <binutils@emagii.com>
To: Nick Clifton <nickc@redhat.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH v4 2/5] CRC64 testsuite
Date: Tue, 28 Feb 2023 14:01:10 +0100	[thread overview]
Message-ID: <E16AD71E-8C72-4E35-8CB8-AB8A74384366@emagii.com> (raw)
In-Reply-To: <74421307-88dc-f745-fac0-ba8ae59dcddc@redhat.com>

I am considering ”cheating” by always storing the CRC as big endian.
That would simplify the test.
It would also make the CRC readable in the text output.
Drawback is of course that small endian targets would have to swap the CRC before use.

Best Regards
Ulf Samuelsson

> 28 feb. 2023 kl. 13:37 skrev Nick Clifton <nickc@redhat.com>:
> 
> Hi Ulf,
> 
>>  * CRC64-ECMA
>>  * CRC64-ISO
>>  * CRC64-WE
>>  * CRC64-XZ
>>  * CRC64-POLY
>>  * CRC32
>>  * CRC32-POLY
> 
> As a matter of interest, where are these names and algorithms defined ?
> Is there a ISO standard for them, for example ?
> 
>> * Is there a way to select one of two tests within the test framework
>>    based on endianess of the build and target machines?
> 
> Hmm, tricky.  The short answer is "no", as in there is no handy proc
> that you can invoke to determine the endian-ness of the target.
> 
> But, in fact there is a way, it is just a little bit complicated.
> The linker supports two command line options to select the endian-ness
> of the output: -EL and -EB.  So you can run a quick test of the linker
> to see if it accepts one of them:
> 
>  global ld
>  set big_endian 0
>  if { [run_host_cmd_yesno $ld "-EB -e 0 -o /dev/null foo.o"] } {
>     set big_endian 1
>  }
> 
> But - this will not help with targets that support both big- and
> little- endian variations.  So you need to check for those first:
> 
>  global ld
>  set big_endian 0
>  if [string equal [big_or_little_endian] " -EB"] then {
>    set big_endian 1
>  } else {
>        if { [run_host_cmd_yesno $ld "-EB -e 0 -o /dev/null foo.o"] } {
>             set big_endian 1
>        }
>  }
> 
> I have not actually tried this code in practice, but in theory it
> should work.  It does presume that you have a handy "foo.o" available
> which will link without errors so you may need to some code to create
> that in the first place.
> 
> Cheers
>  Nick
> 
> 

  reply	other threads:[~2023-02-28 13:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-19 19:45 [PATCH v4 0/5 Add support for CRC64 generation in linker binutils
2023-02-19 19:45 ` [PATCH v4 1/5] CRC64 commands documentation binutils
2023-02-19 19:50   ` [PATCH v4 0/5] Add support for CRC64 generation in linker Ulf Samuelsson
2023-02-21 12:02     ` Nick Clifton
2023-02-21 13:10       ` Ulf Samuelsson
2023-02-21 13:30       ` Ulf Samuelsson
2023-02-21 12:53   ` [PATCH v4 1/5] CRC64 commands documentation Nick Clifton
2023-02-21 13:24     ` Ulf Samuelsson
2023-02-19 19:45 ` [PATCH v4 2/5] CRC64 testsuite binutils
2023-02-21 12:42   ` Nick Clifton
2023-02-21 15:13     ` Ulf Samuelsson
2023-02-23 10:10       ` Nick Clifton
2023-02-23 10:53         ` Ulf Samuelsson
2023-02-23 11:01           ` Nick Clifton
2023-02-28 11:11         ` Ulf Samuelsson
2023-02-28 12:37           ` Nick Clifton
2023-02-28 13:01             ` Ulf Samuelsson [this message]
2023-02-28 13:06               ` Nick Clifton
2023-02-28 14:24                 ` Ulf Samuelsson
2023-02-28 13:45             ` Ulf Samuelsson
2023-02-19 19:45 ` [PATCH v4 3/5] ldlex.l: CRC64 binutils
2023-02-19 19:45 ` [PATCH v4 4/5] ldgram.y: CRC64 binutils
2023-02-19 19:45 ` [PATCH v4 5/5] Calculate CRC64 over the .text area binutils
2023-02-21 13:26   ` Nick Clifton
2023-02-23  8:36     ` 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=E16AD71E-8C72-4E35-8CB8-AB8A74384366@emagii.com \
    --to=binutils@emagii.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.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).