This works for me:
1 - Create a directory, say, MyToolchain (don't add a file extension, yet)
2 - cd to the directory, and create an Info.plist file. I use an application called PListEditor, you can use Xcode, or you can manually edit the XML in a text file. It needs to have, as a minimum, a key called CFBundleIdentifier, as a String, with something that will identify the bundle to Xcode. Typically it's something like a reversed domain name, like, person.jprescott.MyToolchain, or, just MyToolchain, if you want.
3 - Put in a usr directory that has all your tools, library, etc, include. It should have all your tools you might need with Xcode (compilers, linkers/loaders, archivers, ) header files to be searched as part of the system header search paths (doesn't have to be all of /usr/include), libraries to be linked, etc.. This is a standard usr layout you would find on any Unix/Linux, but only has the tools necessary to compile, analyze, link your programs.
4 - Put in other directories that you might need. Apple, for example, puts in a Developer directory that holds various frameworks that are relevant. If you open Xcode.app with "Show Contents" and go to Developer>Toolchains, and open the default toolchain using "Show Contents," you'll see an example of the organization beyond just usr.
5 - When you're done, change the directory filename to "MyToolchain.xctoolchain". You'll be asked to verify that you want to change the name. When you answer yes, the icon for the directory will change to the Xcode toolchain icon, and the directory looks like a single file. If you want to get to the directory contents, you open the toolchain with "Show Contents"
6 - Move the new toolchain to either /Library/Developer/Toolchains, for system use, or ~/Library/Developer/Toolchains. It will then be visible in Xcode Preferences as a toolchain option.
Each toolchain should address a single version of whatever compiler(s) you are using. You could put clang and gcc in the same toolchain, but, only one version of clang/gcc unless you give the compilers different names. I have LLVM toolchains org.llvm.8.0.0svn, org.llvm.9.0.0svn, org.llvm.10.0.0.git that have only the version of clang/llvm in them. However, Xcode includes a version of gcc along with clang (gcc points to clang, but, it is a separate executable) in the default toolchain.
If you are asking for use with Linux, or other IDEs, you'll have to ask elsewhere.
Hope this helps.