//build/toolchain/musl-host-gcc: implement

This is a cc_toolchain which runs on x86 systems with Linux/gcc and
targets Smalltown via static musl builds.

It is currently unused, but can be tested by trying to build any
cc_binary with
--crosstool_top=//build/toolchain/musl-host-gcc:musl_host_cc_suite .

Test Plan: This has been tested manually by running it against a simple cc_binary. Another revision on top of this will attempt to build mkfs.xfs with it.

X-Origin-Diff: phab/D623
GitOrigin-RevId: ebdf51ee76d9d5a7fd94725c66ef53783f787df7
diff --git a/third_party/musl/BUILD.bazel b/third_party/musl/BUILD.bazel
index e69de29..afd1212 100644
--- a/third_party/musl/BUILD.bazel
+++ b/third_party/musl/BUILD.bazel
@@ -0,0 +1,36 @@
+genrule(
+    name = "musl",
+    srcs = [
+        "@musl//:all",
+    ],
+    outs = [
+        # C Runtimes
+        "crt1.o",
+        "crti.o",
+        "crtn.o",
+        "rcrt1.o",
+        "Scrt1.o",
+
+        # Static musl libc
+        "libc.a",
+
+        # Placeholder archives
+        "libcrypt.a",
+        "libdl.a",
+        "libm.a",
+        "libpthread.a",
+        "libresolv.a",
+        "librt.a",
+        "libutil.a",
+        "libxnet.a",
+    ],
+    cmd = """
+    OUT=$$PWD/$(RULEDIR)
+    (
+        cd external/musl
+        ./configure --prefix=$$OUT --syslibdir=$$OUT --libdir=$$OUT
+        make -j $$(nproc) install-libs
+    ) > /dev/null
+    """,
+    visibility = ["//visibility:public"],
+)