<div dir="ltr">Thank you for the update. It's interesting.<div><br></div><div>I think clang is too small to use as a test for the feature. It can easily fit in in-memory cache, so the accesses to the file won't actually go to the disks. Even if it hits a disk, it's still probably too small. You want to test it with a latency-sensitive (i.e. user-facing) huge apps, such as Firefox or Chromium.</div><div><br></div><div>Do you have an SSD to test this feature? I think we are interested in performance numbers on SSDs.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 21, 2016 at 9:12 AM, George Rimar <span dir="ltr"><<a href="mailto:grimar@accesssoftek.com" target="_blank">grimar@accesssoftek.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">grimar added a comment.<br>
<br>
Short update: I was able to use gcc to extract section ordering files. For start I generated order list for clang launch without any arguments.<br>
I used gcc from svn://<a href="http://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9" rel="noreferrer" target="_blank">gcc.gnu.org/svn/gcc/<wbr>branches/google/gcc-4_9</a>.<br>
For doing these next steps were performed:<br>
<br>
1. Build llvm with:<br>
<br>
-DCMAKE_BUILD_TYPE=Release -DLLVM_PARALLEL_COMPILE_JOBS=8 -DLLVM_ENABLE_THREADS=true -DCMAKE_CXX_FLAGS="-fPIC -std=c++11 -ffunction-sections -fdata-sections -fprofile-generate=/home/umb/<wbr>LLVM/gcda" -DCMAKE_C_FLAGS="-fPIC -ffunction-sections -fdata-sections -fprofile-generate=/home/umb/<wbr>LLVM/gcda" -DCMAKE_C_COMPILER=/home/umb/<wbr>gcc49google/bin/gcc -DCMAKE_CXX_COMPILER=/home/<wbr>umb/gcc49google/bin/g++<br>
<br>
2. Run binary in the way we are interested in. It was ./clang w/o arguments in my case (.gcda files should be produced after that).<br>
<br>
3. Now rebuild llvm with -fprofile-use and use of .gcda files we obtained earlier. Use gold linker.<br>
<br>
-DCMAKE_BUILD_TYPE=Release -DLLVM_PARALLEL_COMPILE_JOBS=8 -DLLVM_ENABLE_THREADS=true -DCMAKE_CXX_FLAGS="-B/usr/<wbr>local/bin -fPIC -std=c++11 -ffunction-sections -fdata-sections -fprofile-dir=/home/umb/LLVM/<wbr>gcda -fprofile-use -freorder-functions=callgraph -Wl,--plugin-opt,file=/home/<wbr>umb/LLVM/order.txt" -DCMAKE_C_FLAGS="-B/usr/local/<wbr>bin -fPIC -ffunction-sections -fdata-sections -fprofile-dir=/home/umb/LLVM/<wbr>gcda -fprofile-use -freorder-functions=callgraph -Wl,--plugin-opt,file=/home/<wbr>umb/LLVM/order.txt" -DCMAKE_C_COMPILER=/home/umb/<wbr>gcc49google/bin/gcc -DCMAKE_CXX_COMPILER=/home/<wbr>umb/gcc49google/bin/g++<br>
<br>
4. Remove order.txt and relink clang, that will create order.txt containing sections order for its executable.<br>
<br>
I shared it here: <a href="https://drive.google.com/file/d/0B_OWr6ld9gUmd1hnV1k4Z25NQVk/view?usp=sharing" rel="noreferrer" target="_blank">https://drive.google.com/file/<wbr>d/0B_<wbr>OWr6ld9gUmd1hnV1k4Z25NQVk/<wbr>view?usp=sharing</a><br>
It is 18 megabytes in size.<br>
<br>
Order list file contains next sections:<br>
.text.unlikely.*<br>
.text.exit.*<br>
.text.startup.*<br>
.text.hot.*<br>
<br>
BTW, both gold and ld recognize suzh sections by name and use names as hint for sorting (no matter was order file used or not).<br>
I did not check how it works, but that is what I saw in bfd/gold source code.<br>
Do we want to implement the same for compatibility ?<br>
<br>
Finally, now when I have such file I am going to write a tool or script to prepare it to be used as linker input ordering file (looks it contains excessive data, I'll check) and run some tests.<br>
First one will be estimate clang launch time with sections ordered and without. I am thinking about other possible ones, may be compile simple helloworld ?<br>
<br>
<br>
<a href="https://reviews.llvm.org/D25766" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D25766</a><br>
<br>
<br>
<br>
</blockquote></div><br></div>