<div dir="ltr"><div dir="ltr">On Tue, Mar 31, 2020 at 7:42 AM David Chisnall via libc-dev <<a href="mailto:libc-dev@lists.llvm.org" target="_blank">libc-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello libc people,<br>
<br>
When llvm-libc was approved for incorporation into LLVM, the stated goal <br>
was to provide a portable libc implementation. I'm quite concerned that <br>
we are increasingly seeing a load of Linux-specific code being <br>
committed.</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This is all in a linux directory, which is fine in theory, <br>
but I don't want us to end up with an entire libc in linux/x86-64/* and <br>
nothing elsewhere. It is much easier to build portable software from <br>
the start than it is to retrofit portability. We need to start putting <br>
in platform and architecture abstraction layers from the start.<br></blockquote><div><br></div><div>I totally agree. We have to start somewhere, and we have started with x86_64 on linux as that is the most easily accessible platform for us working on libc. As the structure gets more complicated, and as we start adding more architectures (which we will), we will definitely pull out the common code and build abstraction layers. The memcpy implementation already has a small example of abstraction (may be trivial at this point) for handling i386 and x86_64.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Most of the code committed in linux/x86_64/start.cpp, is either <br>
identical or almost identical on all architectures and all System-V ABI <br>
platforms. As the code is currently structured, this is going to be <br>
copied and pasted repeatedly.<br></blockquote><div><br></div><div>The same points as above hold for this as well. But, I take your point and do understand what you are saying. FWIW, no one wants copy-pasted code. As I said above, we have to start somewhere and this is where we started.</div><div><br></div><div>Few observations which are probably not related to the topic of this thread:</div><div>From my side personally, I have been very particular with getting the code structure right in my own patches as well when doing code reviews. At the same time, I also do not want the quest for perfection to hinder progress. A nice side effect of allowing progress is that it allows us to learn. And, there have been a few instances wherein we reversed our initial decisions as we realized they were not good enough. Also, for a project as vast as a libc, trying and experimenting should be encouraged even if not all of them succeed (personally, I am OK if most of them fail as long as they teach us something.)</div><div><br></div><div>Thanks,</div><div>Siva Chandra</div></div></div>