<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <blockquote cite="mid:520ADCCF.1030603@gmail.com" type="cite"> <br>
      <blockquote
cite="mid:CADbEz-g4iPo1ckhnzAJ21uN_wKK5vQCv=fmtamD4WjhNrRzasQ@mail.gmail.com"
        type="cite">
        <div dir="ltr">
          <div class="gmail_extra">
            <div class="gmail_quote">
              <div><br>
              </div>
              <div><span
                  style="font-family:arial,sans-serif;font-size:13px">Thirdly,

                  I'm not convinced that lto_codegen_get_files_need_</span><span
                  style="font-family:arial,sans-serif;font-size:13px">remove

                  needs to exist. Why not do the file deletion in
                  lto_codegen_dispose?</span><br>
              </div>
            </div>
          </div>
        </div>
      </blockquote>
      You never know long the linker hold the intermediate file. <br>
      On the hand, there was a bug in Apple ld, which never call
      llto_codegen_dispose. <br>
      <br>
      <br>
      <blockquote
cite="mid:CADbEz-g4iPo1ckhnzAJ21uN_wKK5vQCv=fmtamD4WjhNrRzasQ@mail.gmail.com"
        type="cite">
        <div dir="ltr">
          <div class="gmail_extra">
            <div class="gmail_quote">
              <div> </div>
              <br>
            </div>
          </div>
        </div>
      </blockquote>
    </blockquote>
    <br>
    I were not clear on this item. <br>
    <br>
    Actually, I try to delete all intermediate files in the
    lto_codegen_dispose(), and I found it is not called on Darwin, which
    <br>
    is a bug. I checked the tool/gold/*, from the code,  I don't know
    (we certainly should not speculate) when the resulting <br>
    object files can be safely delete except in the cleanup_hook exposed
    to the linker. <br>
    <br>
    So, it is safe to keep the these files as long as possible (until it
    is deleted by cleanup_hook). Who care disk space? <br>
    However, we should delete the LTOCodeGenetator instance as early as
    possible to  free mem space, which is important <br>
    as linker is a memory hogging beast. <br>
    <br>
    On Darwin, the intermediate files are deleted after the resulting
    object is brought to memory and hand it over to <br>
    linker.  So, it have no problem despite the bug. <br>
    <br>
    In the long run, as I said before. The best place for these damn
    lto_xxxx() APIs is /dev/null... <br>
    But for now, in order to move forward, I have to introduce one more
    API. <br>
    <br>
    <br>
      This added API is useful for those:<br>
       - who directly use lto_xxx APIs, and unlike Apple ld, it call
    LTOCodeGenerator::compile_to_file() instead<br>
         of LTOCodeGenerator::compile(). <br>
      - and the SW is released independently.  (Hobby project is not a
    concern). <br>
    <br>
      The user who use gold-linker dose not see this change all, as all
    the change stop at tool/gold/*.cpp which dose not have<br>
    to call APIs; they can directly call LTOCodeGenerator::whatever(). 
    Darwin users don't worry either, as the files are delete <br>
    before the buffer is return back the linker.  <br>
  </body>
</html>