jroelofs added a comment.

In D87164#2268366 <https://reviews.llvm.org/D87164#2268366>, @mcarrasco wrote:

> @jroelofs no worries, thanks a lot for your time.
>
> Please tell me if I understood you correctly.
>
> It is acceptable just to append the -lgcc if -rtlib=libgcc is used, although 
> the user is responsible to ensure that correct paths are provided so libgcc 
> is found.

Kind of, yeah.

> I also agree with the above, although I just want to know if I got your words 
> correctly. In addition, you suggest that the build system should invoke clang 
> with a valid value in --resource-dir option in order find libgcc.

If you're putting together your own toolchain, then the right thing to do is to 
install libgcc into the folder where clang expects to find the compiler-rt 
builtins in the resource-dir. This is usually in a folder that's sibling to the 
compiler itself, something like lib/clang/$version/lib/baremetal, assuming 
clang lives at bin/clang.

> Could you point me where I can find more info regarding --resource-dir? So 
> far I only found this:
>
>   clang --help-hidden | grep resource-dir
>     -print-resource-dir     Print the resource directory pathname
>     -resource-dir <value>   The directory which holds the compiler resource 
> files
>
> Sincerly, I'm a little bit confused about: -sysroot, -gcc-toolchain and now 
> -resource-dir

I don't know of any docs for it off the top of my head, but roughly speaking:

- resource-dir is where the compiler is instructed to find the compiler-support 
libraries (i.e. compiler-rt or libgcc)
- sysroot is where libc, the stl, unwinder, c++ abi support library etc should 
live. The folder that this points at should have the same layout as root would 
(i.e. with $sysroot/usr/lib, $sysroot/usr/include, etc), were you building for 
the target from the target (not that that makes much sense for baremetal, but 
you get the picture).
- -gcc-toolchain is where to look for a gcc toolchain for your target. This is 
mainly for linux targets that rely on an installed gcc toolchain, and isn't 
hooked up for the bare metal side of things. This isn't necessary if you have a 
self-contained clang toolchain built that doesn't rely on those bits of gcc.

> Thanks for your feedback!
> Manuel.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87164/new/

https://reviews.llvm.org/D87164

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to