Seongbae Park wrote:
The above code looks incorrect, for various reasons,
not the least of which is that you're assuming CIE/FDE are fixed-length.
This is a trivial thing I will add later.
There are various factors that affect FDE/CIE
depending on PIC/non-PIC, C or C++, 32bit/64bit, etc -
some of them must be invariant for your JIT but some of them may not.
I generate always the same prologue for exactly this reason:
I do not want to mess with this stuff.
Also some of the datum are encoded as uleb128
(see dwarf spec for the detail of LEB128 encoding)
which is a variable-length encoding whose length depends on the value.
For this values the uleb128 and leb128 routines produce exactly the values
shown.
In short, you'd better start looking at how CIE/FDE structures are
*logically*
layed out - otherwise you won't be able to generate correct entries.
So far I have understood what those opcodes do, and are the same as
gcc. Please try to understand my situation and find the bug
( or where the bug could be). It is not in here? I mean changing
*p++ = 1;
or
p = encodeuleb128(1,p);
is *the same* in this context.