<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 10, 2015 at 6:27 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 9 September 2015 at 17:58, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> Sorry to resurrect this old thread, but as I take a look again at the ELF<br>
> Writer's code, I found that this patch made the code a bit messy. Some<br>
> functions or classes are specialized only for `Is64Bits` and others are for<br>
> `ELFT`, although `ELFT` works for both cases. I really prefer code<br>
> simplicity over marginal efficiency at this stage of development, so I agree<br>
> with Sean. Can I roll it back?<br>
<br>
</span>The main value I see with the current setup is that the members we<br>
have are plain structs. This means that they print cleanly on a<br>
debugger.<br>
<br>
The structs in ELFTypes.h are "unreadable". One has to fetch<br>
individual fields and cast them to the proper type to read the value,<br>
something like:<br>
<br>
p (uint32_t) Value->st_name.<br>
<br>
The logic of what is templated over ELFT or Is64Bits is actually<br>
pretty simple: Stuff that reads inputs is ELFT. Stuff that we<br>
construct is Is64Bit.<br></blockquote><div><br></div><div>How can this handle constructing a big-endian output file from a little-endian host? Or maybe I'm not understanding what you mean?</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
And last, it does reduce code duplication and increases the alignment<br>
of the stuff we construct.<br>
<br>
So my preference would be to keep it as is for now.<br>
<br>
Cheers,<br>
Rafael<br>
<br>
P.S.: Once we can link something big but simple (static clang with<br>
musl for example), I intend to benchmark and revisit the file output<br>
strategy, so I will be taking a thorough look at this fairly soon.<br>
</blockquote></div><br></div></div>