The Baremetal toolchain currently has a fixed behavior regardless of the -rtlib option's value. It is always linking against compiler-rt unless -nodefaultlibs is enabled.
This proposal slightly changes the code in such a way that enabling -rtlib=libgcc implies linking against -libgcc.
Something that I'm unsure about this patch is that we are not enforcing the existence of such libgcc. By reading other toolchains, I understood that is not always enforced. Do you think this policy is acceptable? If it is not, how would you think it should be addressed?
So far I manually set an -L path to a valid libgcc on my system when clang is invoked. In this particular case, I use arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -print-libgcc-file-name which retrieves the path I want.
Assume the user forwards a gcc-toolchain installation through --gcc-toolchain. Would be a good idea to programmatically query arm-none-eabi-gcc for the libgcc as described above? If that is the case, how would be the most "llvm way" to do it? I'm not very related to all abstractions and concepts from the framework.
This is my very first contribution to LLVM so I'd really appreciate any feedback in order to improve this proposal :)