From 0e49ce52dfaede8cc683f2197416e7fbe3cb603a Mon Sep 17 00:00:00 2001
From: Neil Mitchell <ndmitchell@meta.com>
Date: Mon, 10 Oct 2022 02:04:02 -0700
Subject: [PATCH] Switch the toolchain to gcc

Summary: This seems to make linking work a lot better.

Reviewed By: arlyon

Differential Revision: D40213769

fbshipit-source-id: 69e824b7aacd03f41a780f5922ef54e38f0fcaff
---
 shim/toolchain.bzl | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/shim/toolchain.bzl b/shim/toolchain.bzl
index 87ea9823cbb7..caef9f12e150 100644
--- a/shim/toolchain.bzl
+++ b/shim/toolchain.bzl
@@ -40,25 +40,8 @@ def _cxx_toolchain(ctx):
         CxxToolchainInfo(
             mk_comp_db = ctx.attrs.make_comp_db,
             linker_info = LinkerInfo(
-                linker = RunInfo(args = ["ld"]),
-                linker_flags = [
-                    "-dynamic-linker",
-                    "/lib64/ld-linux-x86-64.so.2",
-                    "/usr/lib64/crt1.o",
-                    "/usr/lib64/crti.o",
-                    "/usr/lib64/crtn.o",
-                    "-L/usr/lib/gcc/x86_64-redhat-linux/12",
-                    "-lstdc++",
-                    "-lm",
-                    "-lgcc",
-                    "-lc",
-                ] + [
-                    "/usr/lib/gcc/x86_64-redhat-linux/12/crtendS.o",
-                    "/usr/lib/gcc/x86_64-redhat-linux/12/crtbeginS.o",
-                ] if ctx.attrs.link_style == "shared" else [
-                    "/usr/lib/gcc/x86_64-redhat-linux/12/crtend.o",
-                    "/usr/lib/gcc/x86_64-redhat-linux/12/crtbegin.o",
-                ],
+                linker = RunInfo(args = ["gcc"]),
+                linker_flags = [],
                 archiver = RunInfo(args = ["ar", "rcs"]),
                 type = "gnu",
                 link_binaries_locally = True,