<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Mohannad,</p>
    <p>That is possible using a two-stage build [0]. Basically in a
      two-stage build, CMake builds clang once and then uses the
      just-built compiler to build the target-specific libraries. You
      can also set it up such that it uses the just-built compiler to
      build clang again in order to benefit from the latest
      optimizations. In llvm-project/clang/cmake/caches you can find a
      couple of CMake cache files that set this up. You should check out
      Fuchsia.cmake, Fuchsia-stage2.cmake and BaremetalARM.cmake. I
      found these to be the easiest ones to follow when setting up such
      a build.</p>
    <p>If you only want to build clang once and then build compiler-rt,
      you shouldn't need to look at Fuchsia.cmake. AFAIU it is just to
      build clang, which is then used by Fuchsia-stage2.cmake to build
      clang and the libraries.<br>
    </p>
    <p>Hope that helps!</p>
    <p>Cheers,</p>
    <p>Dominik<br>
    </p>
    <p>[0] LLVM documentation on two-stage builds:
      <a class="moz-txt-link-freetext" href="https://llvm.org/docs/AdvancedBuilds.html">https://llvm.org/docs/AdvancedBuilds.html</a><br>
    </p>
    <div class="moz-cite-prefix">Am 02.10.20 um 01:08 schrieb Mohannad
      Ismail via llvm-dev:<br>
    </div>
    <blockquote type="cite"
cite="mid:CANxXuYO-BFNJq9LTL0aOtK6Qkxxqe_gNfpGzojfx1yH2nNWVig@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hello Tobias,
        <div><br>
        </div>
        <div>Thank you for your reply. That is very helpful and I
          currently was able to get that done. However, I was looking
          for a much cleaner solution in which I can compile clang to be
          x86 and compiler-rt to be aarch64 both at the same time in one
          compilation. Do you have any idea if that is possible?</div>
        <div><br>
        </div>
        <div>Best regards,</div>
        <div>Mohannad Ismail</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Sep 30, 2020 at 12:16
          PM Tobias Hieta <<a href="mailto:tobias@plexapp.com"
            moz-do-not-send="true">tobias@plexapp.com</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="auto">Hey,
            <div dir="auto"><br>
            </div>
            <div dir="auto">You can do that by running cmake directly
              against the compiler-rt directory instead of the llvm dir.</div>
            <div dir="auto"><br>
            </div>
            <div dir="auto">Hope this helps!</div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Wed, Sep 30, 2020,
              17:54 Mohannad Ismail via llvm-dev <<a
                href="mailto:llvm-dev@lists.llvm.org" target="_blank"
                moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div dir="ltr">Greetings everyone,
                <div><br>
                </div>
                <div>I am currently cross-compiling some of my programs
                  to aarch64 with Clang. I added my own sanitizer and
                  library to the compiler-rt and want to use it.
                  However, since my machine is x86, the libraries are
                  compiled for x86 use. I was able to cross-compile to
                  get the aarch64 libraries. However, this also
                  cross-compiles clang and now I can't use it on my x86
                  machine. Is there a way to cross-compile only
                  compiler-rt and not Clang? I can't seem to find a way
                  to do this.</div>
                <div><br>
                </div>
                <div>In short, I want to have aarch64 compiler-rt
                  libraries and an x86 clang, since I will be compiling
                  my programs on an x86 machine. Hope I was able to
                  explain this well enough. Please let me know if I
                  wasn't clear or if you have any questions. Thank you
                  very much!</div>
                <div><br>
                </div>
                <div>Best regards,</div>
                <div>Mohannad Ismail</div>
              </div>
              _______________________________________________<br>
              LLVM Developers mailing list<br>
              <a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer"
                target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
              <a
                href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
            </blockquote>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
----------------------------------------------------------------------
Dominik Montada                   Email: <a class="moz-txt-link-abbreviated" href="mailto:dominik.montada@hightec-rt.com">dominik.montada@hightec-rt.com</a>
HighTec EDV-Systeme GmbH          Phone: +49 681 92613 19
Europaallee 19                    Fax:   +49-681-92613-26
D-66113 Saarbrücken               WWW: <a class="moz-txt-link-freetext" href="http://www.hightec-rt.com">http://www.hightec-rt.com</a>

Managing Director: Vera Strothmann
Register Court: Saarbrücken, HRB 10445, VAT ID: DE 138344222

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient please notify the sender immediately
and destroy this e-mail. Any unauthorised copying, disclosure or
distribution of the material in this e-mail is strictly forbidden.
--- </pre>
  </body>
</html>