{"id":544,"date":"2023-07-24T23:21:47","date_gmt":"2023-07-24T23:21:47","guid":{"rendered":"https:\/\/blogs.gentoo.org\/gsoc\/?p=544"},"modified":"2023-07-24T23:21:47","modified_gmt":"2023-07-24T23:21:47","slug":"weekly-report-8-llvm-libc","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/gsoc\/2023\/07\/24\/weekly-report-8-llvm-libc\/","title":{"rendered":"Weekly report 8, LLVM libc"},"content":{"rendered":"<p>Hi! This (and last week) I&#8217;ve spent my time polishing the LLVM\/Clang<br \/>\ncrossdev work. I have also created ebuilds for llvm-libc, libc-hdrgen<br \/>\nand also the SCUDO allocator. But I will probably bake SCUDO into the<br \/>\nllvm-libc ebuild instead actually.<\/p>\n<p>One thing I have also made is a cross eclass that handles cross<br \/>\ncompilation, instead of having the same logic copy-pasted in all<br \/>\nebuilds. To differentiate a &#8220;normal&#8221; crossdev package and LLVM\/Clang<br \/>\ncrossdev I decided to use &#8220;cross_llvm-${CTARGET}&#8221; as package category<br \/>\nname. This is necessary since you need some way to tell the ebuild about<br \/>\nusing LLVM for cross. My initial idea was to handle all this in the<br \/>\ncrossdev script, but crossdev ebuilds are self-contained, and you can do<br \/>\nsomething like &#8220;emerge cross_llvm-gentoo-linux-llvm\/llvm-libc&#8221; and it<br \/>\nwill do the right thing without running emerge from crossdev. Hence I<br \/>\nneed to handle cross compilation in the ebuilds themselves, using the<br \/>\neclass. Me and sam are not sure if a new eclass is the right thing to<br \/>\ndo but I will continue with it until I get some more thoughts as we can<br \/>\njust inline everything later without wasting any work.<\/p>\n<p>I feel pretty much done now except for baking SCUDO directly into the<br \/>\nllvm-libc ebuild. Actually it is very simple to do but I got some issues<br \/>\nwith libstdc++ when using llvm\/ as root source directory for the libc<br \/>\nbuild, which is necessary to use when compiling SCUDO. Previously I used<br \/>\nruntimes\/ as root directory, and that worked without issue. Currently to<br \/>\nwork around this you can just compile the source files in<br \/>\nllvm-project\/compiler-rt\/lib\/scudo\/standalone and append the object<br \/>\nfiles into libc.a. LLVM libc then just works with crossdev and you<br \/>\ncan compile things with the emerge wrapper as usual, but currently a lot<br \/>\nof autotools things break due to me not having specified gnuconfig for<br \/>\nllvm-libc yet.<\/p>\n<p>I had a lot of trouble last week with sonames when doing an aarch64 musl<br \/>\ncrossdev setup and running binaries with qemu-user, however it turned<br \/>\nout it was just a warning and it worked after setting LD_LIBRARY_PATH as<br \/>\nenvvar to qemu-user. I spent a loong time on this.<\/p>\n<p>Currently I will need to upstream changes to compiler-rt ebuild, musl<br \/>\nllvm-libc ebuild, libc-hdrgen, cross.eclass, and of course crossdev.<\/p>\n<p>Next week I will send the changes upstream for review and continue work<br \/>\non LLVM libc, most likely simple packages like ed, and then try to get<br \/>\nthe missing pieces upstreamed to LLVM libc. fileno() is definitely<br \/>\nneeded for ed.<\/p>\n<p>Last week I did not write a blog post as I was in &#8220;bug hell&#8221; and worked<br \/>\non a lot of small things at once and thought &#8220;if I just finish this I<br \/>\ncan write a good report&#8221;, and then wednesday came, and I decided to just<br \/>\ndo an overview of all my work for this weeks&#8217; blog instead \ud83d\ude00<\/p>\n<p>&#8211; &#8212;<br \/>\ncatcream<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi! This (and last week) I&#8217;ve spent my time polishing the LLVM\/Clang crossdev work. I have also created ebuilds for llvm-libc, libc-hdrgen and also the SCUDO allocator. But I will probably bake SCUDO into the llvm-libc ebuild instead actually. One &hellip; <a href=\"https:\/\/blogs.gentoo.org\/gsoc\/2023\/07\/24\/weekly-report-8-llvm-libc\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":177,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/posts\/544"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/users\/177"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/comments?post=544"}],"version-history":[{"count":1,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/posts\/544\/revisions"}],"predecessor-version":[{"id":545,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/posts\/544\/revisions\/545"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/media?parent=544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/categories?post=544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/tags?post=544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}