poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set_endian


From: Bruno Haible
Subject: Re: set_endian
Date: Tue, 13 Feb 2024 22:44:52 +0100

I wrote:
> gmo-ok.pk work fine on little-endian .mo files

In fact, it doesn't: When I map the same file to the same address twice,
the first time it succeeds but the second time it fails:

$ poke -l gmo.pk
(poke) .file mf-12.mo
(poke) GMO_file @ 0#B
GMO_file {magic=0xde120495U,header=GMO_file_header {revision=0x00000001U, ...}}
(poke) GMO_file @ 0#B
unhandled constraint violation exception
failed expression
  (revision .>> 16) <= 1
  // Constraint for the minor revision:
  && ((revision & 0xffff) == GMO_REVISION_NUMBER
      || (revision & 0xffff) == GMO_REVISION_NUMBER_WITH_SYSDEP_I)
in field GMO_file_header.revision

The idiom, which I took from btf-ext.pk:

    uint<16> magic : ((magic == 0x9feb && set_endian (ENDIAN_BIG))
                        || (magic == 0xeb9f && set_endian (ENDIAN_LITTLE)));

appears to be broken.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]